I have an api class in my custom components and data is stored in a python var.
So in init I have something like this:
def setup(hass, config):
myapi = ostrom_api.Ostrom_api()
but how do I pass the class to
hass.services.register(DOMAIN, “get_price”, handle_price_forecast)
because in
def handle_price_forecast(call):
Unfortunately myapi is invalid there.
so i need transport the myapi reference via call var - but how ?
i rewrite the api with return text and use hass.data[DOMAIN] = {“apikey”: key}
i need only 5 values for the api
apikey = a base64 string
and token, expire, zip, contract_id : all strings
addon:
sensor or states > using not actual date for last_triggered / last_updated by creation ?
i get also 36hour old data - and
if hass sensor date <> value date from api gets things tricky
thx
for own services.py i need more experience
my first custom component