Hue-motion-sensor with ZHA

Hello,

In advance I apologize if this questions or question been asked before somewhere (even tho I can’t find it).

I have a Philips hue motion sensor and some Philips hue lights in my setup.

I have two automations, one for turning on and off. It works the lights is turned on when the sensors is occupied (I tried to make it work with motion detected, but figured out that is not for for triggering?) and another automation for turning the lights off when sensor is not_occupied for 4 min, then the lights is turned off. This works, but I am sure it can be done better.

What I am missing is that when the sensor is triggered, and the 4 min have not passed yet and a new motion is detected the timer is restarted.

And another thing I am also looking for is to have three different dimming done before the light is turned off. Example: so after 4 min the lights will be turned off fully, but steps before that will
Be that after 60 seconds the brightness goes 60%, after 2 min to 20% and after 4 min the lights goes off.

Again thank you in advance.

Not sure about your “occupied” and not “motion detected”. I do not have teh Philips motion detector. However, think it is the same as on the aqara.

The “not_occoupied” is a sensor, right? If yes, then the 4 minutes are “restarted”, as the sensor will turn to “occupied” and then at some point back to “not occupied”.

For doing the 60% etc, just make some more automation, triggering on “not_occupied” for 1min, a autmation for 2min etc. If motion happens during this timeframe, you first automation triggering on “occupied” will turn the light to 100% again (or you need to set it to 100%).

Hello!

Thank you for answering! I made it work!

But now I am struggling with another problem :sweat_smile:

I have a lot of automations in one yaml file, I tried to separate them, but I just get errors. I find the doc quite confusing :sweat_smile: I must be a noob :cry:

Happy to know.
Regarding automations. I use the GUI to create them and have the overview. Stuff not supported by the GUI, I still create the automation in the GUI and and go to YAML mode. This way I do not have to bother handling the automation.yaml file. Have never beeing opening the actual file.
Just how I do.