arw01 Posted March 24, 2013 Posted March 24, 2013 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
Recommended Posts