Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support to turn off lights that were manually turned on and minor bug fixes #92

Closed
wants to merge 5 commits into from

Conversation

mkotler
Copy link

@mkotler mkotler commented Feb 5, 2022

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 Suggest different default behaviour for daytimes #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 and others added 3 commits February 5, 2022 15:43
…ally with a different delay (#2)

* feat: Added support to turn off lights that were manually turned on, optionally with a different delay

* style: Resolved linting errors

* fix: Log correct delay (delay_outside_events) when lights have been turned off after manually turned on

* fix: Simplified logic for handling light state changes outside automoli, fixing a bug when multiple lights are in a room

* fix: Fix string comparison for motion_detected event to motion_state_changed_detection

* fix: Corrected comment for outside_change_detected function based on previous code change

* fix: Removed extra space from outside_change_detected comment

Co-authored-by: Matthew Kotler <[email protected]>
Bug fixes for multiple lights, one daytime, and log/readme cleanup
@mkotler mkotler changed the title Added support to turn off lights that were manually turned on Added support to turn off lights that were manually turned on and minor bug fixes Feb 6, 2022
@evildad
Copy link
Collaborator

evildad commented Apr 25, 2023

@mkotler Tried the PR with only_own_events but automoli still turned the lights, turned on outside of automoli, off.

@TonnyMunkNielsen
Copy link

TonnyMunkNielsen commented Feb 9, 2024

@

@mkotler Tried the PR with only_own_events but automoli still turned the lights, turned on outside of automoli, off.

Same, unfortunately.

It seems to somewhat work whenever the outside event happens before motion is detected, but it fails in my scenario where I:

  1. Trigger the motion sensor to go to the laundry room.
  2. Turn off and on the light to get to "manual mode".
  3. Trigger the motion sensor again on the way out of the laundry room.
  4. Wait for the timer to expire.

@mkotler
Copy link
Author

mkotler commented Feb 10, 2024

@evildad and @TonnyMunkNielsen, my apologies that the PR is not working. That PR is very old. However, if you want to look at my fork of Automoli, feel free to try it out. A lot of the code has been rewritten and there are a lot of additional features. Huge thanks to benleb for the starting point and inspiration. If my fork still doesn't work in your situation (or you find other issues) please let me know!

@mkotler mkotler closed this Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants