libdyson-wg/ha-dyson

Error in logs

Closed this issue · 10 comments

I am getting the below error that is constantly being added to the logs. Anyone know what it is? Let me know if you require any other info

Logger: homeassistant
Source: components/sensor/__init__.py:585 
First occurred: 17:20:34 (7600 occurrences) 
Last logged: 22:23:34

Error doing job: Exception in callback Entity.async_write_ha_state()
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 581, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'fail'

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 590, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 654, in _async_write_ha_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 596, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 585, in state
    raise ValueError(
ValueError: Sensor sensor.dyson_fan_pm_2_5 has device class 'pm25', state class 'measurement' unit 'µg/m³' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'fail' (<class 'str'>)

Interesting! So it's basically saying "Hey, I expected you to give me a number for PM2.5, but you're just giving me the word 'fail' which isn't a number!"

I'm curious why that's happening here. I've never seen a fail value. Can you share the model of the device you're using? If you use the Dyson mobile app does it show a PM2.5 value for your device in the app?

I have just reset my entire HA setup along with my Dyson fan to rule out any issue with my setup however I still see these errors... all be it less frequent.

When it was previously reporting the errors, in the case above 7600 times, the 'Continuous Monitoring' option was turned off. Turning this on has certainly helped lower the number of times these errors show however I still see them on my logs... now averaging about 10 per 24 hour period.

I am using the DYSON PURE COOL. I can see the PM2.5 value in the app.

Hello - I'm getting a similar error with Dyson Pure Hot+Cool for temperature and humidity etc

This was also mentioned as an issue in the original ha-dyson: shenxn/ha-dyson#187

Let me know if you need more info - happy to help.

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

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 471, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 749, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 850, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 590, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 654, in _async_write_ha_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 596, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 585, in state
    raise ValueError(
ValueError: Sensor sensor.pure_hot_cool_link_humidity has device class 'humidity', state class 'measurement' unit '%' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'off' (<class 'str'>)

@gerardsyd yours is more along the lines of #16 since it's off instead of fail. Still, I'll work on getting #27 merged as it should hopefully help both of these issues.

Thanks for your help @dotvezz. Any idea when this will be merged? Seeing the errors on the logs fairly consistently.

Hey @RefineryX! I got swamped in life/work/stuff the past few weeks and there were some issues discovered when testing #27 sadly. I've got time tonight, and a dev branch of other minor improvements, so I'll try to get it pushed tonight.

@RefineryX A day later than promised, but I just released v0.21.0 which I'm hoping addresses this! Let me know if you have any issues.

I have a Pure Cool Link Desk, v0.21.0 update fixed the issue! Thank you!

@dotvezz Thanks a million! I really appreciate that. Now running v0.21.0 - will report back findings in the next few days. Hopefully fixed and will then close this issue.

Works! Thanks again @dotvezz