From 7bd46ffc42d1d15f81af82f3b182bd771e1ffcb9 Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Sat, 25 Nov 2023 21:12:24 -0600 Subject: [PATCH] deactivate cause --- button.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/button.py b/button.py index 68e0996..1b55afb 100644 --- a/button.py +++ b/button.py @@ -24,12 +24,9 @@ class Button(Mqtt): self.log(f'"{topic}" controls app {self.app.name}') async def handle_button(self, event_name, data, kwargs): - topic = data['topic'] - # self.log(f'Button event for: {topic}') try: payload = json.loads(data['payload']) action = payload['action'] - button = kwargs['button'] except json.JSONDecodeError: self.log(f'Error decoding JSON from {data["payload"]}', level='ERROR') except KeyError as e: @@ -44,7 +41,7 @@ class Button(Mqtt): cause = 'button single click' state = await self.get_state(entity_id=self.args['ref_entity']) if state == 'on': - self.app.deactivate(cause=cause) + self.app.deactivate(entity='', kwargs={'cause': cause}) else: await self.app.activate(cause=cause) else: