ad-automoli
ad-automoli copied to clipboard
Added support to turn off lights that were manually turned on and minor bug fixes
Fixes #24: If only_own_events is False, then added state change listeners for all lights. Then, when a state change occurs outside automoli, manually setup the timers. Also added an additional, optional config property, delay_outside_events, that if present will override the standard delay in the cases when the light has been turned on manually.
delay_outside_events is useful, for example, when you want lights to go off quickly when turned on automatically, but have a longer delay if a light switch is used. I have a 3 minute delay in a hallway (assuming someone is just passing through) but have set delay_outside_events to 15 minutes if the light switch is used (and someone might need to linger in the hallway).
In an attempt to minimize backward compatibility issues, the code assumes that if only_own_events is not present in the config, it is None and not False.
Additionally, applied bug fixes for handling multiple lights, one daytime, and minor log/readme cleanup:
- Ensure that if a room has multiple lights, all lights will be turned on based on motion events
- [Workaround for issue #86] Allow a single daytime such as: {starttime: "00:00", name: "allday", light: 100}
- Clarified in documentation that motion events are only sent if you have the Xioami Gateway integration (not just if you have Xioami / Aqara motion sensors)
- Added and made minor updates to a few log statements to help with debugging
@mkotler Tried the PR with only_own_events but automoli still turned the lights, turned on outside of automoli, off.