Making the Hue Motion sensor more responsive in Home Assistant

Tags: #<Tag:0x00007fc410fd85c8> #<Tag:0x00007fc410fd8500>

I am also facing two problems with hue motion sensors directly communicating with HA via custom component integration:

  1. Response time of motion sensor is high, as you rightly mentioned and provided alternate options
  2. 3 different sensors behaving differently, if you keep moving in front of them for prolong duration (30sec-2min).

One of them changes state “Detected” to “Clear” but stops sensing subsequent motions while the other two detects but their time to respond to subsequent motions are better comparatively.

All these triggers a pair of rules to turn on light when motion “Detected” and another rule to turn off when motion status stays “Clear” for a specific duration. Sensors’ inability to re-detect prolong motions causes incorrect HA trigger to fire and it turns off light even if you are in front of it.

Their motion sensitivity settings are “High” for all 3 of them, as seen via hue app. Battery levels are 100%, I don’t know what is their slew rate for motion sensitivity or anything else can be done for frequent detection of motion.

If you go into the Hue app on one device and Home Assistant on another, you should be able to see if they are showing the same behaviour going from Detected to Clear. Now with this trick, my hue app is basically in sync with what is happening on Home Assistant and goes from detected to clear and back at the same time. If I continue to wave my hand in front of the sensor it stays on Detected and doesn’t go back to Clear until I stop moving.

If you have multiple sensors showing different behaviour there may be something wrong with the sensor. I have also read that the reason that the built in Hue component is so slow is because the update interval is high to stop overloading the bridge. The custom component is constantly trying to update the bridge and may be overloading it if you have many sensors and lights (especially if it’s a V1 bridge).

I just recently wrote an article about how to get around this by using Node-RED with Home Assistant:

I hope it helps people out.

1 Like

Wow!! This works really well!! You’re a lifesaver @priva28!! Thank you :smiley:

I believe the REST API still works as well, so you could keep the Temperature and Light sensor on the Home Assistant 5 second poll and use the REST API to poll for motion, which will give you much faster response as you can specify your own refresh time.

That is pretty much what I am doing with Node-RED. I have Home Assistant still get temp and brightness but have motion events go through Node-RED so I can set the refresh rate manually. I have my motion sensors check every second which works much better than every 5.

could you explain what you mean with rest api
… this one right?? rest api

how can I poll a hue motion sensor in my own frequency by using this api :slight_smile:
would be very kind if you could give me some hints

Does HA still only poll Hue motion sensors every 5 seconds with the latest version (0.103.4)? Or is that now using REST API?

@Skylord123 stupid question, but for the setup you have written, do you still use the Hue Bridge? I have read over the article it seems like you still use it but I just wanted to confirm.
Currently my setup is the Hue motion sensors directly connected to HA via Deconz/Conbee 2.

Also, any suggestions about setting up MQTT server? I don’t have one/haven’t set one up before.
Thanks in advance

Hi Guys
I have never had an issue.
But I don’t use the HA hue I mean it’s there but I don’t use those entities to reference any automations
I use the Robmarkcole hue sensor custom component
As I have 4 button remotes as well.
I have currently 5 motion sensors active around the house and response time is less than a sec.
There is a huge diffence between the HA response and the custom component That I’m using.
I also use Node Red for all my automations.
I don’t use the huemagic I just use the normal poll state node with the output on change only.
My thoughts are HA is doing alot of things all the time.
I have always found the automations in HA to be slow to activate they fail to trigger or trigger to late.
Maybe I just can’t get the yaml code right.
I’m more a logical thinker.
Every automation I have in node red works as fast as I’d expect it to.
My advise is always
Use Node Red
Node Red is only doing what I’ve told it to do and nothing more. HA God bless it, is doing alot more.

1 Like

@Harry13 is the robmarkcole custom component link to the hue bridge and the hue sensors still connected to the hue bridge?
I have 13 hue motion sensors in total. Plus some Ikea Tradfri plugs for signal repeaters and 4 hue light strips all directly connected to a conbee however sometimes the sensors are a bit slow to respond (can take up to 6 seconds but 90% of the time it’s under 1 second). All automations are handled in node red.
The reason I ditched hue bridge was 50% of the time the light strips were coming on at 1% brightness even though the NR automation had a 100% brightness in the flow for on

Yes they are
I was just suggest in another topic to use conbee as it pushes

1 Like

Same as some others, I switched to using the ConBee II to fix exactly this problem.

I started out with trying things like increasing polling frequency on the HUE brdige. That did work to some extend, but quite often I ran into connection refused messages between my Home Assistant and the HUE bridge. Turns out that this was because the bridge has a really stringent policy for determining DoS attacks. Moving towards sub-second respons times for the motion sensors deemed impossible.

The more devices are connected, the more the DoS attack protection will kick in. This is because the bridge does not have a push option, but requires polling via the REST interface to gather device data. And to make things worse: only one device can be polled at a time, so if you have many devices, many polling requests will be made, triggering the DoS attack protection even quicker. That is why the polling frequency is as low as it is by default in the integration.

Next to the delayed motion sensor triggering, I ran into other related problems with the HUE bridge. My biggest annoyance was that automations that targeted about 10 devices (e.g. setting a scene based on Home Assistant scening support) would often only partly work. More often than not about 2 devices would stay in their old state. Looking at the network traffic, that was also caused by the DoS protection of the HUE bridge. It didn’t like me sending this “astounding” amount of REST requests within a second.

Because of all this, my eventual conclusion was that the HUE bridge was not a good fit for integration. Therefore I bought myself a ConBee II and using it was a breeze right from the start. It even switched my wife’s mindset from “this is stupid, I am quicker pressing the light switch myself” to "lovely, can you do this for the rest of the house? :wink:

I have the HUE bridge still lying around, but only for being able to do firmware upgrades.

2 Likes

Well I truely havent experienced any of those issue since i use the Huesensor custom component
pretty much since day dot. as i got the bridge with the 4 button remotes and the only way to get them into HA was with Robmarkcole’s custom component
i did notice the difference between response times on the Hue Entities and the Huesensor entities.
i only have 3 light as lamps but plenty of sensors and remotes.
but I have ordered the Conbee II from Amazon so i will be changing soon. :wink:

1 Like

I have multiple USB sticks in my HA raspberry Pi (smart meter, Z-wave, Zigbee). I documented how I configured the system to use predictable device names. Maybe this doc is useful for you too.

1 Like

sound like your sticking everything into you pi
poor thing
i’ll take a look
thanks
Happy new year

Yeah I am still using the Hue bridge. I have considered switching to something else like you are using but just haven’t seen the point as I don’t have other devices that use the same protocol.

I setup all of my apps on my server in docker (I run Unraid and it makes it really easy). Right now I am using this container to run Mosquitto for MQTT: https://github.com/cmccambridge/mosquitto-unraid

I use the ConBee now for 2 years and not even once was there an issue with the motion sensor not responding fast enough.

1 Like

How many Hue devices do you have? I noticed delays or missed events only when my ZigBee network grew bigger and more requests were sent to the Hue Bridge.

I’m sitting at 29 devices right now.