just wondering how everyone would improve this rule i look forward too seing some replys how would you make it shorter ? how would you improve on it and what else would you add its a simple rule but the best i can make at the moment
rule "Movie Mode OFF"
when
Item Movie_Mode_Trigger changed from ON to OFF or
Item KodiHTPC2_Stop changed from OFF to ON
then
if (Movie_Mode_Enabled.state == ON) {
if(now.getHourOfDay > 9 && now.getHourOfDay < 16) {} //9AM - 4PM
Lamp1_Brightness.sendCommand("70")
Disable_Amp_Rule.sendCommand("OFF")
Movie_Mode_Trigger.sendCommand("OFF")
Movie_Mode_Enabled.sendCommand("OFF")
logInfo("Rule", "Movie Mode OFF Running (Routines.rules)")
}
if (Movie_Mode_Enabled.state == ON) {
if(now.getHourOfDay > 16 && now.getHourOfDay < 20) {} //4PM - 8PM
Lamp1_Brightness.sendCommand("60")
Disable_Amp_Rule.sendCommand("OFF")
Movie_Mode_Trigger.sendCommand("OFF")
Movie_Mode_Enabled.sendCommand("OFF")
logInfo("Rule", "Movie Mode OFF Running (Routines.rules)")
}
if (Movie_Mode_Enabled.state == ON) {
if(now.getHourOfDay > 20 && now.getHourOfDay < 22) {} //8PM - 10PM
Lamp1_Brightness.sendCommand("30")
Disable_Amp_Rule.sendCommand("OFF")
Movie_Mode_Trigger.sendCommand("OFF")
Movie_Mode_Enabled.sendCommand("OFF")
logInfo("Rule", "Movie Mode OFF Running (Routines.rules)")
}
if (Movie_Mode_Enabled.state == ON) {
if(now.getHourOfDay > 22 && now.getHourOfDay < 9) {} //10PM - 9AM
Lamp1_Brightness.sendCommand("10")
Disable_Amp_Rule.sendCommand("OFF")
Movie_Mode_Trigger.sendCommand("OFF")
Movie_Mode_Enabled.sendCommand("OFF")
logInfo("Rule", "Movie Mode OFF Running (Routines.rules)")
}
end
It would have partially worked. Basically if Movie_Mode_Enabled.state == ON, it would have done each block as the if(now.gethour…) isn’t doing anything.
It would have turned your light to 70, turned all your items listed off, made a log entry and moved to the next block. The next block would have set the light to 60, turned everything off (again) and added another entry. Repeat for the next block with 30 and then 10…
Did you not get four log entries of “Movie Mode OFF Running (Routines.rules)”?
No you aren’t. You’re learning. We all have been there. I still make stupid mistakes… trust me
One take away is to get a good tail going on your logs while you are testing rules. It would have been a solid indicator that something odd was happening.
i normally watch the log:tail i didn’t even realise anything was wrong with the rule so i didn’t bother this time i only posted too see what people would do iv learned a few lessons lol