I am trying to write a rule that uses Z-Wave motion sensors to trigger Philips Hue lights. Below is an example of the rules I have created.
rule "Landing Motion On"
when
Item motion_ff_lndng changed
then
light_ff_lndng_brightness.sendCommand(100)
end
rule "Landing Motion Off"
when
Item motion_ff_lndng changed
then
light_ff_lndng_brightness.sendCommand(0)
end
The problem I am having, is that I cannot get the motion sensor to trigger the lights. I have tried a variety of ‘when’ statements including:
Item motion_ff_lndng changed from Off to On Item motion_ff_lndng changed Item motion_ff_lndng changed to On Item motion_ff_lndng changed Motion Item motion_ff_lndng changed Active
I’m just not sure what state is being received from the Z-Wave item, I cannot see anything in the logs which is made me wonder if any state was being received at all however when I set up a HABPanel test button which was set to change colour when the sensor was ACTIVE it worked. So I can see that a state is being received but I’m not sure exactly what needs to go in the rule.
The motion sensor is a ‘Neo’ brand and is being correctly identified within OpenHab.
If the mistake is glaringly obvious then go gentle on me, I am brand new to OpenHab having begun my migration from Domoticz in the last few days and was getting on quite well up until trying to recreate some of my Domoticz events as OpenHAB Rules - I’m starting with the simpler rules.
It depends how you defined the item (the type of the channel you linked it to).
Usually motion sensors are OnOffType so it sends ON and OFF. That’s at least for Fibaro FGMS which I think the Neo is a clone of.
Check events.log, if the sensor is correctly configure you would see an entry there.
Thanks for your reply, the item has appeared in the log for the first time:
2019-09-11 21:09:46.693 [ome.event.ItemUpdatedEvent] - Item 'motion_ff_lndng' has been updated.
I would expect it to have triggered several times since I added it. I can confirm that its type is set as Switch so I will have another go now it has popped into the log.
Both rules have the same trigger and send different commands to your light so no matter what happens your light will probrably have a quick flicker and that’s it.
CAn you post the logs of you walking in front of that motion sensor so that we can see what rule triggers your need. Thanks
Thanks for your reply, the last couple of walk-bys only generated an update from for the Thing but not the Item.
2019-09-11 21:13:23.285 [me.event.ThingUpdatedEvent] - Thing 'zwave:device:4e9fa1a6:node19' has been updated.
2019-09-11 21:16:05.386 [vent.ItemStateChangedEvent] - lux_ff_lndng changed from 6 to 1
(lux_ff_lndng being the integrated Lux sensor). I think I will check to ensure I haven’t inadvertantly unlinked the Item or set the sensor not to send motion notifications to the controller.
It appears that the ZWave Node settings had cause the PIR message not to be sent as after tweaking the settings I am getting something in the Logs. I had presumed the individual settings wouldn’t have changed as they are stored on the controller. I will be sure to check my other nodes to ensure they are correctly grouped and set.
I am now getting a consistent log entry when the device changes as I expect: 2019-09-11 21:32:30.767 [vent.ItemStateChangedEvent] - motion_ff_lndng changed from OFF to ON 2019-09-11 21:33:01.436 [vent.ItemStateChangedEvent] - motion_ff_lndng changed from ON to OFF
Switching off correctly, 30 seconds after no motion is detected.
My rule now works as expected, I noticed that ON and OFF must be capitalised for the commands to work.
rule "Landing Motion On"
when
Item motion_ff_lndng changed from OFF to ON
then
light_ff_lndng_brightness.sendCommand(ON)
end
rule "Landing Motion Off"
when
Item motion_ff_lndng changed from ON to OFF
then
light_ff_lndng_brightness.sendCommand(OFF)
end
Thanks everyone for your help, I hope this post can be of use to others when they are setting up their system.
Next I need to figure out what I need to adjust with my Hallway sensor to get it to behave the same, integrate the lux sensors in to the rules and vary the brightness for day and night but as long as the basic functionality works, I’m happy for the time being.
I’ve already ordered my first touchscreen to use as a wall mounted controller. Very glad I made the switch to OpenHAB - great software and a helpful and responsive community.
On one of my sensors, it hangs during the default nightly zwave network heal and I lose the battery stunts, I think I have lost motion detection sometimes on that one too.
I have generally disabled the nightly heal unless I have moved devices significantly within the network.
I’m not sure what settings you refer to, but in general there aren’t any settings stored on the controller. The controller remembers basic information about the device (such as if it is a routing device). Device configuration is normally stored on the device.