Problem with a Basic rule

Hi, the below rule is by some reason nut running. if i take the IF part out and keep only the sendCommand in its working. the status of the door contact is however OPEN.

rule "Living/Dining Room lights on when coming home"
    when 
        Item S_HW_MOTIONSENSOR_Movement changed from OFF to ON
    then
        if (S_HW_Maindoor_S == OPEN) {
        S_LR_LIGHT_Ceiling_S.sendCommand(ON)
        S_DR_LIGHT_DiningTable1_S.sendCommand(ON)
        }
end

not working

rule "Living/Dining Room lights on when coming home"
    when 
        Item S_HW_MOTIONSENSOR_Movement changed from OFF to ON
    then
        S_LR_LIGHT_Ceiling_S.sendCommand(ON)
        S_DR_LIGHT_DiningTable1_S.sendCommand(ON)
end

working. however the lights should only turn ON when the door is OPEN

Contact S_HW_Maindoor_S  "Main Door" <contact>  {enocean="{id=05:04:09:D5, eep=D5:00:01, parameter=CONTACT_STATE}"}

Should be be simple to solve. You use S_HW_Maindoor_S in you if statemenet. This is the the whole item, but in your mind you like to access the state of the item. So simply try S_HW_Maindoor_S.state and see if this will work.

Thomas

:roll_eyes: total overlooked that somehow for the last 30 minutes.

thanks a lot

1 Like

I recommend to use the designer - as it helps you to spot many issues automatically; did you give it a try already?

with kind regards,
Patrik

i actually used the designer in the past but since some time it gives me more and more issues that the config files are not working and i have to re-open and save them under linux.
but yes it still helps to spot errors.