diff --git a/apps/apps.yaml b/apps/apps.yaml index a0a58d7..57c45a9 100644 --- a/apps/apps.yaml +++ b/apps/apps.yaml @@ -13,9 +13,9 @@ scene_detect: module: scene_detect class: MotionCanceller scene: bedsport - app: bedroom + app: bedroom_motion -scene_detect: +scene_detect2: module: scene_detect class: MotionCanceller scene: in_bed diff --git a/apps/scene_detect.py b/apps/scene_detect.py index 2311e44..6621deb 100644 --- a/apps/scene_detect.py +++ b/apps/scene_detect.py @@ -1,5 +1,5 @@ from appdaemon.plugins.hass.hassapi import Hass - +import asyncio class SceneDetector(Hass): def initialize(self): @@ -21,5 +21,6 @@ class SceneDetector(Hass): class MotionCanceller(SceneDetector): async def scene_detected(self): await super().scene_detected() + await asyncio.sleep(0.5) # needed for when the scene gets turned on from everything being off because of competing callbacks app = await self.get_app(self.args['app']) - await app.cancel_motion_callback(new='off') \ No newline at end of file + await app.cancel_motion_callback(new='off')