app changes, including initial tap dial

This commit is contained in:
Jim Lancaster
2024-12-26 18:58:33 -06:00
parent e67df2809d
commit 6038d0d405
5 changed files with 85 additions and 152 deletions

20
apps/button_switch.py Normal file
View File

@@ -0,0 +1,20 @@
from appdaemon.entity import Entity
from appdaemon.plugins.hass.hassapi import Hass
class AqaraSwitch(Hass):
def initialize(self):
self.log(f'Initializing Aqara Switch for {self.switch.friendly_name}')
self.button.listen_state(self.handle_button_press, new=self.args.get('action', 'single'))
@property
def switch(self) -> Entity:
return self.get_entity(self.args['switch'])
@property
def button(self) -> Entity:
return self.get_entity(self.args['button'])
def handle_button_press(self, entity: str, attribute: str, old: str, new: str, **kwargs):
# self.log(f'{new}')
self.switch.toggle()