bob1de / hass-apps

Some useful apps and snippets to empower Home Assistant and AppDaemon even more.
Apache License 2.0
86 stars 23 forks source link

Unexpected error in worker for App schedy_heating (TimeoutError with traceback) #62

Open flecmart opened 3 years ago

flecmart commented 3 years ago

Hi there,

I used schedy for a long time now without any problems. Lately I noticed that my thermostats don't switch the way I scheduled them with schedy anymore... I looked in the AppDaemon Logs and found the following schedy warning. This happens sporadic I think since I updated to 2021.05. Does anymone encouter the same or can figure something out with the traceback? If I restart AppDaemon schedy starts working somehwo again... but it reacts somehow slow and will crach again sporadically.

2021-05-21 14:00:10.223010 WARNING schedy_heating: ------------------------------------------------------------
2021-05-21 14:00:10.223882 WARNING schedy_heating: Unexpected error in worker for App schedy_heating:
2021-05-21 14:00:10.224451 WARNING schedy_heating: Worker Ags: {'id': '740c11a09443418db5b30d154090cacb', 'name': 'schedy_heating', 'objectid': '14bda6448d9b4fbfad8c1935ab1594cb', 'type': 'scheduler', 'function': <bound method Room._scheduling_timer_cb of <Room R:kuche>>, 'pin_app': True, 'pin_thread': 0, 'kwargs': {'interval': 86400, '__thread_id': 'thread-0'}}
2021-05-21 14:00:10.225145 WARNING schedy_heating: ------------------------------------------------------------
2021-05-21 14:00:10.226496 WARNING schedy_heating: Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/appdaemon/threading.py", line 890, in worker
    funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"]))
  File "/usr/lib/python3.8/site-packages/hass_apps/schedy/room.py", line 50, in wrapper
    result = handler(self, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/hass_apps/schedy/room.py", line 203, in _scheduling_timer_cb
    self.apply_schedule()
  File "/usr/lib/python3.8/site-packages/hass_apps/schedy/room.py", line 50, in wrapper
    result = handler(self, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/hass_apps/schedy/room.py", line 408, in apply_schedule
    self.set_value(new_scheduled_value, force_resend=force_resend)
  File "/usr/lib/python3.8/site-packages/hass_apps/schedy/room.py", line 587, in set_value
    changed |= actor.set_value(value, force_resend=force_resend)[0]
  File "/usr/lib/python3.8/site-packages/hass_apps/schedy/actor/base.py", line 285, in set_value
    self._resending_cb({"left_tries": self.cfg["send_retries"] + 1})
  File "/usr/lib/python3.8/site-packages/hass_apps/schedy/room.py", line 50, in wrapper
    result = handler(self, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/hass_apps/schedy/actor/base.py", line 93, in _resending_cb
    self.do_send()
  File "/usr/lib/python3.8/site-packages/hass_apps/schedy/actor/thermostat.py", line 319, in do_send
    self.app.call_service(
  File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 197, in inner_sync_wrapper
    f = run_coroutine_threadsafe(self, coro(self, *args, **kwargs))
  File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 308, in run_coroutine_threadsafe
    result = future.result(self.AD.internal_function_timeout)
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 446, in result
    raise TimeoutError()
concurrent.futures._base.TimeoutError

2021-05-21 14:00:10.228069 WARNING schedy_heating: ------------------------------------------------------------
2021-05-21 14:00:10.232074 WARNING AppDaemon: callback _scheduling_timer_cb() in schedy_heating has now completed
Julius112 commented 2 years ago

I am experiencing the same problems - do you have got any solution? I already thinking of finding an alternative to schedy...

flecmart commented 2 years ago

I tried to debug it for multiple days and did not find a solution. I reimplemented my heating stuff with node-red... it is a completely different approach but I am happy how it turned out.

Julius112 commented 2 years ago

Hopefully, I don't need to go down that route as well... Thanks anyway for the update :)

Julius112 commented 2 years ago

I went down that route and switched to: https://github.com/nielsfaber/scheduler-component For anyone who is interested I'm happy to write a little bit more about on how I archived a similar behaviour to schedy.