adaptive-lighting
adaptive-lighting copied to clipboard
Error doing job: Task exception was never retrieved
Version information:
Adaptive Lighting Release 1.0.15
installed on a Raspberry Pi 4 with Home Assistant Core 2022.5.2 Home Assistant Supervisor 2022.05.0 Home Assistant OS 7.6
Description:
there is this error lingering around my logs, everything seems to be working, but this error keeps coming up several times (most I've checked was 56 times) and it seems adding on itself indefinitely. Can't figure out what causes it.
Error message:
This error originated from a custom integration.
Logger: homeassistant
Source: custom_components/adaptive_lighting/switch.py:1257
Integration: Adaptive Lighting (documentation, issues)
First occurred: 12:23:31 PM (3 occurrences)
Last logged: 12:23:31 PM
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/adaptive_lighting/switch.py", line 1257, in turn_on_off_event_listener
entity_ids = cv.ensure_list_csv(service_data[ATTR_ENTITY_ID])
KeyError: 'entity_id'
still happening, even after recent updates.
Same here
this error keeps turning back on the lights after I've turned them OFF via an automation or group
Triage Notes
I did some digging and discovered the issue happens on when an Automation that turns on the lights uses an area_id
and not entity_id
.
Here is an example event that fails:
event: <Event call_service[L]: domain=light, service=turn_on, service_data=area_id=['pantry']>
And here is one that is fine:
event: <Event call_service[L]: domain=light, service=turn_on, service_data=entity_id=light.master_bedroom_lights_2, transition=45.0, brightness=255, color_temp=246>
Here id the problematic code:
service = event.data[ATTR_SERVICE]
service_data = event.data[ATTR_SERVICE_DATA]
entity_ids = cv.ensure_list_csv(service_data[ATTR_ENTITY_ID])
This code only attempts to read entity_id
(service_data[ATTR_ENTITY_ID]
) and not the other supported targets (area_id
and device_id
).
Workaround
Update all Automations to use Entities and not Areas. You can switch to the new Entity Groups which would allow controlling a collection of entities at the same time which are similar to using Areas.
Thank you for your triage. I hope the code gets updated as it would be a nightmare to use entity_id in my automations..
@RubenKelevra is there anything that we can do to have this issue addressed?
@cinghialino well, does it break anything for you?
I mean if it's just a logged error I wouldn't want to invest the time to debug and fix and and rather work on the rewrite of the whole output-module which obviously will replace the code causing this.
Well, it does break stuff. Every time I send a turn_off, the lights are turning off but after a few seconds they turn back on. If I disable adaptive lighting or take out lights from it, everything works fine. It doesn't happen when I use entity_id, but as mentioned above, it's very inconvenient to use that to control lights of an entire area.
Can we please have the code updated to use areas instead of entities?
@cinghialino, I'll happily accept and review your pull request 😃
I've had this error log for a good while, but good to know it's not causing any issues other than an error log.
I personally have far too many automations going on with area's to switch to the groups workaround, but thanks for detailing @jls5177 (I'm surprised more people aren't noting/:+1:'ing this issue, I would've thought groups were quite popular especially since HA has areas built into the UI editor lately.)
I think #75 is also a duplicate of this for what it's worth.
I guess this won't be fixed. I give up.
I fixed the problem in PR #321.
I will release 1.0.17 in a few minutes :tada:
I fixed the problem in PR #321.
I will release 1.0.17 in a few minutes 🎉
Thanks @basnijholt, can confirm the issue is resolved.