Skip to content

Commit

Permalink
Add VeSync support for new devices
Browse files Browse the repository at this point in the history
This adds tests for support of the following VeSync devices:
* Humidifier Classic 300s
* Air Purifier Core 300s
* Outlet ESW01-EU (10A Indoor Round Plug)
* Outlet ESO15-TB (Outdoor Plug)

These devices were all either supported by the VeSync plugin previously
or enabled within the plugin with the changes made in the previous
commits to pull supported devices from the pyvesync module.

This renames the previous "Outlet" test entity to "Outlet 7A" to reflect
the fact that it is no longer the only outlet being tested, but it is
the only 7A outlet currently supported.

A custom API response for the outdoor plug details needed to be added
because it supports sub-devices for the two individual sockets it
controls which requires a new flavor of details response in order for
the pyvesync module to correctly parse the details.
  • Loading branch information
kevin-brown committed Feb 10, 2025
1 parent 418399a commit 6d1ba9a
Show file tree
Hide file tree
Showing 9 changed files with 1,703 additions and 84 deletions.
24 changes: 21 additions & 3 deletions tests/components/vesync/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
"Humidifier 200s": [
("post", "/cloud/v2/deviceManaged/bypassV2", "humidifier-200s.json")
],
"Humidifier 300s": [
("post", "/cloud/v2/deviceManaged/bypassV2", "device-detail.json")
],
"Humidifier 600S": [
("post", "/cloud/v2/deviceManaged/bypassV2", "device-detail.json")
],
Expand All @@ -31,6 +34,9 @@
"Air Purifier 200s": [
("post", "/cloud/v2/deviceManaged/bypassV2", "device-detail.json")
],
"Air Purifier 300s": [
("post", "/cloud/v2/deviceManaged/bypassV2", "device-detail.json")
],
"Air Purifier 400s": [
("post", "/cloud/v2/deviceManaged/bypassV2", "air-purifier-400s-detail.json")
],
Expand All @@ -43,9 +49,21 @@
"Temperature Light": [
("post", "/cloud/v1/deviceManaged/bypass", "device-detail.json")
],
"Outlet": [
("get", "/v1/device/outlet/detail", "outlet-detail.json"),
("get", "/v1/device/outlet/energy/week", "outlet-energy-week.json"),
"Outlet 7A": [
("get", "/v1/device/7a-outlet/detail", "outlet-detail.json"),
("get", "/v1/device/7a-outlet/energy/week", "outlet-energy-week.json"),
],
"Outlet 10A": [
("post", "/10a/v1/device/devicedetail", "outlet-detail.json"),
("post", "/10a/v1/device/energyweek", "outlet-energy-week.json"),
],
"Outlet Outdoor Plug": [
(
"post",
"/outdoorsocket15a/v1/device/devicedetail",
"outlet-outdoor-detail.json",
),
("post", "/outdoorsocket15a/v1/device/energyweek", "outlet-energy-week.json"),
],
"Wall Switch": [
("post", "/inwallswitch/v1/device/devicedetail", "device-detail.json")
Expand Down
1 change: 1 addition & 0 deletions tests/components/vesync/fixtures/outlet-detail.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"code": 0,
"deviceStatus": "on",
"activeTime": 10,
"energy": 100,
Expand Down
25 changes: 25 additions & 0 deletions tests/components/vesync/fixtures/outlet-outdoor-detail.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"code": 0,
"msg": null,
"connectionStatus": "online",
"activeTime": 20,
"energy": 200,
"power": 50,
"voltage": 240,
"deviceStatus": "on",
"deviceName": "Outlet Outdoor Plug",
"subDevices": [
{
"subDeviceNo": 1,
"defaultName": "Socket A",
"subDeviceName": "Outlet Outdoor Plug",
"subDeviceStatus": "on"
},
{
"subDeviceNo": 2,
"defaultName": "Socket B",
"subDeviceName": "Outlet Outdoor Plug",
"subDeviceStatus": "on"
}
]
}
60 changes: 49 additions & 11 deletions tests/components/vesync/fixtures/vesync-devices.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@
"uuid": "00000000-1111-2222-3333-444444444444",
"configModule": "configModule"
},
{
"cid": "300s-humidifier",
"deviceType": "LUH-A601S-WUSB",
"deviceName": "Humidifier 300s",
"subDeviceNo": 4321,
"deviceStatus": "on",
"connectionStatus": "online",
"uuid": "00000000-1111-2222-3333-666666666666",
"configModule": "configModule"
},
{
"cid": "600s-humidifier",
"deviceType": "LUH-A602S-WUS",
Expand Down Expand Up @@ -44,6 +54,16 @@
"connectionStatus": "online",
"configModule": "configModule"
},
{
"cid": "300s-purifier",
"deviceType": "LAP-C301S-WAAA",
"deviceName": "Air Purifier 300s",
"subDeviceNo": null,
"deviceStatus": "on",
"type": "wifi-air",
"connectionStatus": "online",
"configModule": "configModule"
},
{
"cid": "400s-purifier",
"deviceType": "LAP-C401S-WJP",
Expand All @@ -64,6 +84,15 @@
"connectionStatus": "online",
"configModule": "configModule"
},
{
"cid": "smarttowerfan",
"deviceType": "LTF-F422S-KEU",
"deviceName": "SmartTowerFan",
"subDeviceNo": null,
"deviceStatus": "on",
"connectionStatus": "online",
"configModule": "configModule"
},
{
"cid": "dimmable-bulb",
"deviceType": "ESL100",
Expand All @@ -83,36 +112,45 @@
"configModule": "configModule"
},
{
"cid": "outlet",
"cid": "7a-outlet",
"deviceType": "wifi-switch-1.3",
"deviceName": "Outlet",
"deviceName": "Outlet 7A",
"subDeviceNo": null,
"deviceStatus": "on",
"connectionStatus": "online",
"configModule": "configModule"
},
{
"cid": "switch",
"deviceType": "ESWL01",
"deviceName": "Wall Switch",
"cid": "10a-outlet",
"deviceType": "ESW01-EU",
"deviceName": "Outlet 10A",
"subDeviceNo": null,
"deviceStatus": "on",
"connectionStatus": "online",
"configModule": "configModule"
},
{
"cid": "dimmable-switch",
"deviceType": "ESWD16",
"deviceName": "Dimmer Switch",
"cid": "outdoor-outlet",
"deviceType": "ESO15-TB",
"deviceName": "Outlet Outdoor Plug",
"subDeviceNo": 1,
"deviceStatus": "on",
"connectionStatus": "online",
"configModule": "configModule"
},
{
"cid": "switch",
"deviceType": "ESWL01",
"deviceName": "Wall Switch",
"subDeviceNo": null,
"deviceStatus": "on",
"connectionStatus": "online",
"configModule": "configModule"
},
{
"cid": "smarttowerfan",
"deviceType": "LTF-F422S-KEU",
"deviceName": "SmartTowerFan",
"cid": "dimmable-switch",
"deviceType": "ESWD16",
"deviceName": "Dimmer Switch",
"subDeviceNo": null,
"deviceStatus": "on",
"connectionStatus": "online",
Expand Down
Loading

0 comments on commit 6d1ba9a

Please sign in to comment.