Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
495 B
1
Indexable
Never
import appdaemon.plugins.hass.hassapi as hass

#
# Testing Automation trigger with appdaemon vs native
#

class test_auto(hass.Hass):

    def initialize(self):
        self.listen_state(self.synch_lights, "light.light", new="on")
        self.log("trigger complete, test automation.")

    def synch_lights (self, entity, attribute, old, new, kwargs):
        was_on = self.get_state("switch.garage_light")
        if was_on == "off" then self.turn_on("light.switch.garage_light")