Skip to content

Commit

Permalink
fix(scene): do not restore if already off (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugobloem authored Nov 3, 2024
1 parent fac5978 commit 4166e78
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions custom_components/stateful_scenes/StatefulScenes.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ def turn_on(self):

def turn_off(self):
"""Turn off all entities in the scene."""
if not self._is_on: # already off
return

if self.restore_on_deactivate:
self.restore()
else:
Expand All @@ -267,6 +270,7 @@ def turn_off(self):
service="turn_off",
target={"entity_id": list(self.entities.keys())},
)

self._is_on = False

@property
Expand Down

0 comments on commit 4166e78

Please sign in to comment.