Skip to content

Commit

Permalink
Removed experimental code due to errors and fixed bug in warning flash
Browse files Browse the repository at this point in the history
mkotler committed Dec 31, 2024
1 parent fe8c496 commit 13dc184
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions apps/automoli/automoli.py
Original file line number Diff line number Diff line change
@@ -1649,14 +1649,18 @@ def lights_off(self, kwargs: dict[str, Any]) -> None:
# app: https://github.com/wernerhp/appdaemon_aqara_motion_sensors
# mod:
# https://community.smartthings.com/t/making-xiaomi-motion-sensor-a-super-motion-sensor/139806
for sensor in self.sensors[EntityType.MOTION.idx]:
self.set_state(
sensor,
state="off",
attributes=(self.get_state(sensor, attribute="all")).get(
"attributes", {}
),
)
#
# This code may work for these "super motion" sensors but may cause errors for other sensors.
# If setup only uses these sensors then uncomment the following code.
#
# for sensor in self.sensors[EntityType.MOTION.idx]:
# self.set_state(
# sensor,
# state="off",
# attributes=(self.get_state(sensor, attribute="all")).get(
# "attributes", {}
# ),
# )

if at_least_one_error:
self.lg(
@@ -1779,10 +1783,10 @@ def warning_flash_off(self, _: dict[str, Any] | None = None) -> None:
"homeassistant/turn_off", entity_id=entity # type:ignore
) # type:ignore
at_least_one_turned_off = True
if not entity in self._switched_off_by_automoli:
self._switched_off_by_automoli.add(entity)
if entity in self._switched_on_by_automoli:
self._switched_on_by_automoli.remove(entity)
if entity not in self._switched_off_by_automoli:
self._switched_off_by_automoli.add(entity)

# turn lights on again in 1s
if at_least_one_turned_off:
@@ -1794,10 +1798,10 @@ def warning_flash_on(self, _: dict[str, Any] | None = None) -> None:
self.call_service(
"homeassistant/turn_on", entity_id=entity # type:ignore
) # type:ignore
if not entity in self._switched_on_by_automoli:
self._switched_on_by_automoli.add(entity)
if entity in self._switched_off_by_automoli:
self._switched_off_by_automoli.remove(entity)
if entity not in self._switched_on_by_automoli:
self._switched_on_by_automoli.add(entity)
self._warning_lights.clear()

def find_sensors(

0 comments on commit 13dc184

Please sign in to comment.