albertogeniola / meross-homeassistant

Custom component that leverages the Meross IoT library to integrate with Homeassistant
MIT License
711 stars 82 forks source link

Error doing job: Task exception was never retrieved #347

Closed NicciZar closed 2 years ago

NicciZar commented 2 years ago

Describe the bug There seems to be an error message describing how there was an task exception but it was never retrieved (The error mentioned your extension - thats why I wanted to report it here.

Your environment

System Health

Version | core-2022.4.2 -- | -- Installation Type | Home Assistant OS Development | false Supervisor | true Docker | true User | root Virtual Environment | false Python Version | 3.9.9 Operating System Family | Linux Operating System Version | 5.10.103-v8 CPU Architecture | aarch64 Timezone | Europe/Berlin

System Health Version core-2022.4.2 Installation Type Home Assistant OS Development false Supervisor true Docker true User root Virtual Environment false Python Version 3.9.9 Operating System Family Linux Operating System Version 5.10.103-v8 CPU Architecture aarch64 Timezone Europe/Berlin Installed Version 1.24.5 Home Assistant Supervisor Host Operating System Home Assistant OS 7.6 Update Channel stable Supervisor Version supervisor-2022.04.0 Docker Version 20.10.9 Disk Total 116.5 GB Disk Used 15.7 GB Healthy true Supported Unsupported – more info Board rpi4-64 Supervisor API ok Version API ok Installed Add-ons Terminal & SSH (9.3.0), Portainer (1.5.1), Studio Code Server (4.2.0), AdGuard Home (4.5.0), ZeroTier One (0.13.2), motionEye (0.18.0), TasmoAdmin (0.17.0), Mosquitto broker (6.0.1), File editor (5.3.3), MariaDB (2.4.0), ESPHome (2022.3.2), Node-RED (11.1.1)


Logs taken when the issue happened

Logger: homeassistant
Source: components/sensor/__init__.py:454
**First occurred: 14:59:20 (12 occurrences)**
Last logged: 15:21:20

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 137, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 268, in _async_refresh
    update_callback()
  File "/config/custom_components/meross_cloud/__init__.py", line 249, in _http_data_changed
    self.async_schedule_update_ha_state(force_refresh=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 710, in async_schedule_update_ha_state
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 454, in state
    assert native_unit_of_measurement
AssertionError

Snippet from full log in the time of first occurrence as of today (14:59:20)

2022-04-14 14:59:20 DEBUG (MainThread) [meross_iot.http_api] Response Status Code: 200
2022-04-14 14:59:20 DEBUG (MainThread) [custom_components.meross_cloud] Finished fetching meross_http_coordinator data in 0.258 seconds (success: True)
2022-04-14 14:59:20 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 137, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 268, in _async_refresh
update_callback()
File "/config/custom_components/meross_cloud/__init__.py", line 249, in _http_data_changed
self.async_schedule_update_ha_state(force_refresh=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 710, in async_schedule_update_ha_state
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 454, in state
assert native_unit_of_measurement
AssertionError
freddysherman commented 2 years ago

I have a similar problem, it shows up whan I try to change the unit of measurement of a temperature sensor to C which the system accepts it but changes it back to F.

NicciZar commented 2 years ago

I am also getting this one. This might also be temperature related

Logger: meross_iot.controller.device
Source: components/sensor/__init__.py:454
First occurred: April 15, 2022, 18:54:05 (37 occurrences)
Last logged: 08:16:58

Error occurred while firing push notification event Namespace.HUB_MTS100_TEMPERATURE with data: {'room': 205, 'id': '0100A916'}
Error occurred while firing push notification event Namespace.HUB_MTS100_TEMPERATURE with data: {'room': 200, 'id': '0100A916'}
Error occurred while firing push notification event Namespace.HUB_MTS100_TEMPERATURE with data: {'room': 195, 'id': '0100A916', 'heating': 1}
Error occurred while firing push notification event Namespace.HUB_MTS100_TEMPERATURE with data: {'room': 200, 'id': '0100A916', 'heating': 0}
Error occurred while firing push notification event Namespace.HUB_MTS100_TEMPERATURE with data: {'room': 210, 'id': '0100A916'}
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/meross_iot/controller/device.py", line 126, in _fire_push_notification_event
    await c(namespace=namespace, data=data, device_internal_id=device_internal_id)
  File "/config/custom_components/meross_cloud/__init__.py", line 305, in _async_push_notification_received
    self.async_schedule_update_ha_state(force_refresh=full_update)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 710, in async_schedule_update_ha_state
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 454, in state
    assert native_unit_of_measurement
AssertionError
freddysherman commented 2 years ago

After much digging I have found the source of my problem - I had (somehow ?) set the units in a customize.yaml file and these were over wrighting the settings made in the Developer Tools and through the UI. I have commente dout the settings in the customize.yaml file and now working !

I got the clue from installing and running the watchman integration and studying the report.

NicciZar commented 2 years ago

The issue is still there for me. I have not set any units / values static inside the customize.yaml file..

NicciZar commented 2 years ago

So the issue doesn't seem to be present anymore. I'm not sure how it got away because I didn't change anything. Either way its now gone.