Some tips towards more intelligent light control?

Hi,

I’m using home assistant with various ZigBee devices (including Philips Hue, IKEA Tradfri, Osram, etc.) via deCONZ on a Raspberry Pi. I’m pretty happy with my setup and everything works as expected.

However, I recently bought some motion detectors (with integrated temperature and light sensors) to automate some tasks (e.g., automatically turning on lights in the hallway, less bright at night, etc.). I registered the devices successfully with home assistant, but now I’m a bit lost.

For example, I have defined various lightning scenes for my living room and can switch between them via the HA web interface or via an IKEA Tradfri remote control. But if I now add motion sensors to the whole setup, the situation gets complicated quickly. The lights should turn on automatically when sensing motion unless someone has set a specific scene manually (e.g., “watching a movie”). At the same time automatic rules should be allowed to get overwritten by later manual changes, e.g., manually turning off lights that had been turned on automatically.

I suspect someone has solved this problem before, but I was unsuccessful in finding matching HA configurations. Does anyone have any pointers towards how to formulate “intelligent” rules for such a scenario in HA?

Thanks!