27 lines
789 B
Python
27 lines
789 B
Python
import base
|
|
|
|
class HelloWorld(base.Entities, base.Timers):
|
|
|
|
def initialize(self):
|
|
super().initialize()
|
|
|
|
self.log("Hello from AppDaemon")
|
|
self.log("You are now ready to run Apps!")
|
|
|
|
self.run_in('test1', self.after_time, 3)
|
|
self.run_in('test2', self.after_time2, 5)
|
|
# self.run_in(self.after_time2, 7)
|
|
# self.cancel_timer('test2')
|
|
|
|
self.register_entity('taklampa', 'light.kontoret')
|
|
|
|
def after_time(self, kwargs):
|
|
self.log("Running function")
|
|
self.e['taklampa'].icon = "mdi:lamp"
|
|
self.log(f"State is {self.e['taklampa'].state}")
|
|
def after_time2(self, kwargs):
|
|
self.log("Running function2")
|
|
del self.e['taklampa'].icon
|
|
|
|
self.log(f"State is {self.e['taklampa'].state}")
|