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

Update automoli.py #91

Merged
merged 1 commit into from
Jan 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions apps/automoli/automoli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""AutoMoLi.
Automatic Motion Lights

@benleb / https://github.com/benleb/ad-automoli
"""

Expand Down Expand Up @@ -429,14 +428,14 @@ async def initialize(self) -> None:
listener.add(
self.listen_state(
self.motion_detected,
entity=sensor,
entity_id=sensor,
new=self.states["motion_on"],
)
)
listener.add(
self.listen_state(
self.motion_cleared,
entity=sensor,
entity_id=sensor,
new=self.states["motion_off"],
)
)
Expand Down Expand Up @@ -518,7 +517,6 @@ async def motion_cleared(
) -> None:
"""wrapper for motion sensors that do not push a certain event but.
instead the default HA `state_changed` event is used for presence detection

schedules the callback to switch the lights off after a `state_changed` callback
of a motion sensors changing to "cleared" is received
"""
Expand Down Expand Up @@ -546,7 +544,6 @@ async def motion_detected(
) -> None:
"""wrapper for motion sensors that do not push a certain event but.
instead the default HA `state_changed` event is used for presence detection

maps the `state_changed` callback of a motion sensors changing to "detected"
to the `event` callback`
"""
Expand Down Expand Up @@ -799,7 +796,7 @@ async def dim_lights(self, _: Any) -> None:
entity_id=light, # type:ignore
**dim_attributes, # type:ignore
)
await self.set_state(entity=light, state="off")
await self.set_state(entity_id=light, state="off")

# workaround to switch off lights that do not support dimming
if self.room.room_lights:
Expand Down