shenxn / ha-dyson

HomeAssitant custom integration for dyson
MIT License
307 stars 59 forks source link

ValueError in log file #125

Open GitPetri opened 2 years ago

GitPetri commented 2 years ago

This probably initiates from the libdyson itself but as Home Assistant logs this on Dyson Local, I'll report it here:

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 519, in async_update_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 "/config/custom_components/dyson_local/utils.py", line 18, in __get__
    value = super().__get__(obj, type)
  File "/config/custom_components/dyson_local/sensor.py", line 337, in state
    return self._device.formaldehyde
  File "/usr/local/lib/python3.9/site-packages/libdyson/dyson_pure_humidify_cool.py", line 110, in formaldehyde
    return int(self._get_environmental_field_value("hcho"))
  File "/usr/local/lib/python3.9/site-packages/libdyson/dyson_device.py", line 292, in _get_environmental_field_value
    return int(value)
ValueError: invalid literal for int() with base 10: 'NONE'

HASS 2022.4.2 Dyson Local v0.16.4-4 libdyson 0.8.11 (based on Dyson Local installation log) The error message bundle comes every 30 seconds so I assume on every state poll of the device.

Kakise commented 2 years ago

It seems like Dyson-local is asking your Dyson pure humidify+cool for formaldehyde readings while it doesn't support it. It's a bug with my experimental formaldehyde sensor. It should be fixed by the next release.

GitPetri commented 2 years ago

It seems like Dyson-local is asking your Dyson pure humidify+cool for formaldehyde readings while it doesn't support it. It's a bug with my experimental formaldehyde sensor. It should be fixed by the next release.

Developer Tools -view seems to confirm this: sensor.purifier_humidify_cool_formaldehyde_formaldehyde unavailable Purifier Humidify+Cool Formaldehyde Formaldehyde So this would link the unavailable formaldehyde reading to my 358E device

GitPetri commented 2 years ago

FYI @Kakise I have this device which on getdevices.py identifies as 358E which in libdyson is configured to be Purifier Humidify+Cool Formaldehyde My device is not a formaldehyde-version like PH04. The model numbering scheme on Dyson web pages is a bit messy but I think my device is PH3A

patelreese87 commented 3 months ago

I am having a similar issue and same ValueError - is there a fix for this or a way to work around this error.

Dyson Local v0.16.4-4 Core 2024.5.4 Supervisor 2024.05.1

Assuming there is a poll interval, this error is caught hundreds of time throughout the day. Please advise if I am doing something wrong or how i can fix this.

` Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 658, in state numerical_value = int(value) ^^^^^^^^^^ ValueError: invalid literal for int() with base 10: 'off'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 661, in state numerical_value = float(value) ^^^^^^^^^^^^ ValueError: could not convert string to float: 'off'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 414, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners update_callback() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 492, in _handle_coordinator_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1009, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1132, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1015, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 665, in state raise ValueError( ValueError: Sensor sensor.pure_cool_link_temperature has device class 'temperature', state class 'measurement' unit '°F' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'off' (<class 'str'>) `