Can't get Hue Motion rules to work

Hi, newbie here :slight_smile:

Nothing happens here, what I’m doing wrong?

Things:
Bridge hue:bridge:bryggers [ ipAddress=“xxxxxx”, userName=“xxxxxxxxxxxx” ] {
0100 Indgang_loft “Indgang Loft” [ lightId=“7” ]
0107 Indgang_motion_sensor “Indgang Motion” [ sensorId=“8” ]
}

Items:
Switch Indgang_loft_Toggle { channel=“hue:0100:bryggers:Indgang_loft:brightness” }
Switch Indgang_motion_sensor_Presence {channel=“hue:0107:bryggers:Indgang_motion_sensor:presence” }

Rule:
rule “Indgang Motion Sensor ON”
when
Item Indgang_motion_sensor_Presence changed from OFF to ON
then
Indgang_loft_Toggle.sendCommand(ON)
end

rule “Indgang Motion Sensor OFF”
when
Item Indgang_motion_sensor_Presence changed from ON to OFF
then
Indgang_loft_Toggle.sendCommand(ON)
end

Log is showning that the motion sensor is working:
Indgang_motion_sensor_LastUpdate changed from 2019-08-20T14:51:38.000+0200 to 2019-08-20T14:52:08.000+0200

Your sending ON in both rules? These could be collapsed to just one…

rule “Indgang Motion Sensor”
when
Item Indgang_motion_sensor_Presence changed
then
Indgang_loft_Toggle.sendCommand(triggeringItem.state.toString)
logInfo("Motion", "{}: {}", triggeringItem.label, triggeringItem.state)
end

And read up on code fences. Some logging will help to troubleshoot too.

1 Like

Um well, your rules trigger from a different Item changing. You should look for Indgang_motion_sensor_Presence in your events.log

Thanks booth, complete newbie as i said …

I will take a look at it