Add SmartTowerFan to VeSync Integration (#136596)

This commit is contained in:
cdnninja 2025-01-28 09:34:25 -07:00 committed by GitHub
parent e9ef82f898
commit 661bacda10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 288 additions and 0 deletions

View File

@ -48,6 +48,7 @@ DEV_TYPE_TO_HA = {
"EverestAir": "fan", "EverestAir": "fan",
"Vital200S": "fan", "Vital200S": "fan",
"Vital100S": "fan", "Vital100S": "fan",
"SmartTowerFan": "fan",
"ESD16": "walldimmer", "ESD16": "walldimmer",
"ESWD16": "walldimmer", "ESWD16": "walldimmer",
"ESL100": "bulb-dimmable", "ESL100": "bulb-dimmable",
@ -91,4 +92,9 @@ SKU_TO_BASE_DEVICE = {
"LAP-EL551S-AEUR": "EverestAir", # Alt ID Model EverestAir "LAP-EL551S-AEUR": "EverestAir", # Alt ID Model EverestAir
"LAP-EL551S-WEU": "EverestAir", # Alt ID Model EverestAir "LAP-EL551S-WEU": "EverestAir", # Alt ID Model EverestAir
"LAP-EL551S-WUS": "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
} }

View File

@ -36,6 +36,9 @@ FAN_MODE_AUTO = "auto"
FAN_MODE_SLEEP = "sleep" FAN_MODE_SLEEP = "sleep"
FAN_MODE_PET = "pet" FAN_MODE_PET = "pet"
FAN_MODE_TURBO = "turbo" FAN_MODE_TURBO = "turbo"
FAN_MODE_ADVANCED_SLEEP = "advancedSleep"
FAN_MODE_NORMAL = "normal"
PRESET_MODES = { PRESET_MODES = {
"LV-PUR131S": [FAN_MODE_AUTO, FAN_MODE_SLEEP], "LV-PUR131S": [FAN_MODE_AUTO, FAN_MODE_SLEEP],
@ -46,6 +49,12 @@ PRESET_MODES = {
"EverestAir": [FAN_MODE_AUTO, FAN_MODE_SLEEP, FAN_MODE_TURBO], "EverestAir": [FAN_MODE_AUTO, FAN_MODE_SLEEP, FAN_MODE_TURBO],
"Vital200S": [FAN_MODE_AUTO, FAN_MODE_SLEEP, FAN_MODE_PET], "Vital200S": [FAN_MODE_AUTO, FAN_MODE_SLEEP, FAN_MODE_PET],
"Vital100S": [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 SPEED_RANGE = { # off is not included
"LV-PUR131S": (1, 3), "LV-PUR131S": (1, 3),
@ -56,6 +65,7 @@ SPEED_RANGE = { # off is not included
"EverestAir": (1, 3), "EverestAir": (1, 3),
"Vital200S": (1, 4), "Vital200S": (1, 4),
"Vital100S": (1, 4), "Vital100S": (1, 4),
"SmartTowerFan": (1, 13),
} }
@ -212,10 +222,14 @@ class VeSyncFanHA(VeSyncBaseEntity, FanEntity):
self.smartfan.auto_mode() self.smartfan.auto_mode()
elif preset_mode == FAN_MODE_SLEEP: elif preset_mode == FAN_MODE_SLEEP:
self.smartfan.sleep_mode() self.smartfan.sleep_mode()
elif preset_mode == FAN_MODE_ADVANCED_SLEEP:
self.smartfan.advanced_sleep_mode()
elif preset_mode == FAN_MODE_PET: elif preset_mode == FAN_MODE_PET:
self.smartfan.pet_mode() self.smartfan.pet_mode()
elif preset_mode == FAN_MODE_TURBO: elif preset_mode == FAN_MODE_TURBO:
self.smartfan.turbo_mode() self.smartfan.turbo_mode()
elif preset_mode == FAN_MODE_NORMAL:
self.smartfan.normal_mode()
self.schedule_update_ha_state() self.schedule_update_ha_state()

View File

@ -7,6 +7,7 @@
"state": { "state": {
"auto": "mdi:fan-auto", "auto": "mdi:fan-auto",
"sleep": "mdi:sleep", "sleep": "mdi:sleep",
"advanced_sleep": "mdi:sleep",
"pet": "mdi:paw", "pet": "mdi:paw",
"turbo": "mdi:weather-tornado" "turbo": "mdi:weather-tornado"
} }

View File

@ -55,6 +55,7 @@
"state": { "state": {
"auto": "Auto", "auto": "Auto",
"sleep": "Sleep", "sleep": "Sleep",
"advanced_sleep": "Advanced sleep",
"pet": "Pet", "pet": "Pet",
"turbo": "Turbo" "turbo": "Turbo"
} }

View File

@ -51,6 +51,9 @@ DEVICE_FIXTURES: dict[str, list[tuple[str, str, str]]] = {
("post", "/inwallswitch/v1/device/devicedetail", "device-detail.json") ("post", "/inwallswitch/v1/device/devicedetail", "device-detail.json")
], ],
"Dimmer Switch": [("post", "/dimmer/v1/device/devicedetail", "dimmer-detail.json")], "Dimmer Switch": [("post", "/dimmer/v1/device/devicedetail", "dimmer-detail.json")],
"SmartTowerFan": [
("post", "/cloud/v2/deviceManaged/bypassV2", "SmartTowerFan-detail.json")
],
} }

View 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
}
}
}

View File

@ -108,6 +108,15 @@
"deviceStatus": "on", "deviceStatus": "on",
"connectionStatus": "online", "connectionStatus": "online",
"configModule": "configModule" "configModule": "configModule"
},
{
"cid": "smarttowerfan",
"deviceType": "LTF-F422S-KEU",
"deviceName": "SmartTowerFan",
"subDeviceNo": null,
"deviceStatus": "on",
"connectionStatus": "online",
"configModule": "configModule"
} }
] ]
} }

View File

@ -576,6 +576,109 @@
list([ 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] # name: test_fan_state[Temperature Light][devices]
list([ list([
DeviceRegistryEntrySnapshot({ DeviceRegistryEntrySnapshot({

View File

@ -447,6 +447,44 @@
list([ 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] # name: test_light_state[Temperature Light][devices]
list([ list([
DeviceRegistryEntrySnapshot({ DeviceRegistryEntrySnapshot({

View File

@ -1155,6 +1155,44 @@
'state': '0', '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] # name: test_sensor_state[Temperature Light][devices]
list([ list([
DeviceRegistryEntrySnapshot({ DeviceRegistryEntrySnapshot({

View File

@ -385,6 +385,44 @@
'state': 'on', '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] # name: test_switch_state[Temperature Light][devices]
list([ list([
DeviceRegistryEntrySnapshot({ DeviceRegistryEntrySnapshot({