Skip to content

Commit aaae324

Browse files
cdnninjabramkragten
authored andcommitted
Correct Vesync Humidifier Mode (home-assistant#155638)
1 parent 40ff100 commit aaae324

File tree

12 files changed

+1211
-2
lines changed

12 files changed

+1211
-2
lines changed

homeassistant/components/vesync/humidifier.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
VS_TO_HA_MODE_MAP = {
3939
VS_HUMIDIFIER_MODE_AUTO: MODE_AUTO,
40-
VS_HUMIDIFIER_MODE_HUMIDITY: MODE_AUTO,
40+
VS_HUMIDIFIER_MODE_HUMIDITY: VS_HUMIDIFIER_MODE_HUMIDITY,
4141
VS_HUMIDIFIER_MODE_MANUAL: MODE_NORMAL,
4242
VS_HUMIDIFIER_MODE_SLEEP: MODE_SLEEP,
4343
}
@@ -93,6 +93,8 @@ class VeSyncHumidifierHA(VeSyncBaseEntity, HumidifierEntity):
9393

9494
_attr_supported_features = HumidifierEntityFeature.MODES
9595

96+
_attr_translation_key = "vesync"
97+
9698
def __init__(
9799
self,
98100
device: VeSyncBaseDevice,

homeassistant/components/vesync/strings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@
4949
}
5050
}
5151
},
52+
"humidifier": {
53+
"vesync": {
54+
"state_attributes": {
55+
"mode": {
56+
"state": {
57+
"humidity": "Humidity"
58+
}
59+
}
60+
}
61+
}
62+
},
5263
"number": {
5364
"mist_level": {
5465
"name": "Mist level"

tests/components/vesync/common.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@
7474
("post", "/cloud/v1/deviceManaged/deviceDetail", "dimmer-detail.json")
7575
],
7676
"SmartTowerFan": [("post", "/cloud/v2/deviceManaged/bypassV2", "fan-detail.json")],
77+
"Humidifier 6000s": [
78+
("post", "/cloud/v2/deviceManaged/bypassV2", "humidifier-6000s-detail.json")
79+
],
7780
}
7881

7982

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"traceId": "0",
3+
"code": 0,
4+
"msg": "request success",
5+
"module": null,
6+
"stacktrace": null,
7+
"result": {
8+
"traceId": "0",
9+
"code": 0,
10+
"result": {
11+
"powerSwitch": 1,
12+
"humidity": 36,
13+
"targetHumidity": 40,
14+
"virtualLevel": 1,
15+
"mistLevel": 1,
16+
"workMode": "humidity",
17+
"waterLacksState": 0,
18+
"waterTankLifted": 0,
19+
"autoStopSwitch": 1,
20+
"autoStopState": 1,
21+
"screenSwitch": 0,
22+
"screenState": 0,
23+
"scheduleCount": 0,
24+
"timerRemain": 0,
25+
"errorCode": 0,
26+
"autoPreference": 1,
27+
"childLockSwitch": 1,
28+
"filterLifePercent": 77,
29+
"temperature": 640,
30+
"maxLevelNotify": 0,
31+
"waterShortageDryingSwitch": 1,
32+
"humidityPreference": 1,
33+
"dryingMode": {
34+
"dryingLevel": 1,
35+
"autoDryingSwitch": 1,
36+
"dryingState": 2,
37+
"dryingRemain": 7200
38+
},
39+
"isSupportSensor": 1,
40+
"sensorContent": {
41+
"sensorStatus": "noDevices"
42+
},
43+
"waterPump": {
44+
"cleanStatus": 0,
45+
"remainTime": 0,
46+
"totalTime": 65
47+
},
48+
"lastDryingCompletedTime": 1761850797,
49+
"afterDryLastHumidityTime": 1761883500
50+
}
51+
}
52+
}

tests/components/vesync/fixtures/vesync-devices.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,52 @@
185185
"connectionStatus": "online",
186186
"uuid": "00000000-1111-2222-3333-444444444444",
187187
"configModule": "configModule"
188+
},
189+
{
190+
"deviceRegion": "US",
191+
"isOwner": false,
192+
"authKey": null,
193+
"deviceName": "Humidifier 6000s",
194+
"deviceImg": "https://image.vesync.com/defaultImages/LEH-S601S-WUS/icon_LEH_S601S_WUS_240.png",
195+
"cid": "6000s",
196+
"deviceStatus": null,
197+
"connectionStatus": null,
198+
"connectionType": "WiFi+BTOnboarding+BTNotify",
199+
"deviceType": "LEH-S601S-WUS",
200+
"type": "wifi-air",
201+
"uuid": "00000000-1111-2222-3333-444444444444",
202+
"configModule": "VS_WFON_AHM_LEH-S601S-WUS_US",
203+
"macID": "00:10:f0:aa:bb:cc",
204+
"mode": null,
205+
"speed": null,
206+
"currentFirmVersion": null,
207+
"subDeviceNo": null,
208+
"subDeviceType": null,
209+
"deviceFirstSetupTime": "Jul 26, 2024 3:32:26 AM",
210+
"subDeviceList": null,
211+
"extension": null,
212+
"deviceProp": {
213+
"workMode": "humidity",
214+
"autoPreference": 1,
215+
"dryingState": 2,
216+
"virtualLevel": 5,
217+
"filterLifePercent": 77,
218+
"BTMac": "00:10:f0:aa:bb:cc",
219+
"autoDryingSwitch": 1,
220+
"waterLacksState": 0,
221+
"screenSwitch": 0,
222+
"childLockSwitch": 1,
223+
"humidity": 36,
224+
"wifiRssi": -74,
225+
"dryingLevel": 1,
226+
"targetHumidity": 40,
227+
"humidityPreference": 1,
228+
"powerSwitch": 1,
229+
"waterShortageDryingSwitch": 1,
230+
"connectionStatus": "online",
231+
"wifiMac": "00:10:f0:aa:bb:cc",
232+
"mistLevel": 2
233+
}
188234
}
189235
]
190236
}

tests/components/vesync/snapshots/test_binary_sensor.ambr

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,137 @@
352352
}),
353353
])
354354
# ---
355+
# name: test_sensor_state[Humidifier 6000s][binary_sensor.humidifier_6000s_low_water]
356+
StateSnapshot({
357+
'attributes': ReadOnlyDict({
358+
'device_class': 'problem',
359+
'friendly_name': 'Humidifier 6000s Low water',
360+
}),
361+
'context': <ANY>,
362+
'entity_id': 'binary_sensor.humidifier_6000s_low_water',
363+
'last_changed': <ANY>,
364+
'last_reported': <ANY>,
365+
'last_updated': <ANY>,
366+
'state': 'off',
367+
})
368+
# ---
369+
# name: test_sensor_state[Humidifier 6000s][binary_sensor.humidifier_6000s_water_tank_lifted]
370+
StateSnapshot({
371+
'attributes': ReadOnlyDict({
372+
'device_class': 'problem',
373+
'friendly_name': 'Humidifier 6000s Water tank lifted',
374+
}),
375+
'context': <ANY>,
376+
'entity_id': 'binary_sensor.humidifier_6000s_water_tank_lifted',
377+
'last_changed': <ANY>,
378+
'last_reported': <ANY>,
379+
'last_updated': <ANY>,
380+
'state': 'off',
381+
})
382+
# ---
383+
# name: test_sensor_state[Humidifier 6000s][devices]
384+
list([
385+
DeviceRegistryEntrySnapshot({
386+
'area_id': None,
387+
'config_entries': <ANY>,
388+
'config_entries_subentries': <ANY>,
389+
'configuration_url': None,
390+
'connections': set({
391+
}),
392+
'disabled_by': None,
393+
'entry_type': None,
394+
'hw_version': None,
395+
'id': <ANY>,
396+
'identifiers': set({
397+
tuple(
398+
'vesync',
399+
'6000s',
400+
),
401+
}),
402+
'labels': set({
403+
}),
404+
'manufacturer': 'VeSync',
405+
'model': 'LEH-S601S-WUS',
406+
'model_id': None,
407+
'name': 'Humidifier 6000s',
408+
'name_by_user': None,
409+
'primary_config_entry': <ANY>,
410+
'serial_number': None,
411+
'sw_version': None,
412+
'via_device_id': None,
413+
}),
414+
])
415+
# ---
416+
# name: test_sensor_state[Humidifier 6000s][entities]
417+
list([
418+
EntityRegistryEntrySnapshot({
419+
'aliases': set({
420+
}),
421+
'area_id': None,
422+
'capabilities': None,
423+
'config_entry_id': <ANY>,
424+
'config_subentry_id': <ANY>,
425+
'device_class': None,
426+
'device_id': <ANY>,
427+
'disabled_by': None,
428+
'domain': 'binary_sensor',
429+
'entity_category': None,
430+
'entity_id': 'binary_sensor.humidifier_6000s_low_water',
431+
'has_entity_name': True,
432+
'hidden_by': None,
433+
'icon': None,
434+
'id': <ANY>,
435+
'labels': set({
436+
}),
437+
'name': None,
438+
'options': dict({
439+
}),
440+
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
441+
'original_icon': None,
442+
'original_name': 'Low water',
443+
'platform': 'vesync',
444+
'previous_unique_id': None,
445+
'suggested_object_id': None,
446+
'supported_features': 0,
447+
'translation_key': 'water_lacks',
448+
'unique_id': '6000s-water_lacks',
449+
'unit_of_measurement': None,
450+
}),
451+
EntityRegistryEntrySnapshot({
452+
'aliases': set({
453+
}),
454+
'area_id': None,
455+
'capabilities': None,
456+
'config_entry_id': <ANY>,
457+
'config_subentry_id': <ANY>,
458+
'device_class': None,
459+
'device_id': <ANY>,
460+
'disabled_by': None,
461+
'domain': 'binary_sensor',
462+
'entity_category': None,
463+
'entity_id': 'binary_sensor.humidifier_6000s_water_tank_lifted',
464+
'has_entity_name': True,
465+
'hidden_by': None,
466+
'icon': None,
467+
'id': <ANY>,
468+
'labels': set({
469+
}),
470+
'name': None,
471+
'options': dict({
472+
}),
473+
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
474+
'original_icon': None,
475+
'original_name': 'Water tank lifted',
476+
'platform': 'vesync',
477+
'previous_unique_id': None,
478+
'suggested_object_id': None,
479+
'supported_features': 0,
480+
'translation_key': 'water_tank_lifted',
481+
'unique_id': '6000s-details.water_tank_lifted',
482+
'unit_of_measurement': None,
483+
}),
484+
])
485+
# ---
355486
# name: test_sensor_state[Humidifier 600S][binary_sensor.humidifier_600s_low_water]
356487
StateSnapshot({
357488
'attributes': ReadOnlyDict({

tests/components/vesync/snapshots/test_fan.ambr

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,43 @@
511511
list([
512512
])
513513
# ---
514+
# name: test_fan_state[Humidifier 6000s][devices]
515+
list([
516+
DeviceRegistryEntrySnapshot({
517+
'area_id': None,
518+
'config_entries': <ANY>,
519+
'config_entries_subentries': <ANY>,
520+
'configuration_url': None,
521+
'connections': set({
522+
}),
523+
'disabled_by': None,
524+
'entry_type': None,
525+
'hw_version': None,
526+
'id': <ANY>,
527+
'identifiers': set({
528+
tuple(
529+
'vesync',
530+
'6000s',
531+
),
532+
}),
533+
'labels': set({
534+
}),
535+
'manufacturer': 'VeSync',
536+
'model': 'LEH-S601S-WUS',
537+
'model_id': None,
538+
'name': 'Humidifier 6000s',
539+
'name_by_user': None,
540+
'primary_config_entry': <ANY>,
541+
'serial_number': None,
542+
'sw_version': None,
543+
'via_device_id': None,
544+
}),
545+
])
546+
# ---
547+
# name: test_fan_state[Humidifier 6000s][entities]
548+
list([
549+
])
550+
# ---
514551
# name: test_fan_state[Humidifier 600S][devices]
515552
list([
516553
DeviceRegistryEntrySnapshot({

0 commit comments

Comments
 (0)