JohNan/homeassistant-wellbeing

BR: Integration stops working after a while

Closed this issue · 7 comments

Got the following in my homeassistant.log about 3-4 hours after restarting it:

2021-05-15 10:14:34 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/update_coordinator.py", line 127, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/update_coordinator.py", line 259, in _async_refresh
    update_callback()
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/update_coordinator.py", line 319, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 334, in async_write_ha_state
    self._async_write_ha_state()
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 368, in _async_write_ha_state
    state = self._stringify_state()
  File "/srv/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 340, in _stringify_state
    state = self.state
  File "/home/homeassistant/.homeassistant/custom_components/wellbeing/sensor.py", line 33, in state
    return self.get_entity.state
  File "/home/homeassistant/.homeassistant/custom_components/wellbeing/api.py", line 45, in state
    return self._data[self.attr]
KeyError: 'CO2'

image

I should note that I'm using Wellbeing A7 (not A9) and I'm running HASS 2021.5.3.

It also gives KeyError on FilterLife.

In A7 I have "ECO2", "Particle filter" and "Odor filter" in the App. Perhaps they're presented differently via the API compared to the A9? I will happily supply the API output if I can get some guidance on how to get it :-)

I should add some checks for what sensors that are supported. The integration is still a work in progress.

Thanks for the info.

That would be very helpful. Enable debug printing for the integration.

logger:
  logs:
    custom_components.wellbeing: debug

The response should be available in the logs after a restart.

Well A7: {'pncId': 'XXXXX', 'applianceData': {'applianceName': 'Well A7', 'created': '2021-05-04T15:13:47.8624107Z', 'modelName': 'WELLA7', 'pncId': 'XXXXX'}, 'twin': {'deviceId': 'XXXXX', 'properties': {'desired': {'MinRefreshInterval_s': 3, 'ReportExtraProperties': False, 'PM1_Hysteresis': 3, 'PM2_5_Hysteresis': 3, 'PM10_Hysteresis': 3, 'Temp_Hysteresis': 0.0, 'Humidity_Hysteresis': 3, 'ECO2_Hysteresis': 9, 'TVOC_Hysteresis': 9, 'LocationReq': True, 'TimeZoneStandardName': 'Europe/Stockholm', 'TimeZoneDaylightRule': ':GMT+1:GMT+2:0100:(1900)040102-0:110103-0', 'VmNo_NIU': 'VM185_A_01.29.00_ASPEN', 'VmNo_MCU': 'VM174_A_01.01.00', '$metadata': {'$lastUpdated': '2021-05-13T15:00:52.7912569Z', '$lastUpdatedVersion': 11, 'MinRefreshInterval_s': {'$lastUpdated': '2021-05-13T15:00:52.7912569Z', '$lastUpdatedVersion': 11}, 'ReportExtraProperties': {'$lastUpdated': '2021-05-13T15:00:52.7912569Z', '$lastUpdatedVersion': 11}, 'PM1_Hysteresis': {'$lastUpdated': '2021-05-13T15:00:52.7912569Z', '$lastUpdatedVersion': 11}, 'PM2_5_Hysteresis': {'$lastUpdated': '2021-05-13T15:00:52.7912569Z', '$lastUpdatedVersion': 11}, 'PM10_Hysteresis': {'$lastUpdated': '2021-05-13T15:00:52.7912569Z', '$lastUpdatedVersion': 11}, 'Temp_Hysteresis': {'$lastUpdated': '2021-05-13T15:00:52.7912569Z', '$lastUpdatedVersion': 11}, 'Humidity_Hysteresis': {'$lastUpdated': '2021-05-13T15:00:52.7912569Z', '$lastUpdatedVersion': 11}, 'ECO2_Hysteresis': {'$lastUpdated': '2021-05-13T15:00:52.7912569Z', '$lastUpdatedVersion': 11}, 'TVOC_Hysteresis': {'$lastUpdated': '2021-05-13T15:00:52.7912569Z', '$lastUpdatedVersion': 11}, 'LocationReq': {'$lastUpdated': '2021-05-13T15:00:52.7912569Z', '$lastUpdatedVersion': 11}, 'TimeZoneStandardName': {'$lastUpdated': '2021-05-13T15:00:52.7912569Z', '$lastUpdatedVersion': 11}, 'TimeZoneDaylightRule': {'$lastUpdated': '2021-05-13T15:00:52.7912569Z', '$lastUpdatedVersion': 11}, 'VmNo_NIU': {'$lastUpdated': '2021-05-13T15:00:52.7912569Z', '$lastUpdatedVersion': 11}, 'VmNo_MCU': {'$lastUpdated': '2021-05-13T15:00:52.7912569Z', '$lastUpdatedVersion': 11}}, '$version': 11}, 'reported': {'FilterLife_1': 96, 'FilterType_1': 48, 'WorkMode': 'Auto', 'Fanspeed': 2, 'SafetyLock': False, 'Ionizer': False, 'PMSensState': True, 'FilterType_2': 192, 'FilterLife_2': 95, 'Model': 'A7', 'UILight': True, 'ErrImpellerStuck': 'not active', 'ErrPmNotResp': 'not active', 'ErrGasNotResp': 'not active', 'ErrTempRhNotResp': 'not active', 'ErrNfcTagNotPres_1': 'not active', 'ErrNfcTagNotPres_2': 'not active', 'ErrNfcTagPresNotValid_1': 'not active', 'ErrNfcTagPresNotValid_2': 'not active', 'ErrNfcTransceiver_1': 'not active', 'ErrNfcTransceiver_2': 'not active', 'InterfaceVer': 20210119, 'VmNo_NIU': 'VM185_A_01.29.00_ASPEN', 'VmNo_MCU': 'VM174_A_01.01.00', 'FrmVer_NIU': '1.29.0', 'Workmode': 'Auto', 'logE': 0, 'logW': 2013, 'capabilities': {'tasks': {}}, 'SignalStrength': 'GOOD', 'tasks': {}, 'SchedulingState': 'not set', 'ErrCommSensorUIBrd': 'not active', '$metadata': {'$lastUpdated': '2021-05-15T08:51:36.219Z', 'FilterLife_1': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'FilterType_1': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'WorkMode': {'$lastUpdated': '2021-05-04T16:01:57.0833993Z'}, 'Fanspeed': {'$lastUpdated': '2021-05-15T08:43:57.8181056Z'}, 'SafetyLock': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'Ionizer': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'PMSensState': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'FilterType_2': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'FilterLife_2': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'Model': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'UILight': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'ErrImpellerStuck': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'ErrPmNotResp': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'ErrGasNotResp': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'ErrTempRhNotResp': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'ErrNfcTagNotPres_1': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'ErrNfcTagNotPres_2': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'ErrNfcTagPresNotValid_1': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'ErrNfcTagPresNotValid_2': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'ErrNfcTransceiver_1': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'ErrNfcTransceiver_2': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'InterfaceVer': {'$lastUpdated': '2021-05-14T11:16:56.900557Z'}, 'VmNo_NIU': {'$lastUpdated': '2021-05-14T11:16:56.900557Z'}, 'VmNo_MCU': {'$lastUpdated': '2021-05-14T11:16:56.900557Z'}, 'FrmVer_NIU': {'$lastUpdated': '2021-05-14T11:16:56.900557Z'}, 'Workmode': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'logE': {'$lastUpdated': '2021-05-14T11:16:56.900557Z'}, 'logW': {'$lastUpdated': '2021-05-14T11:16:56.900557Z'}, 'capabilities': {'$lastUpdated': '2021-05-14T11:16:56.900557Z', 'tasks': {'$lastUpdated': '2021-05-14T11:16:56.900557Z'}}, 'SignalStrength': {'$lastUpdated': '2021-05-14T11:16:56.900557Z'}, 'tasks': {'$lastUpdated': '2021-05-04T16:02:22.4671322Z'}, 'SchedulingState': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'ErrCommSensorUIBrd': {'$lastUpdated': '2021-05-14T11:16:56.9655604Z'}, 'State': {'$lastUpdated': '2021-05-04T16:01:57.02Z'}, 'PM1': {'$lastUpdated': '2021-05-15T08:50:58.552Z'}, 'PM2_5': {'$lastUpdated': '2021-05-15T08:50:58.552Z'}, 'PM10': {'$lastUpdated': '2021-05-15T08:50:58.552Z'}, 'Temp': {'$lastUpdated': '2021-05-15T08:50:58.552Z'}, 'Humidity': {'$lastUpdated': '2021-05-15T08:50:58.552Z'}, 'ECO2': {'$lastUpdated': '2021-05-15T08:51:26.998Z'}, 'TVOC': {'$lastUpdated': '2021-05-15T08:51:36.219Z'}}, '$version': 191, 'deviceId': 'XXXXX', 'State': 'Smart', 'PM1': 0, 'PM2_5': 0, 'PM10': 0, 'Temp': 20.5, 'Humidity': 57, 'ECO2': 618, 'TVOC': 2849}}, 'status': 'enabled', 'connectionState': 'Connected'}, 'telemetry': None}

Thanks!

What's the explanation for ECO2 in the app, if any. My app does not show CO2 at all. Is it the same as CO2 you think?

Pretty much, with the difference that it's estimated instead of a "proper" measurement as I understand the description.

IMG_B3851547E5C6-1