vlebourl / custom_vesync

Custom VeSync component for Home Assistant
96 stars 59 forks source link

LV-PUR131S Returning Text Value for Air_Quality #165

Open BrettEBowman opened 9 months ago

BrettEBowman commented 9 months ago

My system log is showing this error for the vesync air quality value. I believe this is why it is no longer being reported in HA.

Source: components/sensor/__init__.py:595
Integration: Sensor (documentation, issues)
First occurred: 3:37:03 PM (6 occurrences)
Last logged: 3:51:33 PM

Error adding entities for domain sensor with platform vesync
Error while setting up vesync platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 593, in state
    numerical_value = float(value)  # type:ignore[arg-type]
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: 'Excellent'

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 510, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 750, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 746, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 808, in _async_write_ha_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 752, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 595, in state
    raise ValueError(
ValueError: Sensor sensor.air_purifier_air_quality has device class 'aqi', state class 'measurement' unit 'None' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'Excellent' (<class 'str'>)

Do you have the LV-PUR131S by any chance?

_Originally posted by @vlebourl in https://github.com/vlebourl/custom_vesync/issues/160#issuecomment-1718969055_

Yes! My unit is an LV-PUR131S. I will share it with you so that you can test it.

BrettEBowman commented 9 months ago

I'm getting that same error about telling the user to upgrade to the latest version for both of your addresses. I wonder if it is because when you connect from HA with the pyvesync library it makes their system think that you are using an older version.

At any rate, can you create a new account for me to share with?

BrettEBowman commented 9 months ago

I just updated to the latest 1.1.1 release and am still getting the same error.

I also noticed in the system logs (and device entities) that there is a problem with the Display switch:

Source: custom_components/vesync/switch.py:177
Integration: Switch (documentation, issues)
First occurred: 11:07:39 AM (3 occurrences)
Last logged: 11:07:39 AM

Error adding entities for domain switch with platform vesync
vesync: Error on device update!
Error while setting up vesync platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1002, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 730, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 830, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 771, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1238, in state
    if (is_on := self.is_on) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/vesync/switch.py", line 177, in is_on
    return self.device.details["display"]
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'display'
bubbleytea commented 9 months ago

+1 seeing the same error about the display switch in the logs

mikelykzit commented 9 months ago

I'm seeing the same thing as well as HA crashing (hopefully unrelated?) so I reverted to the Core/native Home Assistant Vesync integration. Air quality for the LV-PUR131S is reflected properly there, but I lose out on my other humidifier data/automations.

Is there a way to mimic the process that Core uses for air quality to update this HACS addon?

vlebourl commented 8 months ago

Unfortunately, I no longer have time to maintain this repo. I am therefore looking for someone to take it over before archiving it.

github-actions[bot] commented 7 months ago

'There hasn't been any activity on this issue recently. Is this issue still present? Please make sure to update to the latest Home Assistant version and version of this integration to see if that solves the issue. Let us know if that works for you by adding a comment 👍. This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.'

latez commented 7 months ago

Sadly, this is still an issue and without this reading it makes this integration unusable presently - hoping a compassionate community member takes over! Is there any chance your added features get merged into the main VeSync integration? Would love to see that happen - either way thank you very much for your contributions @vlebourl