Add vesync Core200S air purifier (#50216)

This commit is contained in:
Kevin Anthony 2021-05-13 01:02:24 -03:00 committed by GitHub
parent ca09027914
commit 3b3d6e0da5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 12 deletions

View File

@ -18,12 +18,16 @@ _LOGGER = logging.getLogger(__name__)
DEV_TYPE_TO_HA = { DEV_TYPE_TO_HA = {
"LV-PUR131S": "fan", "LV-PUR131S": "fan",
"Core200S": "fan",
} }
FAN_MODE_AUTO = "auto" FAN_MODE_AUTO = "auto"
FAN_MODE_SLEEP = "sleep" FAN_MODE_SLEEP = "sleep"
PRESET_MODES = [FAN_MODE_AUTO, FAN_MODE_SLEEP] PRESET_MODES = {
"LV-PUR131S": [FAN_MODE_AUTO, FAN_MODE_SLEEP],
"Core200S": [FAN_MODE_SLEEP],
}
SPEED_RANGE = (1, 3) # off is not included SPEED_RANGE = (1, 3) # off is not included
@ -86,7 +90,7 @@ class VeSyncFanHA(VeSyncDevice, FanEntity):
@property @property
def preset_modes(self): def preset_modes(self):
"""Get the list of available preset modes.""" """Get the list of available preset modes."""
return PRESET_MODES return PRESET_MODES[self.device.device_type]
@property @property
def preset_mode(self): def preset_mode(self):
@ -103,13 +107,30 @@ class VeSyncFanHA(VeSyncDevice, FanEntity):
@property @property
def extra_state_attributes(self): def extra_state_attributes(self):
"""Return the state attributes of the fan.""" """Return the state attributes of the fan."""
return { attr = {}
"mode": self.smartfan.mode,
"active_time": self.smartfan.active_time, if hasattr(self.smartfan, "active_time"):
"filter_life": self.smartfan.filter_life, attr["active_time"] = self.smartfan.active_time
"air_quality": self.smartfan.air_quality,
"screen_status": self.smartfan.screen_status, if hasattr(self.smartfan, "screen_status"):
} attr["screen_status"] = self.smartfan.screen_status
if hasattr(self.smartfan, "child_lock"):
attr["child_lock"] = self.smartfan.child_lock
if hasattr(self.smartfan, "night_light"):
attr["night_light"] = self.smartfan.night_light
if hasattr(self.smartfan, "air_quality"):
attr["air_quality"] = self.smartfan.air_quality
if hasattr(self.smartfan, "mode"):
attr["mode"] = self.smartfan.mode
if hasattr(self.smartfan, "filter_life"):
attr["filter_life"] = self.smartfan.filter_life
return attr
def set_percentage(self, percentage): def set_percentage(self, percentage):
"""Set the speed of the device.""" """Set the speed of the device."""

View File

@ -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==1.3.1"], "requirements": ["pyvesync==1.4.0"],
"config_flow": true, "config_flow": true,
"iot_class": "cloud_polling" "iot_class": "cloud_polling"
} }

View File

@ -1919,7 +1919,7 @@ pyvera==0.3.13
pyversasense==0.0.6 pyversasense==0.0.6
# homeassistant.components.vesync # homeassistant.components.vesync
pyvesync==1.3.1 pyvesync==1.4.0
# homeassistant.components.vizio # homeassistant.components.vizio
pyvizio==0.1.57 pyvizio==0.1.57

View File

@ -1034,7 +1034,7 @@ pytradfri[async]==7.0.6
pyvera==0.3.13 pyvera==0.3.13
# homeassistant.components.vesync # homeassistant.components.vesync
pyvesync==1.3.1 pyvesync==1.4.0
# homeassistant.components.vizio # homeassistant.components.vizio
pyvizio==0.1.57 pyvizio==0.1.57