appdaemon icon indicating copy to clipboard operation
appdaemon copied to clipboard

Using 'timeout' on listen_state causes "warnings" Loops - "Unexpected error in scheduler loop"

Open bertonjit opened this issue 2 months ago • 0 comments

What happened?

Issue is very reproducible. Add a similar call as below in any app and then look at the main_log. The warnings appears every 1 sec while causes appdeamon to misfire on most automations.

This happens at the end of the timeout. As an example, if timeout is hour, the warnings start an hour after the below line is executed.

self.listen_state(self.Notifffy, "input_boolean.test_switch",new = "on",timeout = 10)

Version

4.5.13

Installation type

Home Assistant add-on

Relevant log output

Error:
2025-11-06 12:01:58.172457 WARNING AppDaemon: ------------------------------------------------------------
2025-11-06 12:01:59.472652 WARNING AppDaemon: ------------------------------------------------------------
2025-11-06 12:01:59.473753 WARNING AppDaemon: Unexpected error in scheduler loop
2025-11-06 12:01:59.474609 WARNING AppDaemon: ------------------------------------------------------------
2025-11-06 12:01:59.478215 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/appdaemon/scheduler.py", line 625, in loop
    self.logger.debug("Firing scheduled callback %s for '%s'", func.__name__, name)
                                                               ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute '__name__'. Did you mean: '__ne__'?

2025-11-06 12:01:59.479032 WARNING AppDaemon: ------------------------------------------------------------
2025-11-06 12:02:00.656804 INFO AppDaemon: Modified Python files: 1
2025-11-06 12:02:00.659469 INFO AppDaemon: Modification affects apps {'Test'}
2025-11-06 12:02:00.756707 WARNING AppDaemon: ------------------------------------------------------------
2025-11-06 12:02:00.758007 WARNING AppDaemon: Unexpected error in scheduler loop
2025-11-06 12:02:00.759218 WARNING AppDaemon: ------------------------------------------------------------
2025-11-06 12:02:00.763082 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/appdaemon/scheduler.py", line 625, in loop
    self.logger.debug("Firing scheduled callback %s for '%s'", func.__name__, name)
                                                               ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute '__name__'. Did you mean: '__ne__'?

Relevant code in the app or config file that caused the issue

self.listen_state(self.Notifffy, "input_boolean.test_switch",new = "on",timeout = 10)

Anything else?

No response

bertonjit avatar Nov 06 '25 20:11 bertonjit