Skip to content
Snippets Groups Projects
Unverified Commit e30a9d1f authored by Ethan Madden's avatar Ethan Madden Committed by GitHub
Browse files

Fix VeSync air_quality fan attribute (#71771)


* Refactor attribute inclusion for VeSync fans.

A recent change to pyvesync (introduced in 2.2) changed `air_quality` to
refer to air quality as an integer representation of perceived air
quality rather than a direct reading of the PM2.5 sensor. With 2.3 the
PM2.5 sensor access was restored as `air_quality_value`. Unfortunately,
`air_quality_value` was not added as an attribute on the fan object, and
rather only exists in the `details` dictionary on the fan object.

* Update homeassistant/components/vesync/fan.py

Co-authored-by: default avatarMartin Hjelmare <marhje52@gmail.com>

* Rename `air_quality_value` attribute to `pm25`

This should make it more clear what the attribute actually represents

* `air_quality` attribute reports `air_quality_value`

This restores previous behavior for this integration to what it was
before the `pyvesync==2.02` upgrade, using the `air_quality` attribute
to report pm2.5 concentrations (formerly `air_quality`) rather the
vague measurement now reported by `air_quality`.

Co-authored-by: default avatarMartin Hjelmare <marhje52@gmail.com>
parent 77d39f9c
No related branches found
No related tags found
No related merge requests found
...@@ -171,8 +171,8 @@ class VeSyncFanHA(VeSyncDevice, FanEntity): ...@@ -171,8 +171,8 @@ class VeSyncFanHA(VeSyncDevice, FanEntity):
if hasattr(self.smartfan, "night_light"): if hasattr(self.smartfan, "night_light"):
attr["night_light"] = self.smartfan.night_light attr["night_light"] = self.smartfan.night_light
if hasattr(self.smartfan, "air_quality"): if self.smartfan.details.get("air_quality_value") is not None:
attr["air_quality"] = self.smartfan.air_quality attr["air_quality"] = self.smartfan.details["air_quality_value"]
if hasattr(self.smartfan, "mode"): if hasattr(self.smartfan, "mode"):
attr["mode"] = self.smartfan.mode attr["mode"] = self.smartfan.mode
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"name": "VeSync", "name": "VeSync",
"documentation": "https://www.home-assistant.io/integrations/vesync", "documentation": "https://www.home-assistant.io/integrations/vesync",
"codeowners": ["@markperdue", "@webdjoe", "@thegardenmonkey"], "codeowners": ["@markperdue", "@webdjoe", "@thegardenmonkey"],
"requirements": ["pyvesync==2.0.2"], "requirements": ["pyvesync==2.0.3"],
"config_flow": true, "config_flow": true,
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"loggers": ["pyvesync"] "loggers": ["pyvesync"]
......
...@@ -1999,7 +1999,7 @@ pyvera==0.3.13 ...@@ -1999,7 +1999,7 @@ pyvera==0.3.13
pyversasense==0.0.6 pyversasense==0.0.6
# homeassistant.components.vesync # homeassistant.components.vesync
pyvesync==2.0.2 pyvesync==2.0.3
# homeassistant.components.vizio # homeassistant.components.vizio
pyvizio==0.1.57 pyvizio==0.1.57
......
...@@ -1322,7 +1322,7 @@ pyuptimerobot==22.2.0 ...@@ -1322,7 +1322,7 @@ pyuptimerobot==22.2.0
pyvera==0.3.13 pyvera==0.3.13
# homeassistant.components.vesync # homeassistant.components.vesync
pyvesync==2.0.2 pyvesync==2.0.3
# homeassistant.components.vizio # homeassistant.components.vizio
pyvizio==0.1.57 pyvizio==0.1.57
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment