mirror of
https://github.com/micahqcade/custom_vesync.git
synced 2025-02-11 09:39:00 +01:00
using custom pyvesync (merged master & everest-air branches)
This commit is contained in:
parent
a71d58f4b2
commit
2fbdf8397c
@ -29,7 +29,7 @@ VS_MODE_TURBO = "turbo"
|
||||
|
||||
VS_TO_HA_ATTRIBUTES = {"humidity": "current_humidity"}
|
||||
|
||||
VS_FAN_TYPES = ["VeSyncAirBypass", "VeSyncAir131", "VeSyncVital", "VeSyncAirBaseV2"]
|
||||
VS_FAN_TYPES = ["VeSyncAirBypass", "VeSyncAir131", "VeSyncVital"]
|
||||
VS_HUMIDIFIERS_TYPES = ["VeSyncHumid200300S", "VeSyncHumid200S", "VeSyncHumid1000S"]
|
||||
VS_AIRFRYER_TYPES = ["VeSyncAirFryer158"]
|
||||
|
||||
|
@ -70,15 +70,15 @@ class VeSyncFanHA(VeSyncDevice, FanEntity):
|
||||
self.smartfan = fan
|
||||
self._speed_range = (1, 1)
|
||||
self._attr_preset_modes = [VS_MODE_MANUAL, VS_MODE_AUTO, VS_MODE_SLEEP]
|
||||
if has_feature(self.smartfan, "_config_dict", VS_LEVELS):
|
||||
self._speed_range = (1, max(self.smartfan._config_dict[VS_LEVELS]))
|
||||
if has_feature(self.smartfan, "_config_dict", VS_MODES):
|
||||
if has_feature(self.smartfan, "config_dict", VS_LEVELS):
|
||||
self._speed_range = (1, max(self.smartfan.config_dict[VS_LEVELS]))
|
||||
if has_feature(self.smartfan, "config_dict", VS_MODES):
|
||||
self._attr_preset_modes = [
|
||||
VS_MODE_MANUAL,
|
||||
*[
|
||||
mode
|
||||
for mode in [VS_MODE_AUTO, VS_MODE_SLEEP, VS_MODE_TURBO]
|
||||
if mode in self.smartfan._config_dict[VS_MODES]
|
||||
if mode in self.smartfan.config_dict[VS_MODES]
|
||||
],
|
||||
]
|
||||
if self.smartfan.device_type == "LV-PUR131S":
|
||||
|
@ -15,7 +15,7 @@ from homeassistant.helpers.entity import EntityCategory
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .common import VeSyncDevice, has_feature
|
||||
from .const import DEV_TYPE_TO_HA, DOMAIN, VS_DISCOVERY, VS_LIGHTS
|
||||
from .const import DEV_TYPE_TO_HA, DOMAIN, VS_DISCOVERY, VS_LIGHTS, VS_FAN_TYPES
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -255,7 +255,7 @@ class VeSyncNightLightHA(VeSyncDimmableLightHA):
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
"""Turn the night light on."""
|
||||
if self.device._config_dict["module"] == "VeSyncAirBypass":
|
||||
if self.device.config_dict["module"] in VS_FAN_TYPES:
|
||||
if ATTR_BRIGHTNESS in kwargs and kwargs[ATTR_BRIGHTNESS] < 255:
|
||||
self.device.set_night_light("dim")
|
||||
else:
|
||||
@ -269,7 +269,7 @@ class VeSyncNightLightHA(VeSyncDimmableLightHA):
|
||||
|
||||
def turn_off(self, **kwargs):
|
||||
"""Turn the night light off."""
|
||||
if self.device._config_dict["module"] == "VeSyncAirBypass":
|
||||
if self.device.config_dict["module"] in VS_FAN_TYPES:
|
||||
self.device.set_night_light("off")
|
||||
else:
|
||||
self.device.set_night_light_brightness(0)
|
||||
|
@ -52,7 +52,7 @@ def _setup_entities(devices, async_add_entities, coordinator):
|
||||
entities.append(VeSyncHumidifierTargetLevelHA(dev, coordinator))
|
||||
if has_feature(dev, "details", "warm_mist_level"):
|
||||
entities.append(VeSyncHumidifierWarmthLevelHA(dev, coordinator))
|
||||
if has_feature(dev, "_config_dict", "levels"):
|
||||
if has_feature(dev, "config_dict", "levels"):
|
||||
entities.append(VeSyncFanSpeedLevelHA(dev, coordinator))
|
||||
|
||||
async_add_entities(entities, update_before_add=True)
|
||||
@ -77,8 +77,8 @@ class VeSyncFanSpeedLevelHA(VeSyncNumberEntity):
|
||||
def __init__(self, device, coordinator) -> None:
|
||||
"""Initialize the number entity."""
|
||||
super().__init__(device, coordinator)
|
||||
self._attr_native_min_value = device._config_dict["levels"][0]
|
||||
self._attr_native_max_value = device._config_dict["levels"][-1]
|
||||
self._attr_native_min_value = device.config_dict["levels"][0]
|
||||
self._attr_native_max_value = device.config_dict["levels"][-1]
|
||||
self._attr_native_step = 1
|
||||
|
||||
@property
|
||||
@ -99,7 +99,7 @@ class VeSyncFanSpeedLevelHA(VeSyncNumberEntity):
|
||||
@property
|
||||
def extra_state_attributes(self):
|
||||
"""Return the state attributes of the humidifier."""
|
||||
return {"fan speed levels": self.device._config_dict["levels"]}
|
||||
return {"fan speed levels": self.device.config_dict["levels"]}
|
||||
|
||||
def set_native_value(self, value):
|
||||
"""Set the fan speed level."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user