Unexpected error during process_event

Hi - please can someone help me diagnose where/how this error is occurring in my AD setup? I’m getting rather a lot of these errors and I can’t work out what is causing them as there doesn’t seem to be any references to my code in the error message. Does anyone know how I can find out which app is causing this error to happen? Thanks!

I’m running version 4.03 using the docker image.

2020-03-11 08:03:51.926946 WARNING AppDaemon: ------------------------------------------------------------
2020-03-11 08:03:51.927195 WARNING AppDaemon: Unexpected error during process_event()
2020-03-11 08:03:51.927409 WARNING AppDaemon: ------------------------------------------------------------
2020-03-11 08:03:51.927927 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/appdaemon/events.py", line 195, in process_event
    await self.AD.state.process_state_callbacks(namespace, data)
  File "/usr/local/lib/python3.8/site-packages/appdaemon/state.py", line 262, in process_state_callbacks
    executed = await self.AD.threading.check_and_dispatch_state(
  File "/usr/local/lib/python3.8/site-packages/appdaemon/threading.py", line 700, in check_and_dispatch_state
    executed = await self.dispatch_worker(
  File "/usr/local/lib/python3.8/site-packages/appdaemon/threading.py", line 733, in dispatch_worker
    if not await self.check_time_constraint(self.AD.app_management.app_config[name], name):
  File "/usr/local/lib/python3.8/site-packages/appdaemon/threading.py", line 568, in check_time_constraint
    if await self.AD.sched.now_is_between(start_time, end_time, name) is False:
  File "/usr/local/lib/python3.8/site-packages/appdaemon/scheduler.py", line 572, in now_is_between
    start_time = (await self._parse_time(start_time_str, name))["datetime"]
  File "/usr/local/lib/python3.8/site-packages/appdaemon/scheduler.py", line 612, in _parse_time
    parts = re.search(r"^(\d+)-(\d+)-(\d+)\s+(\d+):(\d+):(\d+)$", time_str)
  File "/usr/local/lib/python3.8/re.py", line 199, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object

Do you have some automations which use now_is_between?

Hi Burningstone, no I don’t have code anywhere.

Any app with time constraints?

Yes I’ve got quite a few of those, e.g.

constrain_start_time: 16:00:00
constrain_end_time: 22:00:00

I’ve just noticed they are not in quotes - is this the problem?

This might be a problem, I’m not sure. Try to put them all in quotes and see if the error disappears.

I’m going to do that - thanks for the suggestion.

I have used the time constraint in a few apps and just checked, this was the only one without the time encapsulated in quotes. Coincidentally it was one of my first apps I wrote and I had forgotten all about it. Looking at it now, I know the app has not been running. If that’s the case then that one app has been kicking out a lot of error messages in the log! I’ll report back here and update later if this has fixed the problem. Thanks again.