pre-merge (kinda fucked up before)
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user