Hi, im getting some strange issues while connecting a Hue Motion Sensor to ZHA.
I had an automation where lights should go on when motion is detected. After 20 seconds the light should turn brightness to 25% and after 40 seconds the light should turn off.
Within the time any motion would trigger the light to go up to 100% again.
It worked perfect when the motion sensor was connected to the hue bridge but now the lights wont turn off after dimming to 25%. My problem with hue bridge was the delay to turn on the lights.
Now the lights are turned on instantly but the only things that work are lights on and turning brightness to 25% after this the lights wont go to 100% again and the lights don’t turn off.
It stays at 25% brightness all the time.
You said this automation worked perfectly when used with the Hue Bridge but now misbehaves with ZHA. Was anything changed in the automation? For example, has it always used mode: restart?
If nothing has changed in the automation, then the behavior of the binary_sensor might now be different. Have you checked the automation’s trace to understand what happens each time it is triggered?
I changed the entities or the entity names in the automation because the sensor has a different name from ZHA.
It was restart before and worked like a charm.
But now it doesn’t trigger anything else than 25%.
I created a new version of your automation that reports what it does via a persistent notification. I tested it using a WiFi-based motion sensor that has a 10-second cooldown period. That means it will report off (“no motion”) after it detects no motion for 10 consecutive seconds. You should check what is the cooldown period for the Hue Motion Sensor when used with ZHA.
Thanks for your effort.
I want to try this but now i’m struggeling with the motion sensor itself.
It always shows up as on so it always detects motion even after a restart.
When i set the state to off it automatically comes back as on and stays like this forever.
I’m not sure if this is a problem for my automation (it wasn’t like this when i opened this thread) or if it has to do with the single automation.
It split the automation into 3 single automations to set it to 100% (first automation), to 25% (second automation) and turn it off (3rd automation). They also work with timers when the state of the motion sensor is 20 or 40 seconds off.
So i’m trying to find out why the state is always in and then the automation comes back to my focus.
If you have any tip to get the sensor running i will appreciate it.
I agree that it doesn’t appear to be working correctly. No automation will work as expected if the motion sensor behaves like that.
The motion sensor’s behavior you described is abnormal and independent of any automation you are using. You will need to sort out its operation because its unusual behavior appears to have been introduced by the change to the ZHA integration.
Your code works perfect.
Just for understandig: it all depends on the trigger id to work?
Did my code not work because it had stopped after the first 20 seconds?
I don’t think your code was wrong. I think the problems you were experiencing had to do with the motion sensor’s odd behavior.
The automation I posted is essentially the same as the one you created however, each conditions is simplified because it relies on trigger.id which tells it which trigger was responsible for triggering the automation (it doesn’t have to re-check everything to determine which one triggered). It’s a bit more efficient to use trigger.id in this particular case.
Here’s the same automation without the notifications (even more compact):
If you found the automation I posted was useful to resolve the issue, please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. It will also place a link below your first post that leads to the solution. All of this helps users find answers to similar questions. For more information, refer to guideline 21 in the FAQ.
Normally any topic categorized under Configuration will get the ability to be marked with the Solution tag. However, I noticed that none of the topics categorized under ZHA are marked with the Solution tag.
This problem wasn’t directly related to ZHA so you can edit your first post and remove the ZHA category, leaving it with just the Configuration category.
Refresh your browser page and see if that helps to reveal the Solution checkbox. If it doesn’t then there’s not much else we can do to influence the forum’s software.