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

Task exception error since upgrade to HA Core to 2025.1.0 (myUplink integration) #136193

Closed
pricei opened this issue Jan 21, 2025 · 6 comments · Fixed by #136333
Closed

Task exception error since upgrade to HA Core to 2025.1.0 (myUplink integration) #136193

pricei opened this issue Jan 21, 2025 · 6 comments · Fixed by #136333

Comments

@pricei
Copy link

pricei commented Jan 21, 2025

The problem

Several times each day, the message below appears in the HA Core log. Note that the KeyError number at the end of the message occasionally shows 10631 instead of 10113

2025-01-21 18:05:46.579 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 267, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 478, in _async_refresh
self.async_update_listeners()
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 177, in async_update_listeners
update_callback()
~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 558, in _handle_coordinator_update
self.async_write_ha_state()
~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1023, in async_write_ha_state
self._async_write_ha_state()
~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1148, in _async_write_ha_state
self.__async_calculate_state()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1085, in __async_calculate_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1029, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 520, in state
value = self.native_value
^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/myuplink/sensor.py", line 331, in native_value
return self.options_map[str(int(device_point.value))] # type: ignore[no-any-return]
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '10113'

What version of Home Assistant Core has the issue?

2025.1.0 and later

What was the last working version of Home Assistant Core?

2025.11

What type of installation are you running?

Home Assistant OS

Integration causing the issue

MyUplink

Link to integration documentation on our website

http://homeassistant.local:8123/config/integrations/integration/myuplink

Diagnostics information

No response

Example YAML snippet

Anything in the logs that might be useful for us?

2025-01-21 18:05:46.579 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 267, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 478, in _async_refresh
    self.async_update_listeners()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 177, in async_update_listeners
    update_callback()
    ~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 558, in _handle_coordinator_update
    self.async_write_ha_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1023, in async_write_ha_state
    self._async_write_ha_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1148, in _async_write_ha_state
    self.__async_calculate_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1085, in __async_calculate_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1029, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 520, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/myuplink/sensor.py", line 331, in native_value
    return self.options_map[str(int(device_point.value))]  # type: ignore[no-any-return]
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: '10113'

Additional information

The error messages described above have only appeared duringthe last three weeks so I'm reasonably confident they started following the introduction of HA Core 2025.1

@pricei pricei changed the title Task exception error since upgrade to HA Core to 2025.1.0 Task exception error since upgrade to HA Core to 2025.1.0 (myUplink integration) Jan 21, 2025
@pricei
Copy link
Author

pricei commented Jan 21, 2025

Correction to What was the last working version of Home Assistant Core?
Answer should be 2024.12

@home-assistant
Copy link

Hey there @pajzo, @astrandb, mind taking a look at this issue as it has been labeled with an integration (myuplink) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of myuplink can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign myuplink Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


myuplink documentation
myuplink source
(message by IssueLinks)

@astrandb
Copy link
Contributor

@pricei Thank you for reporting.
This error is most likely caused by myUplink API sending incomplete or out-of-spec data and is not related to upgrade of HA. We shall make the error handling more robust in this area...

@pricei
Copy link
Author

pricei commented Jan 22, 2025

Thanks, @astrandb I did enable debug logging for the myUplink integration but it doesn't appear to add any additional information relating to this error to the Core log. Is there any other information I can provide to help?

@astrandb
Copy link
Contributor

@pricei It would be helpful if you could capture a diagnostic download from the device page when this error occurs. It is probably an intermittent state so it can be difficult to catch.
In the mean time we will try to improve the error handling.

@pricei
Copy link
Author

pricei commented Jan 26, 2025

I just wanted to confirm that the change described in #136333 and which was included in HA Core 2025.1.4 has resolved the issue I reported.
Thanks @astrandb and @thecode

@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants