Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error doing job: Task exception was never retrieved #283

Closed
cinghialino opened this issue May 8, 2022 · 14 comments
Closed

Error doing job: Task exception was never retrieved #283

cinghialino opened this issue May 8, 2022 · 14 comments

Comments

@cinghialino
Copy link

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'
@cinghialino cinghialino changed the title Repeating error: Error doing job: Task exception was never retrieved May 8, 2022
@cinghialino
Copy link
Author

still happening, even after recent updates.

@marcokitzmann
Copy link

Same here

@cinghialino
Copy link
Author

this error keeps turning back on the lights after I've turned them OFF via an automation or group

@jls5177
Copy link

jls5177 commented May 22, 2022

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.

@cinghialino
Copy link
Author

Thank you for your triage. I hope the code gets updated as it would be a nightmare to use entity_id in my automations..

@cinghialino
Copy link
Author

@RubenKelevra is there anything that we can do to have this issue addressed?

@RubenKelevra
Copy link
Collaborator

@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.

@cinghialino
Copy link
Author

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.

@cinghialino
Copy link
Author

Can we please have the code updated to use areas instead of entities?

@basnijholt
Copy link
Owner

@cinghialino, I'll happily accept and review your pull request 😃

@ahaverty
Copy link

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.

@cinghialino
Copy link
Author

I guess this won't be fixed. I give up.

basnijholt added a commit that referenced this issue Aug 30, 2022
Add support for areas and add a test that reproduce issue of #75 #283
@basnijholt
Copy link
Owner

I fixed the problem in PR #321.

I will release 1.0.17 in a few minutes 🎉

@Broekman
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants