jseidl / hass-magic_areas

Areas with batteries included for Home Assistant
MIT License
254 stars 28 forks source link

Bug: Turning on a light and then entering an area causes the light to turn off #258

Closed sjthespian closed 7 months ago

sjthespian commented 1 year ago

Describe the bug As we discussed in slack, there seems to be a bug with how Magic Areas handles motion detection if a light is turned on while an area is empty then a sensor is activated.

In my case, if I turn on my garage light and then walk into the garage, the lights will go off. It looks like this happens when the system gets the motion trigger that someone has entered the room. I do not have it set to activate the lights on motion, I only use Magic Areas to turn the lights off after 10 min if there is no one in the room.

To Reproduce Steps to reproduce the behavior:

  1. Set up an area with a motion trigger, nothing set for "States which overhead lights are turned on" and "occupancy, state" set for "When should overhead lights be controlled".
  2. Make sure the presence sensor for the room is off
  3. Turn on the overhead lights
  4. Trigger the motion sensor and the lights should go off

Expected behavior The lights should stay on when motion is triggered, and go off after the "clear_timeout" and/or "extended_timeout" have expired.

Desktop (please complete the following information):

Smartphone (please complete the following information):

jseidl commented 1 year ago

I need to implement a check to see if that light was controlled by anything other than ourselves, then not act if that's true.

This same problem occurs if you leave the room, turn the lights OFF but then extended state kicks in and it's configured for that light as well, it will turn it back on