app changes, including initial tap dial
This commit is contained in:
20
apps/button_switch.py
Normal file
20
apps/button_switch.py
Normal 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()
|
||||
Reference in New Issue
Block a user