Hi,
Error below started occuring last few months possibly as a result of upgrading HA or AD and only occurs after a complete system reboot, get around the problem by restarting appdaemon after HA is fully up, suspect it’s attempting to calcuate on data that isn’t available during the init. of HA.
System is running Raspian and with current versions of all.
The code is part of the def initialize section of an app:
self.run_at_sunset(self.lightsonfront,offset = 60* 60) #turn on front lights 60minutes after sunset
Probably could get around the problem by delaying the instruction execution…just thought I’d raise the issue first!
2019-01-20 15:16:35.234625 WARNING AppDaemon: ------------------------------------------------------------
2019-01-20 15:16:35.235848 WARNING AppDaemon: Unexpected error running initialize() for outside_light
2019-01-20 15:16:35.236964 WARNING AppDaemon: ------------------------------------------------------------
2019-01-20 15:16:35.247787 WARNING AppDaemon: Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/appdaemon/appdaemon.py”, line 1581, in init_object
init()
File “/home/pi/appdaemon/conf/apps/outside_lights.py”, line 17, in initialize
self.run_at_sunset(self.lightsonfront,offset = 60* 60) #turn on front lights 60minutes after sunset
File “/usr/local/lib/python3.5/dist-packages/appdaemon/appapi.py”, line 434, in run_at_sunset
handle = self.schedule_sun(name, “next_setting”, callback, **kwargs)
File “/usr/local/lib/python3.5/dist-packages/appdaemon/appapi.py”, line 420, in schedule_sun
event = self.calc_sun(type)
File “/usr/local/lib/python3.5/dist-packages/appdaemon/appapi.py”, line 261, in calc_sun
return self.AD.calc_sun(type)
File “/usr/local/lib/python3.5/dist-packages/appdaemon/appdaemon.py”, line 897, in calc_sun
return self.sun[type_].timestamp()
KeyError: ‘next_setting’
2019-01-20 15:16:35.249229 WARNING AppDaemon: ------------------------------------------------------------
Thanks,
Rob.