2022-10-11 20:14:11.532271 WARNING toilet: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/appdaemon/app_management.py", line 163, in initialize_app await init() File "/config/appdaemon/apps/automoli/automoli.py", line 448, in initialize "active_daytime": self.active_daytime, AttributeError: 'AutoMoLi' object has no attribute 'active_daytime'
when the motion sensor is triggered:
2022-10-11 20:14:14.997915 WARNING toilet: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/appdaemon/threading.py", line 826, in async_worker await funcref( File "/config/appdaemon/apps/automoli/automoli.py", line 568, in motion_detected await self.motion_event("state_changed_detection", data, kwargs) File "/config/appdaemon/apps/automoli/automoli.py", line 597, in motion_event await self.lights_on() File "/config/appdaemon/apps/automoli/automoli.py", line 940, in lights_on raise ValueError( ValueError: invalid brightness/scene: None in <adutils.Room object at 0x7f98b8f27070>
🧁 Additional context
This happens because the self.active_daytime is never set so an exception occurs on line 448.
self.active_daytime is not set because the code for it expects there to be at least two daytimes:
# check if this daytime should ne active now
if await self.now_is_between(str(dt_start), str(next_dt_start)):
await self.switch_daytime(dict(daytime=daytime, initial=True))
self.active_daytime = daytime.get("daytime")
Also this line should have self.room.name for a useful log output
😩 Describe the issue/bug
Does not work when there is only a single
daytime
.😒 Expected behavior
It should work with only a single daytime
🎛️ Configuration
🧠 System
🗒️ Logs
When the app is loaded
when the motion sensor is triggered:
🧁 Additional context
This happens because the
self.active_daytime
is never set so an exception occurs on line 448.self.active_daytime
is not set because the code for it expects there to be at least two daytimes:Also this line should have
self.room.name
for a useful log output