Hi Everyone,
I have created a rule that doesn’t seem to be working in the way I thought it should, as I’m not coder I’ve no doubt made a schoolboy error. So by all means chuck me some examples, to show me where I’m going wrong.
I’m hopefully that one of you clever people will see just from the rule why it’s not likely to fully work.
rule "First Floor Landing Motion Sensor Activation"
when
Item Landing_SP3102_Motion changed
then
postUpdate(Landing_Motion_Sensor_Last_Activation, new DateTimeType())
if(Landing_SP3102_Motion.state == ON && Living_Room_TV_Switch.state == OFF && Hallway_SP3102_Motion.state == ON && Time_Of_Day.state == "NIGHT") {
Living_Room_Table_Lamp_Switch.sendCommand(OFF)
Living_Room_Floor_Lamp_Switch.sendCommand(OFF)
Living_Room_Twig_Lights.sendCommand(OFF)
Front_Garden_Lights.sendCommand(OFF)
if(In_Bed_Status == "No") {
sendCommand(Master_Bedroom_Table_Lamp_Dimmer,30)
sendCommand(Master_Bedroom_Ceiling_Light_Dimmer,100)
}
} else if(Landing_SP3102_Motion.state == ON && Time_Of_Day.state == "MORNING" && Train_Status_Announced.state != "Yes" && Day_Of_The_Week.state != "Friday" && Day_Of_The_Week.state != "Saturday" && Day_Of_The_Week.state != "Sunday") {
Study_Floor_Lamp_Dimmer.sendCommand(100)
} else if(Landing_SP3102_Motion.state == ON && Time_Of_Day.state == "MORNING" && Morning_Announced.state == "Yes" && Outside_ST815_Lux_Level.state < 150) {
First_Floor_Landing_Light_Switch.sendCommand(ON)
}
end