Add vesync Core200S air purifier (#50216)

pull/50555/head
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 = {
"LV-PUR131S": "fan",
"Core200S": "fan",
}
FAN_MODE_AUTO = "auto"
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
@ -86,7 +90,7 @@ class VeSyncFanHA(VeSyncDevice, FanEntity):
@property
def preset_modes(self):
"""Get the list of available preset modes."""
return PRESET_MODES
return PRESET_MODES[self.device.device_type]
@property
def preset_mode(self):
@ -103,13 +107,30 @@ class VeSyncFanHA(VeSyncDevice, FanEntity):
@property
def extra_state_attributes(self):
"""Return the state attributes of the fan."""
return {
"mode": self.smartfan.mode,
"active_time": self.smartfan.active_time,
"filter_life": self.smartfan.filter_life,
"air_quality": self.smartfan.air_quality,
"screen_status": self.smartfan.screen_status,
}
attr = {}
if hasattr(self.smartfan, "active_time"):
attr["active_time"] = self.smartfan.active_time
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):
"""Set the speed of the device."""

View File

@ -3,7 +3,7 @@
"name": "VeSync",
"documentation": "https://www.home-assistant.io/integrations/vesync",
"codeowners": ["@markperdue", "@webdjoe", "@thegardenmonkey"],
"requirements": ["pyvesync==1.3.1"],
"requirements": ["pyvesync==1.4.0"],
"config_flow": true,
"iot_class": "cloud_polling"
}

View File

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

View File

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