Closed sriramsv closed 5 years ago
mabe you should read the docs a bit more.
import appdaemon.plugins.hass.hassapi as hass
class Test(hass.Hass):
def initialize(self):
self.sensor = self.args.get("sensor")
self.listen_state(self.slide, self.sensor,new="slide")
self.listen_state(self.flip,self.sensor,new="flip")
def slide(self,kwargs):
self.log("slided")
def flip(self,kwargs):
self.log("flip")
does exactly what you want ;)
Wow!, I have gone through the doc so many times, didn't catch my eye. :+1: Thanks a lot @ReneTode
@sriramsv check out all different options on listen_state: https://appdaemon.readthedocs.io/en/latest/AD_API_REFERENCE.html#listen-state attribute, new, old, duration, immediate and oneshot.
you can do a lot with them.
@acockburn @ReneTode Currently, the listen_state is defined as
Want the method to take in a value parameter, where a callback can be directly called when the value is the specified value. Something like
This will make code more loosely coupled than existing ways as currently the old way to that is
It will be much simpler if we could have something like