I would like to know how to import my own class, and how to store them, and how to use them.
something like this:
.\mymodule\myclass.py
def myclass():
def __init__(self,prop):
self.prop=prop
def someMethod(self, someArg):
# do crazy things
And in the Appdaemon module:
import hassapi as hass
import datetime
from mymodule.myclass import myclass
class MyApp(hass.Hass):
def initialize(self):
self.myobj = myclass(prop='data')
self.listen_state(self.cb, "sencor.name", new = "on")
def cb(self, entity, attribute, old, new, kwargs):
ret = self.myobj.someMethod(someArgs=new)
....
Of course, I tried, but that doesn’t work. The import fails, I managed to get it to work sometimes, but it isn’t ‘refreshed’ when I modify it.
I also tried to include the module as an app in the yaml file, but it brings some new problems.
I think that I am missing some core concept of AD, can someone explain me please ?