Jump to content

best way to do this? outside event code


arw01

Recommended Posts

on the quest for ir nirvana, I'm working on a couple of programs that will watch for certain ir events that get set via the rest interface though the lirc program running on the Pi.

 

If I hit the pause button 3 times in 5 seconds turn on a light

 

if I hit play button 3 times in 5 seconds set a scene Movie on

 

if I hit tivo tivo, make sure the tv is on (discrete on command), turn on the stereo, wait a few seconds and change the input to tivo

 

Currently I think I need 9 total programs just to monitor this stuff and react. Example of pause programs

 

Program 1 looks for a state variable to be greater than 0, this being set via the rest interface from the irexec program on the pi

 

If
       $sTivo_play_counter_ir > 0

Then
       $sTivo_play_ir += 1
       $sTivo_play_counter_ir  = 0
       $sTivo_any_ir  = 1

Else
  - No Actions - (To add one, press 'Action')

each time the play button is pressed the $sTivo_play_ir gets incremented, which
starts its 5 second countdown.  This watches for the control variable to increase
which means play was hit.

We also tell the system the basement is occupied

 

the wait program that resets the $sTivo_play_ir to 0 within a few seconds of the last hit of the button

 

If
       $sTivo_play_ir > 0

Then
       Wait  6 seconds
       $sTivo_play_ir  = 0

Else
  - No Actions - (To add one, press 'Action')

When the Tivo Play button is pressed, start timer to reset it to 0 within 6 seconds.

 

and finally the program that does the work

 

If
       $sTivo_play_ir is 3

Then
       Set Scene 'Movie_Basement' On
       $sTivo_play_ir  = 0

Else
  - No Actions - (To add one, press 'Action')

if tivo play is hit 3 times in 5 seconds, turn off some lights

Link to comment

Archived

This topic is now archived and is closed to further replies.


  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

    • There are no registered users currently online
  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.3k
×
×
  • Create New...