pre-merge (kinda fucked up before)

This commit is contained in:
John Lancaster
2024-01-28 09:04:54 -06:00
parent dee31fe6f1
commit af8d13bfce
15 changed files with 162 additions and 102 deletions

View File

@@ -1,5 +1,6 @@
from appdaemon.plugins.hass.hassapi import Hass
class SceneDetector(Hass):
def initialize(self):
self.scene_entity = self.args['scene'] if self.args['scene'].startswith('scene.') else f'scene.{self.args["scene"]}'
@@ -21,4 +22,12 @@ class MotionCanceller(SceneDetector):
def scene_detected(self):
super().scene_detected()
app = self.get_app(self.args['app'])
app.cancel_motion_callback(new='off')
try:
self.run_in(
callback=lambda *args, **kwargs: app.cancel_motion_callback(),
delay=0.5
)
except:
self.log(f'Error cancelling motion callback for {self.args["app"]}', level='ERROR')
else:
self.log('Cancelled motion callback')