Wait for second message before going on - how to?

Hi,

I have a problem with my Hue Motion sensor. It sends every 5 minutes (4:59 or 5mins) a message with full payload even if the room is complete empty. At first I tought its up to the sensivity but then I realize the time periode.

A solution could be to set the occupancy timeout to 0 and configure a node that forwards the messages only if there are 2 messages in a specific periode of time. Because if I am walking into that room the sensors sends me a lot of messages. This means if the device sends me more than 1 message then a real movement is detected and if only one messages arrives mqtt then it is just a simple status update but no movement.

Is there a node that I can use for this?

are those messages the same? Can't you use rbe node for this?

but I think this is the solution you are looking for:

[{"id":"d584ef01faea43b5","type":"delay","z":"25cf57df31420d79","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":2,"x":330,"y":160,"wires":[[],["46be27ddb7f82841"]]},{"id":"cd26c2f25a55dc9d","type":"inject","z":"25cf57df31420d79","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":160,"wires":[["d584ef01faea43b5"]]},{"id":"46be27ddb7f82841","type":"debug","z":"25cf57df31420d79","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":550,"y":160,"wires":[]}]

if more then one message incomes in next 3 sec, it goes threw, otherwise it blocks

Thank you very much. I never used the delay node for such a use case. Good to know.

yeah there are many hidden functionalieties behind the standard nodes

Why so complicated? The sensor gives the payload attribute occupancy with true (presence detected) or false (no presence). This is what you should look for. And you are right, the sensor sends messages in order to update the illuminance state. But you can simply neglect that.

1 Like

Hi,

In the meanwhile I had to turn the Motion Sensor off. It was a nightmare.

At brightness the sensor sends:

  • payload every 5 minutes
  • a lot of messages when motion is detected

At complete dark the sensor sends:

  • no intervall messages
  • only one message when motion is detected with an occupancy of 5-6 seconds (occupancy was set to 0/false).
  • 1 message per hour

Light was turned on altought the room was empty. Sensivity was set to "low".
Sometimes I got 3 messages (instead of 1) at the same time when motion was detected.

The fact that the sensor behaves completely differently during the day and at night made it difficult to develop a flow that intercepts this. But I managed to do it with a number of limiters. After the device then detected movement where there was none and we woke up several times at night because the light was on in the kitchen, I finally deactivated the sensor.

I didn't know who developed such crap. I didn't have these problems with the Hue Bridge, but as part of Node-Red you really can't use the motion sensor. This should not be a criticism of Node-Red, but solely of the sensor.

I'll look around for another sensor that will hopefully behave more predictably.

I am using two Philips Hue Motion sensors set to high sensitivity. And both are absolutely reliable. No idea what's going wrong in your case. As to the multiple messages (which basically are related to illuminance updates i assume) is something you can easylie deal with. If all you want is motion detection, than these are the most reliable ones based on Zigbee imo.
Regards from Berlin

Can you share a number of example messages (full message JSON) ? I have automated for a Xiaomi sensor and was able to make sense of the messages and come up with a simple and reliable flow.

Hi,

I will give the sensors another chance ... I will reply ...

Regards from Brandeburg :smiley:

LOL ... I have never realized that on a real movement detection the payload state occupancy is set to true and that at all mother messages the state is set to false ... OMG, such a disgrace ...

I got it completely wrong about the occupancy value.

Thank you so much. If we hadn't talked about it again, I would have send the sensor back, but it was my own stupidity. :see_no_evil: :hear_no_evil: :speak_no_evil:

2 Likes

OMG. You really mean that your settings were all based on the states payload/no payload. Now I understand... You always should work with the corresponding exposes (which btw are well described at the zigbee2mqtt page). Enjoy your working sensor now and keep further investigating in this addictive world of home automation...
Best greetings from Berlin