mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 00:07:10 +00:00
Add SmartTowerFan to VeSync Integration (#136596)
This commit is contained in:
parent
e9ef82f898
commit
661bacda10
@ -48,6 +48,7 @@ DEV_TYPE_TO_HA = {
|
||||
"EverestAir": "fan",
|
||||
"Vital200S": "fan",
|
||||
"Vital100S": "fan",
|
||||
"SmartTowerFan": "fan",
|
||||
"ESD16": "walldimmer",
|
||||
"ESWD16": "walldimmer",
|
||||
"ESL100": "bulb-dimmable",
|
||||
@ -91,4 +92,9 @@ SKU_TO_BASE_DEVICE = {
|
||||
"LAP-EL551S-AEUR": "EverestAir", # Alt ID Model EverestAir
|
||||
"LAP-EL551S-WEU": "EverestAir", # Alt ID Model EverestAir
|
||||
"LAP-EL551S-WUS": "EverestAir", # Alt ID Model EverestAir
|
||||
"SmartTowerFan": "SmartTowerFan",
|
||||
"LTF-F422S-KEU": "SmartTowerFan", # Alt ID Model SmartTowerFan
|
||||
"LTF-F422S-WUSR": "SmartTowerFan", # Alt ID Model SmartTowerFan
|
||||
"LTF-F422_WJP": "SmartTowerFan", # Alt ID Model SmartTowerFan
|
||||
"LTF-F422S-WUS": "SmartTowerFan", # Alt ID Model SmartTowerFan
|
||||
}
|
||||
|
@ -36,6 +36,9 @@ FAN_MODE_AUTO = "auto"
|
||||
FAN_MODE_SLEEP = "sleep"
|
||||
FAN_MODE_PET = "pet"
|
||||
FAN_MODE_TURBO = "turbo"
|
||||
FAN_MODE_ADVANCED_SLEEP = "advancedSleep"
|
||||
FAN_MODE_NORMAL = "normal"
|
||||
|
||||
|
||||
PRESET_MODES = {
|
||||
"LV-PUR131S": [FAN_MODE_AUTO, FAN_MODE_SLEEP],
|
||||
@ -46,6 +49,12 @@ PRESET_MODES = {
|
||||
"EverestAir": [FAN_MODE_AUTO, FAN_MODE_SLEEP, FAN_MODE_TURBO],
|
||||
"Vital200S": [FAN_MODE_AUTO, FAN_MODE_SLEEP, FAN_MODE_PET],
|
||||
"Vital100S": [FAN_MODE_AUTO, FAN_MODE_SLEEP, FAN_MODE_PET],
|
||||
"SmartTowerFan": [
|
||||
FAN_MODE_ADVANCED_SLEEP,
|
||||
FAN_MODE_AUTO,
|
||||
FAN_MODE_TURBO,
|
||||
FAN_MODE_NORMAL,
|
||||
],
|
||||
}
|
||||
SPEED_RANGE = { # off is not included
|
||||
"LV-PUR131S": (1, 3),
|
||||
@ -56,6 +65,7 @@ SPEED_RANGE = { # off is not included
|
||||
"EverestAir": (1, 3),
|
||||
"Vital200S": (1, 4),
|
||||
"Vital100S": (1, 4),
|
||||
"SmartTowerFan": (1, 13),
|
||||
}
|
||||
|
||||
|
||||
@ -212,10 +222,14 @@ class VeSyncFanHA(VeSyncBaseEntity, FanEntity):
|
||||
self.smartfan.auto_mode()
|
||||
elif preset_mode == FAN_MODE_SLEEP:
|
||||
self.smartfan.sleep_mode()
|
||||
elif preset_mode == FAN_MODE_ADVANCED_SLEEP:
|
||||
self.smartfan.advanced_sleep_mode()
|
||||
elif preset_mode == FAN_MODE_PET:
|
||||
self.smartfan.pet_mode()
|
||||
elif preset_mode == FAN_MODE_TURBO:
|
||||
self.smartfan.turbo_mode()
|
||||
elif preset_mode == FAN_MODE_NORMAL:
|
||||
self.smartfan.normal_mode()
|
||||
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
"state": {
|
||||
"auto": "mdi:fan-auto",
|
||||
"sleep": "mdi:sleep",
|
||||
"advanced_sleep": "mdi:sleep",
|
||||
"pet": "mdi:paw",
|
||||
"turbo": "mdi:weather-tornado"
|
||||
}
|
||||
|
@ -55,6 +55,7 @@
|
||||
"state": {
|
||||
"auto": "Auto",
|
||||
"sleep": "Sleep",
|
||||
"advanced_sleep": "Advanced sleep",
|
||||
"pet": "Pet",
|
||||
"turbo": "Turbo"
|
||||
}
|
||||
|
@ -51,6 +51,9 @@ DEVICE_FIXTURES: dict[str, list[tuple[str, str, str]]] = {
|
||||
("post", "/inwallswitch/v1/device/devicedetail", "device-detail.json")
|
||||
],
|
||||
"Dimmer Switch": [("post", "/dimmer/v1/device/devicedetail", "dimmer-detail.json")],
|
||||
"SmartTowerFan": [
|
||||
("post", "/cloud/v2/deviceManaged/bypassV2", "SmartTowerFan-detail.json")
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
|
37
tests/components/vesync/fixtures/SmartTowerFan-detail.json
Normal file
37
tests/components/vesync/fixtures/SmartTowerFan-detail.json
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"traceId": "0000000000",
|
||||
"code": 0,
|
||||
"msg": "request success",
|
||||
"module": null,
|
||||
"stacktrace": null,
|
||||
"result": {
|
||||
"traceId": "0000000000",
|
||||
"code": 0,
|
||||
"result": {
|
||||
"powerSwitch": 0,
|
||||
"workMode": "normal",
|
||||
"manualSpeedLevel": 1,
|
||||
"fanSpeedLevel": 0,
|
||||
"screenState": 0,
|
||||
"screenSwitch": 0,
|
||||
"oscillationSwitch": 1,
|
||||
"oscillationState": 1,
|
||||
"muteSwitch": 1,
|
||||
"muteState": 1,
|
||||
"timerRemain": 0,
|
||||
"temperature": 717,
|
||||
"humidity": 40,
|
||||
"thermalComfort": 65,
|
||||
"errorCode": 0,
|
||||
"sleepPreference": {
|
||||
"sleepPreferenceType": "default",
|
||||
"oscillationSwitch": 0,
|
||||
"initFanSpeedLevel": 0,
|
||||
"fallAsleepRemain": 0,
|
||||
"autoChangeFanLevelSwitch": 0
|
||||
},
|
||||
"scheduleCount": 0,
|
||||
"displayingType": 0
|
||||
}
|
||||
}
|
||||
}
|
@ -108,6 +108,15 @@
|
||||
"deviceStatus": "on",
|
||||
"connectionStatus": "online",
|
||||
"configModule": "configModule"
|
||||
},
|
||||
{
|
||||
"cid": "smarttowerfan",
|
||||
"deviceType": "LTF-F422S-KEU",
|
||||
"deviceName": "SmartTowerFan",
|
||||
"subDeviceNo": null,
|
||||
"deviceStatus": "on",
|
||||
"connectionStatus": "online",
|
||||
"configModule": "configModule"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -576,6 +576,109 @@
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_fan_state[SmartTowerFan][devices]
|
||||
list([
|
||||
DeviceRegistryEntrySnapshot({
|
||||
'area_id': None,
|
||||
'config_entries': <ANY>,
|
||||
'configuration_url': None,
|
||||
'connections': set({
|
||||
}),
|
||||
'disabled_by': None,
|
||||
'entry_type': None,
|
||||
'hw_version': None,
|
||||
'id': <ANY>,
|
||||
'identifiers': set({
|
||||
tuple(
|
||||
'vesync',
|
||||
'smarttowerfan',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'LTF-F422S-KEU',
|
||||
'model_id': None,
|
||||
'name': 'SmartTowerFan',
|
||||
'name_by_user': None,
|
||||
'primary_config_entry': <ANY>,
|
||||
'serial_number': None,
|
||||
'suggested_area': None,
|
||||
'sw_version': None,
|
||||
'via_device_id': None,
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_fan_state[SmartTowerFan][entities]
|
||||
list([
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'preset_modes': list([
|
||||
'advancedSleep',
|
||||
'auto',
|
||||
'turbo',
|
||||
'normal',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'fan',
|
||||
'entity_category': None,
|
||||
'entity_id': 'fan.smarttowerfan',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': None,
|
||||
'platform': 'vesync',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': <FanEntityFeature: 57>,
|
||||
'translation_key': 'vesync',
|
||||
'unique_id': 'smarttowerfan',
|
||||
'unit_of_measurement': None,
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_fan_state[SmartTowerFan][fan.smarttowerfan]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'child_lock': False,
|
||||
'friendly_name': 'SmartTowerFan',
|
||||
'mode': 'normal',
|
||||
'night_light': 'off',
|
||||
'percentage': None,
|
||||
'percentage_step': 7.6923076923076925,
|
||||
'preset_mode': None,
|
||||
'preset_modes': list([
|
||||
'advancedSleep',
|
||||
'auto',
|
||||
'turbo',
|
||||
'normal',
|
||||
]),
|
||||
'screen_status': False,
|
||||
'supported_features': <FanEntityFeature: 57>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'fan.smarttowerfan',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_fan_state[Temperature Light][devices]
|
||||
list([
|
||||
DeviceRegistryEntrySnapshot({
|
||||
|
@ -447,6 +447,44 @@
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_light_state[SmartTowerFan][devices]
|
||||
list([
|
||||
DeviceRegistryEntrySnapshot({
|
||||
'area_id': None,
|
||||
'config_entries': <ANY>,
|
||||
'configuration_url': None,
|
||||
'connections': set({
|
||||
}),
|
||||
'disabled_by': None,
|
||||
'entry_type': None,
|
||||
'hw_version': None,
|
||||
'id': <ANY>,
|
||||
'identifiers': set({
|
||||
tuple(
|
||||
'vesync',
|
||||
'smarttowerfan',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'LTF-F422S-KEU',
|
||||
'model_id': None,
|
||||
'name': 'SmartTowerFan',
|
||||
'name_by_user': None,
|
||||
'primary_config_entry': <ANY>,
|
||||
'serial_number': None,
|
||||
'suggested_area': None,
|
||||
'sw_version': None,
|
||||
'via_device_id': None,
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_light_state[SmartTowerFan][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_light_state[Temperature Light][devices]
|
||||
list([
|
||||
DeviceRegistryEntrySnapshot({
|
||||
|
@ -1155,6 +1155,44 @@
|
||||
'state': '0',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor_state[SmartTowerFan][devices]
|
||||
list([
|
||||
DeviceRegistryEntrySnapshot({
|
||||
'area_id': None,
|
||||
'config_entries': <ANY>,
|
||||
'configuration_url': None,
|
||||
'connections': set({
|
||||
}),
|
||||
'disabled_by': None,
|
||||
'entry_type': None,
|
||||
'hw_version': None,
|
||||
'id': <ANY>,
|
||||
'identifiers': set({
|
||||
tuple(
|
||||
'vesync',
|
||||
'smarttowerfan',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'LTF-F422S-KEU',
|
||||
'model_id': None,
|
||||
'name': 'SmartTowerFan',
|
||||
'name_by_user': None,
|
||||
'primary_config_entry': <ANY>,
|
||||
'serial_number': None,
|
||||
'suggested_area': None,
|
||||
'sw_version': None,
|
||||
'via_device_id': None,
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_sensor_state[SmartTowerFan][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_sensor_state[Temperature Light][devices]
|
||||
list([
|
||||
DeviceRegistryEntrySnapshot({
|
||||
|
@ -385,6 +385,44 @@
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_switch_state[SmartTowerFan][devices]
|
||||
list([
|
||||
DeviceRegistryEntrySnapshot({
|
||||
'area_id': None,
|
||||
'config_entries': <ANY>,
|
||||
'configuration_url': None,
|
||||
'connections': set({
|
||||
}),
|
||||
'disabled_by': None,
|
||||
'entry_type': None,
|
||||
'hw_version': None,
|
||||
'id': <ANY>,
|
||||
'identifiers': set({
|
||||
tuple(
|
||||
'vesync',
|
||||
'smarttowerfan',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'LTF-F422S-KEU',
|
||||
'model_id': None,
|
||||
'name': 'SmartTowerFan',
|
||||
'name_by_user': None,
|
||||
'primary_config_entry': <ANY>,
|
||||
'serial_number': None,
|
||||
'suggested_area': None,
|
||||
'sw_version': None,
|
||||
'via_device_id': None,
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_switch_state[SmartTowerFan][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_switch_state[Temperature Light][devices]
|
||||
list([
|
||||
DeviceRegistryEntrySnapshot({
|
||||
|
Loading…
x
Reference in New Issue
Block a user