I am looking for a little bit of help! I keep trying to mess around with rule machine myself to get this to work properly, but I just cant seem to nail it down.
I have an LED Strip behind of our Television (on a smart switch). I want the light to turn on with the TV (also on a smart switch), and to turn off automatically at 12am so it isn't on all night. Here is where things get tricky. This particular television is on most of the day, and I do not want the LED strip to be on all day.
I am looking for the strip to turn on -30 minutes before sunset, but only if the television is on. And the strip should turn off at Midnight.
So far the closest I can get it, is that the strip turns off with the television, and it turns on 30 minutes before sunset, but it comes on even if the television is off. I do have it turning off at midnight just fine.
I'm not clear on what you actually want to happen--it sounds like you only want the LEDs to turn on at sunset-30 if the TV is on, then turn off at midnight. Do you want the strips to turn on with the TV if the TV isn't on at sunset-30 but gets turned on between then and midnight? Do you want them to turn off with the TV if the TV gets turned off before midnight? You mentioned some of these things later, but it's not clear if that's because you actually want it to happen or it's all you could manage to get working.
If you really just want exactly what you said (on at sunset-30 if the TV is on, then off at midnight), this would do the trick:
Triggers:
Time is Sunset-30 OR
Time is Midnight OR
Actions:
IF (TV Switch is on AND Time is Sunset-30) THEN
On: TV LED Switch
ELSE-IF (Time is Midnight)
Off: TV LED Switch
END-IF
If you want it to turn on at sunset-30 if the TV is on but also turn on and off with the TV if the TV is turned on any time between sunset-30 and midnight and also turn off at midnight regardless, then something like this would work:
Triggers:
Time is Sunset-30 OR
Time is Midnight OR
TV Switch *changed*
Actions:
IF (TV Switch is on AND Time is between Sunset-30 and 11:59 PM) THEN
On: TV LED Switch
ELSE
Off: TV LED Switch
END-IF
Although it will turn off the light with the TV being tuned off won't it? Maybe something like:
if Bedroom TV is on THEN
if Time between Sunset -30 minutes and 11:59 PM THEN
On Bedroom TV Light
ELSE
Off Bedroom TV Light
END-IF
ELSE
if Time Not between Sunset -30 minutes and 11:59 PM THEN
Off Bedroom TV Light
END-IF
END-IF
Hi @Terk
I'm always intrigued when I see rules written as you have above in that you haven't done it in RM or just typed it in the text box as an example.
Have you written this as an actual app or in some sort of text editor.
Just wondering and sorry for going off topic.
Oops. I got that corrected. However the light doesnt turn off at midnight. It does turn on correctly only of the tv is on. If I turn off the tv after midnight it goes off then doesnt come back on....but doesnt turn off on it's own at midnight
Looks OK to me. Did you test after you changed it to PM? It wouldn't have turned off otherwise (even though it may look like you're only using that to turn on).
If it still doesn't work, turning on logging and then looking at the logs at or shortly after midnight may help narrow the problem down.