Hi, thanks in advance and sorry for bringing this topic up again. I have attempted my first automation - turning a light on resulting from a movement sensor. I can see the sensor movement executed value on the Frontend; can voice & manually turn the light on or off; see the automation as ‘on’ in the Development tools; and trigger the light on from the Automation menu on the Frontend. It simply won’t execute by itself.
The code was originally developed from a Automation Edit, that didn’t work. Much of the code seemed back to front to me eg ‘below: :‘35’’ before condition:. So I looked on the forums & rewrote the code as per other example scripts. The Configurator advises the code is valid. My automation includes a minor variation as it includes a minimum lux threshhold to turn on the light.
Code below: #- id: ‘1544880792635’
- alias: Kitchen Light
initial_state: True
trigger:
platform: state
entity_id: sensor.aeotec_zw100_multisensor_6_burglar_2
from: ‘0’
to: ‘8’
condition:
condition: numeric_state
entity_id: sensor.aeotec_zw100_multisensor_6_luminanc_2
below: ‘35’
action:
service: light.turn_on
entity_id: ‘light.kitchen’
Hassio 0.84.5 is running on Pi 3+ 64b with 32Gb SD.
The sensor is a Aeotec Multisensor 6 (M6) for the movement & lux detection. A Aeotec Z-Wave G5 stick runs the connection between the Pi & the M6s. The M6s defaulted to binary. light.kitchen is the entity_id of the relevant Yeelight white light.
Thanks again in advance for any help in getting this code to auto-execute.
The from: line shouldn’t be a problem as long as you’re sure the from state will always be 0 but if it’s always from: ‘0’ then it’s unnecessary anyway.
numeric_state is expecting a number. If you put quotes around the 35 you are turning it into a string.
are you sure the state is 8 when it sees motion? And is there no other real “motion” or “binary” sensors to use on that device? I don’t have a multi-sensor like that but I do have a different brand and it provides a binary_sensor that triggers on motion detection.
One other thing to try is to completely remove the condition just to see if that is where the trouble is. Just leave the trigger & action. it will definitely narrow it down at that point
There definitely is a binary sensor for the PIR sensor. It has been a while since i set mine up and I have recently removed it so I can’t check but I think I had to set one of the zwave device parameters from “ Basic Set (default)” to “Binary Sensor Report ”.
My understanding is the Aeotec Multisensor 6 (M6) defaults as a binary sensor on setup. The sensor shows up as ‘binary_ …’ However, the M6 has 3 values: ‘0’ - no movement detected; ‘3’ - vibration/sensor moved; or ‘8’ - movement detected. So it is possible for a M6 to be true/On when only sensor movement is detected. Eg banging door.
I previously remmed out the lux condition without affect.
No just the PIR. Or at least it did on mine. As I said though I changed one of the zwave device parameters from “ Basic Set (default)” to “Binary Sensor Report ”.
There is a binary_sensor in my states page. i think this is the default setup for M6s. I didn’t set it up.
The binary sensor is always on, even when the numetic_value: 0 (zero)/no movement.
I used the states page to turn it off but now it doesn’t detect movement. Is there another ‘off’ position?
On the Frontend, the sensor is reported as mostly on but sometimes off (I don’t know why). Under Z-Wave, it is mostly sleeping but sometimes initialising. In all cases it detects movement - at least as reported on the Frontend burglar/movement count
There’s another parameter to change for the length of time the binary sensor reports movement. I think the default was something stupid like 5 minutes. Possibly to reduce power consumption when on battery. If on USB power you can lower this to as low as one second (I used three seconds).
It’s a binary_sensor so the only states should be ‘off’ or ‘on’. Where you seeing the ‘numeric_value: 0’?
As tom just said, leave the device undisturbed for a long period of time (10 minutes?) and see what the state says. It should read ‘off’. Then trigger the detector and you should see the state change from ‘off’ to ‘on’.
If that works then use that sensor to trigger your automation. Then adjust the time as necessary. I have my other-branded motion sensor set to 3 minutes and it works reasonably well for my uses.
There’s an ‘alarm type’ sensor as well as the binary sensor. This is what @WayneNelson is trying to trigger off in the original post. It indicates if the alarm was PIR, vibration, and others - maybe even temperature alarm trip points (if the temperature alarm parameter is set). I never tried this.
I’m currently running off batteries until I get it to work - so I can position it to detect were I’m sitting. I first put another M6 high up a wall in anticipation of it operating. Turned out it only had about 3 metres range rather than about 5.
either way he should probably, for now, try to just get the automation working. I think the easiest way to do that is to just use the binary sensor as the trigger, for now…
It is an alarm type sensor. It definitely reports: (0) no alarm, (3) vibration alarm, or (8) PIR alarm. As for the temp/humidity alarms on the same sensor - as I a said - I did not test that, I’m probably wrong about that.
Agreed. The currently used sensor it is the wrong sensor to use. He should be using the PIR binary sensor. That as noted has a very long activation time (4 minutes) to save battery life. Set PARAMETER 3 to change this time (10 to 3600 sec, default 240)
To see this PIR binary sensor he may also have to change PARAMETER 5, from Send Basic Set CC (default) to Send Sensor Binary Report CC.
@WayneNelson do you know how to change the zwave parameters for a device?