init home-assistant
This commit is contained in:
1
home-assistant/tests/components/vesync/__init__.py
Normal file
1
home-assistant/tests/components/vesync/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Tests for VeSync Component."""
|
||||
136
home-assistant/tests/components/vesync/common.py
Normal file
136
home-assistant/tests/components/vesync/common.py
Normal file
@@ -0,0 +1,136 @@
|
||||
"""Common methods used across tests for VeSync."""
|
||||
|
||||
import json
|
||||
|
||||
import requests_mock
|
||||
|
||||
from homeassistant.components.vesync.const import DOMAIN
|
||||
|
||||
from tests.common import load_fixture, load_json_object_fixture
|
||||
|
||||
ALL_DEVICES = load_json_object_fixture("vesync-devices.json", DOMAIN)
|
||||
ALL_DEVICE_NAMES: list[str] = [
|
||||
dev["deviceName"] for dev in ALL_DEVICES["result"]["list"]
|
||||
]
|
||||
DEVICE_FIXTURES: dict[str, list[tuple[str, str, str]]] = {
|
||||
"Humidifier 200s": [
|
||||
("post", "/cloud/v2/deviceManaged/bypassV2", "device-detail.json")
|
||||
],
|
||||
"Humidifier 600S": [
|
||||
("post", "/cloud/v2/deviceManaged/bypassV2", "device-detail.json")
|
||||
],
|
||||
"Air Purifier 131s": [
|
||||
("post", "/131airPurifier/v1/device/deviceDetail", "purifier-detail.json")
|
||||
],
|
||||
"Air Purifier 200s": [
|
||||
("post", "/cloud/v2/deviceManaged/bypassV2", "device-detail.json")
|
||||
],
|
||||
"Air Purifier 400s": [
|
||||
("post", "/cloud/v2/deviceManaged/bypassV2", "device-detail.json")
|
||||
],
|
||||
"Air Purifier 600s": [
|
||||
("post", "/cloud/v2/deviceManaged/bypassV2", "device-detail.json")
|
||||
],
|
||||
"Dimmable Light": [
|
||||
("post", "/SmartBulb/v1/device/devicedetail", "device-detail.json")
|
||||
],
|
||||
"Temperature Light": [
|
||||
("post", "/cloud/v1/deviceManaged/bypass", "device-detail.json")
|
||||
],
|
||||
"Outlet": [("get", "/v1/device/outlet/detail", "outlet-detail.json")],
|
||||
"Wall Switch": [
|
||||
("post", "/inwallswitch/v1/device/devicedetail", "device-detail.json")
|
||||
],
|
||||
"Dimmer Switch": [("post", "/dimmer/v1/device/devicedetail", "dimmer-detail.json")],
|
||||
}
|
||||
|
||||
|
||||
def mock_devices_response(
|
||||
requests_mock: requests_mock.Mocker, device_name: str
|
||||
) -> None:
|
||||
"""Build a response for the Helpers.call_api method."""
|
||||
device_list = [
|
||||
device
|
||||
for device in ALL_DEVICES["result"]["list"]
|
||||
if device["deviceName"] == device_name
|
||||
]
|
||||
|
||||
requests_mock.post(
|
||||
"https://smartapi.vesync.com/cloud/v1/deviceManaged/devices",
|
||||
json={"code": 0, "result": {"list": device_list}},
|
||||
)
|
||||
requests_mock.post(
|
||||
"https://smartapi.vesync.com/cloud/v1/user/login",
|
||||
json=load_json_object_fixture("vesync-login.json", DOMAIN),
|
||||
)
|
||||
for fixture in DEVICE_FIXTURES[device_name]:
|
||||
requests_mock.request(
|
||||
fixture[0],
|
||||
f"https://smartapi.vesync.com{fixture[1]}",
|
||||
json=load_json_object_fixture(fixture[2], DOMAIN),
|
||||
)
|
||||
|
||||
|
||||
def call_api_side_effect__no_devices(*args, **kwargs):
|
||||
"""Build a side_effects method for the Helpers.call_api method."""
|
||||
if args[0] == "/cloud/v1/user/login" and args[1] == "post":
|
||||
return json.loads(load_fixture("vesync_api_call__login.json", "vesync")), 200
|
||||
if args[0] == "/cloud/v1/deviceManaged/devices" and args[1] == "post":
|
||||
return (
|
||||
json.loads(
|
||||
load_fixture("vesync_api_call__devices__no_devices.json", "vesync")
|
||||
),
|
||||
200,
|
||||
)
|
||||
raise ValueError(f"Unhandled API call args={args}, kwargs={kwargs}")
|
||||
|
||||
|
||||
def call_api_side_effect__single_humidifier(*args, **kwargs):
|
||||
"""Build a side_effects method for the Helpers.call_api method."""
|
||||
if args[0] == "/cloud/v1/user/login" and args[1] == "post":
|
||||
return json.loads(load_fixture("vesync_api_call__login.json", "vesync")), 200
|
||||
if args[0] == "/cloud/v1/deviceManaged/devices" and args[1] == "post":
|
||||
return (
|
||||
json.loads(
|
||||
load_fixture(
|
||||
"vesync_api_call__devices__single_humidifier.json", "vesync"
|
||||
)
|
||||
),
|
||||
200,
|
||||
)
|
||||
if args[0] == "/cloud/v2/deviceManaged/bypassV2" and kwargs["method"] == "post":
|
||||
return (
|
||||
json.loads(
|
||||
load_fixture(
|
||||
"vesync_api_call__device_details__single_humidifier.json", "vesync"
|
||||
)
|
||||
),
|
||||
200,
|
||||
)
|
||||
raise ValueError(f"Unhandled API call args={args}, kwargs={kwargs}")
|
||||
|
||||
|
||||
def call_api_side_effect__single_fan(*args, **kwargs):
|
||||
"""Build a side_effects method for the Helpers.call_api method."""
|
||||
if args[0] == "/cloud/v1/user/login" and args[1] == "post":
|
||||
return json.loads(load_fixture("vesync_api_call__login.json", "vesync")), 200
|
||||
if args[0] == "/cloud/v1/deviceManaged/devices" and args[1] == "post":
|
||||
return (
|
||||
json.loads(
|
||||
load_fixture("vesync_api_call__devices__single_fan.json", "vesync")
|
||||
),
|
||||
200,
|
||||
)
|
||||
if (
|
||||
args[0] == "/131airPurifier/v1/device/deviceDetail"
|
||||
and kwargs["method"] == "post"
|
||||
):
|
||||
return (
|
||||
json.loads(
|
||||
load_fixture(
|
||||
"vesync_api_call__device_details__single_fan.json", "vesync"
|
||||
)
|
||||
),
|
||||
200,
|
||||
)
|
||||
raise ValueError(f"Unhandled API call args={args}, kwargs={kwargs}")
|
||||
102
home-assistant/tests/components/vesync/conftest.py
Normal file
102
home-assistant/tests/components/vesync/conftest.py
Normal file
@@ -0,0 +1,102 @@
|
||||
"""Configuration for VeSync tests."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
from pyvesync import VeSync
|
||||
from pyvesync.vesyncbulb import VeSyncBulb
|
||||
from pyvesync.vesyncfan import VeSyncAirBypass
|
||||
from pyvesync.vesyncoutlet import VeSyncOutlet
|
||||
from pyvesync.vesyncswitch import VeSyncSwitch
|
||||
|
||||
from homeassistant.components.vesync import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.fixture(name="config_entry")
|
||||
def config_entry_fixture(hass: HomeAssistant, config) -> ConfigEntry:
|
||||
"""Create a mock VeSync config entry."""
|
||||
entry = MockConfigEntry(
|
||||
title="VeSync",
|
||||
domain=DOMAIN,
|
||||
data=config[DOMAIN],
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
return entry
|
||||
|
||||
|
||||
@pytest.fixture(name="config")
|
||||
def config_fixture() -> ConfigType:
|
||||
"""Create hass config fixture."""
|
||||
return {DOMAIN: {CONF_USERNAME: "user", CONF_PASSWORD: "pass"}}
|
||||
|
||||
|
||||
@pytest.fixture(name="manager")
|
||||
def manager_fixture() -> VeSync:
|
||||
"""Create a mock VeSync manager fixture."""
|
||||
|
||||
outlets = []
|
||||
switches = []
|
||||
fans = []
|
||||
bulbs = []
|
||||
|
||||
mock_vesync = Mock(VeSync)
|
||||
mock_vesync.login = Mock(return_value=True)
|
||||
mock_vesync.update = Mock()
|
||||
mock_vesync.outlets = outlets
|
||||
mock_vesync.switches = switches
|
||||
mock_vesync.fans = fans
|
||||
mock_vesync.bulbs = bulbs
|
||||
mock_vesync._dev_list = {
|
||||
"fans": fans,
|
||||
"outlets": outlets,
|
||||
"switches": switches,
|
||||
"bulbs": bulbs,
|
||||
}
|
||||
mock_vesync.account_id = "account_id"
|
||||
mock_vesync.time_zone = "America/New_York"
|
||||
mock = Mock(return_value=mock_vesync)
|
||||
|
||||
with patch("homeassistant.components.vesync.VeSync", new=mock):
|
||||
yield mock_vesync
|
||||
|
||||
|
||||
@pytest.fixture(name="fan")
|
||||
def fan_fixture():
|
||||
"""Create a mock VeSync fan fixture."""
|
||||
return Mock(VeSyncAirBypass)
|
||||
|
||||
|
||||
@pytest.fixture(name="bulb")
|
||||
def bulb_fixture():
|
||||
"""Create a mock VeSync bulb fixture."""
|
||||
return Mock(VeSyncBulb)
|
||||
|
||||
|
||||
@pytest.fixture(name="switch")
|
||||
def switch_fixture():
|
||||
"""Create a mock VeSync switch fixture."""
|
||||
mock_fixture = Mock(VeSyncSwitch)
|
||||
mock_fixture.is_dimmable = Mock(return_value=False)
|
||||
return mock_fixture
|
||||
|
||||
|
||||
@pytest.fixture(name="dimmable_switch")
|
||||
def dimmable_switch_fixture():
|
||||
"""Create a mock VeSync switch fixture."""
|
||||
mock_fixture = Mock(VeSyncSwitch)
|
||||
mock_fixture.is_dimmable = Mock(return_value=True)
|
||||
return mock_fixture
|
||||
|
||||
|
||||
@pytest.fixture(name="outlet")
|
||||
def outlet_fixture():
|
||||
"""Create a mock VeSync outlet fixture."""
|
||||
return Mock(VeSyncOutlet)
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"code": 0,
|
||||
"brightNess": "50",
|
||||
"result": {
|
||||
"light": {
|
||||
"brightness": 50,
|
||||
"colorTempe": 5400
|
||||
},
|
||||
"result": {
|
||||
"brightness": 50,
|
||||
"red": 178.5,
|
||||
"green": 255,
|
||||
"blue": 25.5,
|
||||
"colorMode": "rgb",
|
||||
|
||||
"humidity": 35,
|
||||
"mist_virtual_level": 6,
|
||||
"mode": "manual",
|
||||
"water_lacks": true,
|
||||
"water_tank_lifted": true,
|
||||
"automatic_stop_reach_target": true,
|
||||
"night_light_brightness": 10,
|
||||
|
||||
"enabled": true,
|
||||
"filter_life": 99,
|
||||
"level": 1,
|
||||
"display": true,
|
||||
"display_forever": false,
|
||||
"child_lock": false,
|
||||
"night_light": "off",
|
||||
"air_quality": 5,
|
||||
"air_quality_value": 1,
|
||||
|
||||
"configuration": {
|
||||
"auto_target_humidity": 40,
|
||||
"display": true,
|
||||
"automatic_stop": true
|
||||
}
|
||||
},
|
||||
"code": 0
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"code": 0,
|
||||
"deviceStatus": "on",
|
||||
"activeTime": 100,
|
||||
"brightness": 50,
|
||||
"rgbStatus": "on",
|
||||
"indicatorlightStatus": "on"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"deviceStatus": "on",
|
||||
"activeTime": 10,
|
||||
"energy": 100,
|
||||
"power": 25,
|
||||
"voltage": 120
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"code": 0,
|
||||
"deviceStatus": "on",
|
||||
"activeTime": 50,
|
||||
"filterLife": 90,
|
||||
"screenStatus": "on",
|
||||
"mode": "auto",
|
||||
"level": 2,
|
||||
"airQuality": 95
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
{
|
||||
"code": 0,
|
||||
"result": {
|
||||
"list": [
|
||||
{
|
||||
"cid": "200s-humidifier",
|
||||
"deviceType": "Classic200S",
|
||||
"deviceName": "Humidifier 200s",
|
||||
"subDeviceNo": null,
|
||||
"deviceStatus": "on",
|
||||
"connectionStatus": "online",
|
||||
"uuid": "00000000-1111-2222-3333-444444444444"
|
||||
},
|
||||
{
|
||||
"cid": "600s-humidifier",
|
||||
"deviceType": "LUH-A602S-WUS",
|
||||
"deviceName": "Humidifier 600S",
|
||||
"subDeviceNo": null,
|
||||
"deviceStatus": "off",
|
||||
"connectionStatus": "online",
|
||||
"uuid": "00000000-1111-2222-3333-555555555555",
|
||||
"deviceImg": "https://image.vesync.com/defaultImages/LV_600S_Series/icon_lv600s_humidifier_160.png",
|
||||
"configModule": "WFON_AHM_LUH-A602S-WUS_US",
|
||||
"currentFirmVersion": null,
|
||||
"subDeviceType": null
|
||||
},
|
||||
{
|
||||
"cid": "air-purifier",
|
||||
"deviceType": "LV-PUR131S",
|
||||
"deviceName": "Air Purifier 131s",
|
||||
"subDeviceNo": null,
|
||||
"deviceStatus": "on",
|
||||
"connectionStatus": "online"
|
||||
},
|
||||
{
|
||||
"cid": "asd_sdfKIHG7IJHGwJGJ7GJ_ag5h3G55",
|
||||
"deviceType": "Core200S",
|
||||
"deviceName": "Air Purifier 200s",
|
||||
"subDeviceNo": null,
|
||||
"deviceStatus": "on",
|
||||
"type": "wifi-air",
|
||||
"connectionStatus": "online"
|
||||
},
|
||||
{
|
||||
"cid": "400s-purifier",
|
||||
"deviceType": "LAP-C401S-WJP",
|
||||
"deviceName": "Air Purifier 400s",
|
||||
"subDeviceNo": null,
|
||||
"deviceStatus": "on",
|
||||
"type": "wifi-air",
|
||||
"connectionStatus": "online"
|
||||
},
|
||||
{
|
||||
"cid": "600s-purifier",
|
||||
"deviceType": "LAP-C601S-WUS",
|
||||
"deviceName": "Air Purifier 600s",
|
||||
"subDeviceNo": null,
|
||||
"type": "wifi-air",
|
||||
"deviceStatus": "on",
|
||||
"connectionStatus": "online"
|
||||
},
|
||||
{
|
||||
"cid": "dimmable-bulb",
|
||||
"deviceType": "ESL100",
|
||||
"deviceName": "Dimmable Light",
|
||||
"subDeviceNo": null,
|
||||
"deviceStatus": "on",
|
||||
"connectionStatus": "online"
|
||||
},
|
||||
{
|
||||
"cid": "tunable-bulb",
|
||||
"deviceType": "ESL100CW",
|
||||
"deviceName": "Temperature Light",
|
||||
"subDeviceNo": null,
|
||||
"deviceStatus": "on",
|
||||
"connectionStatus": "online"
|
||||
},
|
||||
{
|
||||
"cid": "outlet",
|
||||
"deviceType": "wifi-switch-1.3",
|
||||
"deviceName": "Outlet",
|
||||
"subDeviceNo": null,
|
||||
"deviceStatus": "on",
|
||||
"connectionStatus": "online"
|
||||
},
|
||||
{
|
||||
"cid": "switch",
|
||||
"deviceType": "ESWL01",
|
||||
"deviceName": "Wall Switch",
|
||||
"subDeviceNo": null,
|
||||
"deviceStatus": "on",
|
||||
"connectionStatus": "online"
|
||||
},
|
||||
{
|
||||
"cid": "dimmable-switch",
|
||||
"deviceType": "ESWD16",
|
||||
"deviceName": "Dimmer Switch",
|
||||
"subDeviceNo": null,
|
||||
"deviceStatus": "on",
|
||||
"connectionStatus": "online"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"code": 0,
|
||||
"result": {
|
||||
"token": "test-token",
|
||||
"accountID": "1234"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"traceId": "0000000000",
|
||||
"code": 0,
|
||||
"msg": "request success",
|
||||
"module": null,
|
||||
"stacktrace": null,
|
||||
"result": {
|
||||
"traceId": "0000000000",
|
||||
"code": 0,
|
||||
"result": {
|
||||
"enabled": false,
|
||||
"mode": "humidity"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"traceId": "0000000000",
|
||||
"code": 0,
|
||||
"msg": "request success",
|
||||
"module": null,
|
||||
"stacktrace": null,
|
||||
"result": {
|
||||
"traceId": "0000000000",
|
||||
"code": 0,
|
||||
"result": {
|
||||
"enabled": false,
|
||||
"mist_virtual_level": 9,
|
||||
"mist_level": 3,
|
||||
"mode": "humidity",
|
||||
"water_lacks": false,
|
||||
"water_tank_lifted": false,
|
||||
"humidity": 35,
|
||||
"humidity_high": false,
|
||||
"display": false,
|
||||
"warm_enabled": false,
|
||||
"warm_level": 0,
|
||||
"automatic_stop_reach_target": true,
|
||||
"configuration": { "auto_target_humidity": 60, "display": true },
|
||||
"extension": { "schedule_count": 0, "timer_remain": 0 }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"traceId": "0000000000",
|
||||
"code": 0,
|
||||
"msg": "request success",
|
||||
"result": {
|
||||
"total": 1,
|
||||
"pageSize": 100,
|
||||
"pageNo": 1,
|
||||
"list": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"traceId": "0000000000",
|
||||
"code": 0,
|
||||
"msg": "request success",
|
||||
"result": {
|
||||
"total": 1,
|
||||
"pageSize": 100,
|
||||
"pageNo": 1,
|
||||
"list": [
|
||||
{
|
||||
"deviceRegion": "US",
|
||||
"isOwner": true,
|
||||
"authKey": null,
|
||||
"deviceName": "Fan",
|
||||
"deviceImg": "",
|
||||
"cid": "abcdefghabcdefghabcdefghabcdefgh",
|
||||
"deviceStatus": "off",
|
||||
"connectionStatus": "online",
|
||||
"connectionType": "WiFi+BTOnboarding+BTNotify",
|
||||
"deviceType": "LV-PUR131S",
|
||||
"type": "wifi-air",
|
||||
"uuid": "00000000-1111-2222-3333-444444444444",
|
||||
"configModule": "WFON_AHM_LV-PUR131S_US",
|
||||
"macID": "00:00:00:00:00:00",
|
||||
"mode": null,
|
||||
"speed": null,
|
||||
"currentFirmVersion": null,
|
||||
"subDeviceNo": null,
|
||||
"subDeviceType": null,
|
||||
"deviceFirstSetupTime": "Jan 24, 2022 12:09:01 AM",
|
||||
"subDeviceList": null,
|
||||
"extension": null,
|
||||
"deviceProp": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"traceId": "0000000000",
|
||||
"code": 0,
|
||||
"msg": "request success",
|
||||
"result": {
|
||||
"total": 1,
|
||||
"pageSize": 100,
|
||||
"pageNo": 1,
|
||||
"list": [
|
||||
{
|
||||
"deviceRegion": "US",
|
||||
"isOwner": true,
|
||||
"authKey": null,
|
||||
"deviceName": "Humidifier",
|
||||
"deviceImg": "https://image.vesync.com/defaultImages/LV_600S_Series/icon_lv600s_humidifier_160.png",
|
||||
"cid": "abcdefghabcdefghabcdefghabcdefgh",
|
||||
"deviceStatus": "off",
|
||||
"connectionStatus": "online",
|
||||
"connectionType": "WiFi+BTOnboarding+BTNotify",
|
||||
"deviceType": "LUH-A602S-WUS",
|
||||
"type": "wifi-air",
|
||||
"uuid": "00000000-1111-2222-3333-444444444444",
|
||||
"configModule": "WFON_AHM_LUH-A602S-WUS_US",
|
||||
"macID": "00:00:00:00:00:00",
|
||||
"mode": null,
|
||||
"speed": null,
|
||||
"currentFirmVersion": null,
|
||||
"subDeviceNo": null,
|
||||
"subDeviceType": null,
|
||||
"deviceFirstSetupTime": "Jan 24, 2022 12:09:01 AM",
|
||||
"subDeviceList": null,
|
||||
"extension": null,
|
||||
"deviceProp": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"traceId": "0000000000",
|
||||
"code": 0,
|
||||
"msg": "request success",
|
||||
"result": {
|
||||
"accountID": "9999999",
|
||||
"token": "TOKEN"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,280 @@
|
||||
# serializer version: 1
|
||||
# name: test_async_get_config_entry_diagnostics__no_devices
|
||||
dict({
|
||||
'devices': dict({
|
||||
'bulbs': list([
|
||||
]),
|
||||
'fans': list([
|
||||
]),
|
||||
'outlets': list([
|
||||
]),
|
||||
'switches': list([
|
||||
]),
|
||||
}),
|
||||
'vesync': dict({
|
||||
'bulb_count': 0,
|
||||
'fan_count': 0,
|
||||
'outlets_count': 0,
|
||||
'switch_count': 0,
|
||||
'timezone': 'US/Pacific',
|
||||
}),
|
||||
})
|
||||
# ---
|
||||
# name: test_async_get_config_entry_diagnostics__single_humidifier
|
||||
dict({
|
||||
'devices': dict({
|
||||
'bulbs': list([
|
||||
]),
|
||||
'fans': list([
|
||||
dict({
|
||||
'_api_modes': list([
|
||||
'getHumidifierStatus',
|
||||
'setAutomaticStop',
|
||||
'setSwitch',
|
||||
'setNightLightBrightness',
|
||||
'setVirtualLevel',
|
||||
'setTargetHumidity',
|
||||
'setHumidityMode',
|
||||
'setDisplay',
|
||||
'setLevel',
|
||||
]),
|
||||
'_config_dict': dict({
|
||||
'features': list([
|
||||
'warm_mist',
|
||||
'nightlight',
|
||||
]),
|
||||
'mist_levels': list([
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
]),
|
||||
'mist_modes': list([
|
||||
'humidity',
|
||||
'sleep',
|
||||
'manual',
|
||||
]),
|
||||
'models': list([
|
||||
'LUH-A602S-WUSR',
|
||||
'LUH-A602S-WUS',
|
||||
'LUH-A602S-WEUR',
|
||||
'LUH-A602S-WEU',
|
||||
'LUH-A602S-WJP',
|
||||
'LUH-A602S-WUSC',
|
||||
]),
|
||||
'module': 'VeSyncHumid200300S',
|
||||
'warm_mist_levels': list([
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
]),
|
||||
}),
|
||||
'_features': list([
|
||||
'warm_mist',
|
||||
'nightlight',
|
||||
]),
|
||||
'cid': 'abcdefghabcdefghabcdefghabcdefgh',
|
||||
'config': dict({
|
||||
'auto_target_humidity': 60,
|
||||
'automatic_stop': True,
|
||||
'display': True,
|
||||
}),
|
||||
'config_module': 'WFON_AHM_LUH-A602S-WUS_US',
|
||||
'connection_status': 'online',
|
||||
'connection_type': 'WiFi+BTOnboarding+BTNotify',
|
||||
'current_firm_version': None,
|
||||
'details': dict({
|
||||
'automatic_stop_reach_target': True,
|
||||
'display': False,
|
||||
'humidity': 35,
|
||||
'humidity_high': False,
|
||||
'mist_level': 3,
|
||||
'mist_virtual_level': 9,
|
||||
'mode': 'humidity',
|
||||
'night_light_brightness': 0,
|
||||
'warm_mist_enabled': False,
|
||||
'warm_mist_level': 0,
|
||||
'water_lacks': False,
|
||||
'water_tank_lifted': False,
|
||||
}),
|
||||
'device_image': 'https://image.vesync.com/defaultImages/LV_600S_Series/icon_lv600s_humidifier_160.png',
|
||||
'device_name': 'Humidifier',
|
||||
'device_region': 'US',
|
||||
'device_status': 'off',
|
||||
'device_type': 'LUH-A602S-WUS',
|
||||
'enabled': False,
|
||||
'extension': None,
|
||||
'mac_id': '**REDACTED**',
|
||||
'manager': '**REDACTED**',
|
||||
'mist_levels': list([
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
]),
|
||||
'mist_modes': list([
|
||||
'humidity',
|
||||
'sleep',
|
||||
'manual',
|
||||
]),
|
||||
'mode': None,
|
||||
'night_light': True,
|
||||
'pid': None,
|
||||
'speed': None,
|
||||
'sub_device_no': None,
|
||||
'type': 'wifi-air',
|
||||
'uuid': '**REDACTED**',
|
||||
'warm_mist_feature': True,
|
||||
'warm_mist_levels': list([
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
]),
|
||||
}),
|
||||
]),
|
||||
'outlets': list([
|
||||
]),
|
||||
'switches': list([
|
||||
]),
|
||||
}),
|
||||
'vesync': dict({
|
||||
'bulb_count': 0,
|
||||
'fan_count': 1,
|
||||
'outlets_count': 0,
|
||||
'switch_count': 0,
|
||||
'timezone': 'US/Pacific',
|
||||
}),
|
||||
})
|
||||
# ---
|
||||
# name: test_async_get_device_diagnostics__single_fan
|
||||
dict({
|
||||
'cid': 'abcdefghabcdefghabcdefghabcdefgh',
|
||||
'config': dict({
|
||||
}),
|
||||
'config_module': 'WFON_AHM_LV-PUR131S_US',
|
||||
'connection_status': 'unknown',
|
||||
'connection_type': 'WiFi+BTOnboarding+BTNotify',
|
||||
'current_firm_version': None,
|
||||
'details': dict({
|
||||
'active_time': 0,
|
||||
'air_quality': 'unknown',
|
||||
'filter_life': dict({
|
||||
}),
|
||||
'level': 0,
|
||||
'screen_status': 'unknown',
|
||||
}),
|
||||
'device_image': '',
|
||||
'device_name': 'Fan',
|
||||
'device_region': 'US',
|
||||
'device_status': 'unknown',
|
||||
'device_type': 'LV-PUR131S',
|
||||
'extension': None,
|
||||
'home_assistant': dict({
|
||||
'disabled': False,
|
||||
'disabled_by': None,
|
||||
'entities': list([
|
||||
dict({
|
||||
'device_class': None,
|
||||
'disabled': False,
|
||||
'disabled_by': None,
|
||||
'domain': 'fan',
|
||||
'entity_category': None,
|
||||
'entity_id': 'fan.fan',
|
||||
'icon': None,
|
||||
'name': None,
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': None,
|
||||
'state': dict({
|
||||
'attributes': dict({
|
||||
'friendly_name': 'Fan',
|
||||
'preset_modes': list([
|
||||
'auto',
|
||||
'sleep',
|
||||
]),
|
||||
'supported_features': 57,
|
||||
}),
|
||||
'entity_id': 'fan.fan',
|
||||
'last_changed': str,
|
||||
'last_reported': str,
|
||||
'last_updated': str,
|
||||
'state': 'unavailable',
|
||||
}),
|
||||
'unit_of_measurement': None,
|
||||
}),
|
||||
dict({
|
||||
'device_class': None,
|
||||
'disabled': False,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.fan_air_quality',
|
||||
'icon': None,
|
||||
'name': None,
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Air quality',
|
||||
'state': dict({
|
||||
'attributes': dict({
|
||||
'friendly_name': 'Fan Air quality',
|
||||
}),
|
||||
'entity_id': 'sensor.fan_air_quality',
|
||||
'last_changed': str,
|
||||
'last_reported': str,
|
||||
'last_updated': str,
|
||||
'state': 'unavailable',
|
||||
}),
|
||||
'unit_of_measurement': None,
|
||||
}),
|
||||
dict({
|
||||
'device_class': None,
|
||||
'disabled': False,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': 'diagnostic',
|
||||
'entity_id': 'sensor.fan_filter_lifetime',
|
||||
'icon': None,
|
||||
'name': None,
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Filter lifetime',
|
||||
'state': dict({
|
||||
'attributes': dict({
|
||||
'friendly_name': 'Fan Filter lifetime',
|
||||
'state_class': 'measurement',
|
||||
'unit_of_measurement': '%',
|
||||
}),
|
||||
'entity_id': 'sensor.fan_filter_lifetime',
|
||||
'last_changed': str,
|
||||
'last_reported': str,
|
||||
'last_updated': str,
|
||||
'state': 'unavailable',
|
||||
}),
|
||||
'unit_of_measurement': '%',
|
||||
}),
|
||||
]),
|
||||
'name': 'Fan',
|
||||
'name_by_user': None,
|
||||
}),
|
||||
'mac_id': '**REDACTED**',
|
||||
'manager': '**REDACTED**',
|
||||
'mode': None,
|
||||
'pid': None,
|
||||
'speed': None,
|
||||
'sub_device_no': None,
|
||||
'type': 'wifi-air',
|
||||
'uuid': '**REDACTED**',
|
||||
})
|
||||
# ---
|
||||
594
home-assistant/tests/components/vesync/snapshots/test_fan.ambr
Normal file
594
home-assistant/tests/components/vesync/snapshots/test_fan.ambr
Normal file
@@ -0,0 +1,594 @@
|
||||
# serializer version: 1
|
||||
# name: test_fan_state[Air Purifier 131s][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',
|
||||
'air-purifier',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'LV-PUR131S',
|
||||
'model_id': None,
|
||||
'name': 'Air Purifier 131s',
|
||||
'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[Air Purifier 131s][entities]
|
||||
list([
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'preset_modes': list([
|
||||
'auto',
|
||||
'sleep',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'fan',
|
||||
'entity_category': None,
|
||||
'entity_id': 'fan.air_purifier_131s',
|
||||
'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': 'air-purifier',
|
||||
'unit_of_measurement': None,
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_fan_state[Air Purifier 131s][fan.air_purifier_131s]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Air Purifier 131s',
|
||||
'preset_modes': list([
|
||||
'auto',
|
||||
'sleep',
|
||||
]),
|
||||
'supported_features': <FanEntityFeature: 57>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'fan.air_purifier_131s',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unavailable',
|
||||
})
|
||||
# ---
|
||||
# name: test_fan_state[Air Purifier 200s][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',
|
||||
'asd_sdfKIHG7IJHGwJGJ7GJ_ag5h3G55',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'Core200S',
|
||||
'model_id': None,
|
||||
'name': 'Air Purifier 200s',
|
||||
'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[Air Purifier 200s][entities]
|
||||
list([
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'preset_modes': list([
|
||||
'sleep',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'fan',
|
||||
'entity_category': None,
|
||||
'entity_id': 'fan.air_purifier_200s',
|
||||
'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': 'asd_sdfKIHG7IJHGwJGJ7GJ_ag5h3G55',
|
||||
'unit_of_measurement': None,
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_fan_state[Air Purifier 200s][fan.air_purifier_200s]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'child_lock': False,
|
||||
'friendly_name': 'Air Purifier 200s',
|
||||
'mode': 'manual',
|
||||
'night_light': 'off',
|
||||
'percentage': 33,
|
||||
'percentage_step': 33.333333333333336,
|
||||
'preset_mode': None,
|
||||
'preset_modes': list([
|
||||
'sleep',
|
||||
]),
|
||||
'screen_status': True,
|
||||
'supported_features': <FanEntityFeature: 57>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'fan.air_purifier_200s',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_fan_state[Air Purifier 400s][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',
|
||||
'400s-purifier',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'LAP-C401S-WJP',
|
||||
'model_id': None,
|
||||
'name': 'Air Purifier 400s',
|
||||
'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[Air Purifier 400s][entities]
|
||||
list([
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'preset_modes': list([
|
||||
'auto',
|
||||
'sleep',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'fan',
|
||||
'entity_category': None,
|
||||
'entity_id': 'fan.air_purifier_400s',
|
||||
'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': '400s-purifier',
|
||||
'unit_of_measurement': None,
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_fan_state[Air Purifier 400s][fan.air_purifier_400s]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'child_lock': False,
|
||||
'friendly_name': 'Air Purifier 400s',
|
||||
'mode': 'manual',
|
||||
'night_light': 'off',
|
||||
'percentage': 25,
|
||||
'percentage_step': 25.0,
|
||||
'preset_mode': None,
|
||||
'preset_modes': list([
|
||||
'auto',
|
||||
'sleep',
|
||||
]),
|
||||
'screen_status': True,
|
||||
'supported_features': <FanEntityFeature: 57>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'fan.air_purifier_400s',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_fan_state[Air Purifier 600s][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',
|
||||
'600s-purifier',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'LAP-C601S-WUS',
|
||||
'model_id': None,
|
||||
'name': 'Air Purifier 600s',
|
||||
'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[Air Purifier 600s][entities]
|
||||
list([
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'preset_modes': list([
|
||||
'auto',
|
||||
'sleep',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'fan',
|
||||
'entity_category': None,
|
||||
'entity_id': 'fan.air_purifier_600s',
|
||||
'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': '600s-purifier',
|
||||
'unit_of_measurement': None,
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_fan_state[Air Purifier 600s][fan.air_purifier_600s]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'child_lock': False,
|
||||
'friendly_name': 'Air Purifier 600s',
|
||||
'mode': 'manual',
|
||||
'night_light': 'off',
|
||||
'percentage': 25,
|
||||
'percentage_step': 25.0,
|
||||
'preset_mode': None,
|
||||
'preset_modes': list([
|
||||
'auto',
|
||||
'sleep',
|
||||
]),
|
||||
'screen_status': True,
|
||||
'supported_features': <FanEntityFeature: 57>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'fan.air_purifier_600s',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_fan_state[Dimmable Light][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',
|
||||
'dimmable-bulb',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'ESL100',
|
||||
'model_id': None,
|
||||
'name': 'Dimmable Light',
|
||||
'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[Dimmable Light][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_fan_state[Dimmer Switch][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',
|
||||
'dimmable-switch',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'ESWD16',
|
||||
'model_id': None,
|
||||
'name': 'Dimmer Switch',
|
||||
'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[Dimmer Switch][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_fan_state[Humidifier 200s][devices]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_fan_state[Humidifier 200s][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_fan_state[Humidifier 600S][devices]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_fan_state[Humidifier 600S][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_fan_state[Outlet][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',
|
||||
'outlet',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'wifi-switch-1.3',
|
||||
'model_id': None,
|
||||
'name': 'Outlet',
|
||||
'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[Outlet][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_fan_state[Temperature Light][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',
|
||||
'tunable-bulb',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'ESL100CW',
|
||||
'model_id': None,
|
||||
'name': 'Temperature Light',
|
||||
'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[Temperature Light][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_fan_state[Wall Switch][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',
|
||||
'switch',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'ESWL01',
|
||||
'model_id': None,
|
||||
'name': 'Wall Switch',
|
||||
'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[Wall Switch][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
532
home-assistant/tests/components/vesync/snapshots/test_light.ambr
Normal file
532
home-assistant/tests/components/vesync/snapshots/test_light.ambr
Normal file
@@ -0,0 +1,532 @@
|
||||
# serializer version: 1
|
||||
# name: test_light_state[Air Purifier 131s][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',
|
||||
'air-purifier',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'LV-PUR131S',
|
||||
'model_id': None,
|
||||
'name': 'Air Purifier 131s',
|
||||
'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[Air Purifier 131s][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_light_state[Air Purifier 200s][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',
|
||||
'asd_sdfKIHG7IJHGwJGJ7GJ_ag5h3G55',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'Core200S',
|
||||
'model_id': None,
|
||||
'name': 'Air Purifier 200s',
|
||||
'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[Air Purifier 200s][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_light_state[Air Purifier 400s][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',
|
||||
'400s-purifier',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'LAP-C401S-WJP',
|
||||
'model_id': None,
|
||||
'name': 'Air Purifier 400s',
|
||||
'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[Air Purifier 400s][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_light_state[Air Purifier 600s][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',
|
||||
'600s-purifier',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'LAP-C601S-WUS',
|
||||
'model_id': None,
|
||||
'name': 'Air Purifier 600s',
|
||||
'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[Air Purifier 600s][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_light_state[Dimmable Light][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',
|
||||
'dimmable-bulb',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'ESL100',
|
||||
'model_id': None,
|
||||
'name': 'Dimmable Light',
|
||||
'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[Dimmable Light][entities]
|
||||
list([
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'supported_color_modes': list([
|
||||
<ColorMode.BRIGHTNESS: 'brightness'>,
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'light',
|
||||
'entity_category': None,
|
||||
'entity_id': 'light.dimmable_light',
|
||||
'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': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'dimmable-bulb',
|
||||
'unit_of_measurement': None,
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_light_state[Dimmable Light][light.dimmable_light]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Dimmable Light',
|
||||
'supported_color_modes': list([
|
||||
<ColorMode.BRIGHTNESS: 'brightness'>,
|
||||
]),
|
||||
'supported_features': <LightEntityFeature: 0>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'light.dimmable_light',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unavailable',
|
||||
})
|
||||
# ---
|
||||
# name: test_light_state[Dimmer Switch][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',
|
||||
'dimmable-switch',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'ESWD16',
|
||||
'model_id': None,
|
||||
'name': 'Dimmer Switch',
|
||||
'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[Dimmer Switch][entities]
|
||||
list([
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'supported_color_modes': list([
|
||||
<ColorMode.BRIGHTNESS: 'brightness'>,
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'light',
|
||||
'entity_category': None,
|
||||
'entity_id': 'light.dimmer_switch',
|
||||
'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': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'dimmable-switch',
|
||||
'unit_of_measurement': None,
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_light_state[Dimmer Switch][light.dimmer_switch]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'brightness': 128,
|
||||
'color_mode': <ColorMode.BRIGHTNESS: 'brightness'>,
|
||||
'friendly_name': 'Dimmer Switch',
|
||||
'supported_color_modes': list([
|
||||
<ColorMode.BRIGHTNESS: 'brightness'>,
|
||||
]),
|
||||
'supported_features': <LightEntityFeature: 0>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'light.dimmer_switch',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_light_state[Humidifier 200s][devices]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_light_state[Humidifier 200s][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_light_state[Humidifier 600S][devices]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_light_state[Humidifier 600S][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_light_state[Outlet][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',
|
||||
'outlet',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'wifi-switch-1.3',
|
||||
'model_id': None,
|
||||
'name': 'Outlet',
|
||||
'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[Outlet][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_light_state[Temperature Light][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',
|
||||
'tunable-bulb',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'ESL100CW',
|
||||
'model_id': None,
|
||||
'name': 'Temperature Light',
|
||||
'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[Temperature Light][entities]
|
||||
list([
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max_color_temp_kelvin': 6500,
|
||||
'max_mireds': 370,
|
||||
'min_color_temp_kelvin': 2700,
|
||||
'min_mireds': 153,
|
||||
'supported_color_modes': list([
|
||||
<ColorMode.COLOR_TEMP: 'color_temp'>,
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'light',
|
||||
'entity_category': None,
|
||||
'entity_id': 'light.temperature_light',
|
||||
'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': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'tunable-bulb',
|
||||
'unit_of_measurement': None,
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_light_state[Temperature Light][light.temperature_light]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'brightness': None,
|
||||
'color_mode': None,
|
||||
'color_temp': None,
|
||||
'color_temp_kelvin': None,
|
||||
'friendly_name': 'Temperature Light',
|
||||
'hs_color': None,
|
||||
'max_color_temp_kelvin': 6500,
|
||||
'max_mireds': 370,
|
||||
'min_color_temp_kelvin': 2700,
|
||||
'min_mireds': 153,
|
||||
'rgb_color': None,
|
||||
'supported_color_modes': list([
|
||||
<ColorMode.COLOR_TEMP: 'color_temp'>,
|
||||
]),
|
||||
'supported_features': <LightEntityFeature: 0>,
|
||||
'xy_color': None,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'light.temperature_light',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_light_state[Wall Switch][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',
|
||||
'switch',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'ESWL01',
|
||||
'model_id': None,
|
||||
'name': 'Wall Switch',
|
||||
'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[Wall Switch][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
1075
home-assistant/tests/components/vesync/snapshots/test_sensor.ambr
Normal file
1075
home-assistant/tests/components/vesync/snapshots/test_sensor.ambr
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,447 @@
|
||||
# serializer version: 1
|
||||
# name: test_switch_state[Air Purifier 131s][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',
|
||||
'air-purifier',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'LV-PUR131S',
|
||||
'model_id': None,
|
||||
'name': 'Air Purifier 131s',
|
||||
'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[Air Purifier 131s][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_switch_state[Air Purifier 200s][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',
|
||||
'asd_sdfKIHG7IJHGwJGJ7GJ_ag5h3G55',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'Core200S',
|
||||
'model_id': None,
|
||||
'name': 'Air Purifier 200s',
|
||||
'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[Air Purifier 200s][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_switch_state[Air Purifier 400s][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',
|
||||
'400s-purifier',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'LAP-C401S-WJP',
|
||||
'model_id': None,
|
||||
'name': 'Air Purifier 400s',
|
||||
'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[Air Purifier 400s][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_switch_state[Air Purifier 600s][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',
|
||||
'600s-purifier',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'LAP-C601S-WUS',
|
||||
'model_id': None,
|
||||
'name': 'Air Purifier 600s',
|
||||
'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[Air Purifier 600s][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_switch_state[Dimmable Light][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',
|
||||
'dimmable-bulb',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'ESL100',
|
||||
'model_id': None,
|
||||
'name': 'Dimmable Light',
|
||||
'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[Dimmable Light][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_switch_state[Dimmer Switch][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',
|
||||
'dimmable-switch',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'ESWD16',
|
||||
'model_id': None,
|
||||
'name': 'Dimmer Switch',
|
||||
'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[Dimmer Switch][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_switch_state[Humidifier 200s][devices]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_switch_state[Humidifier 200s][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_switch_state[Humidifier 600S][devices]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_switch_state[Humidifier 600S][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_switch_state[Outlet][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',
|
||||
'outlet',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'wifi-switch-1.3',
|
||||
'model_id': None,
|
||||
'name': 'Outlet',
|
||||
'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[Outlet][entities]
|
||||
list([
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.outlet',
|
||||
'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': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'outlet',
|
||||
'unit_of_measurement': None,
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_switch_state[Outlet][switch.outlet]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Outlet',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.outlet',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_switch_state[Temperature Light][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',
|
||||
'tunable-bulb',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'ESL100CW',
|
||||
'model_id': None,
|
||||
'name': 'Temperature Light',
|
||||
'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[Temperature Light][entities]
|
||||
list([
|
||||
])
|
||||
# ---
|
||||
# name: test_switch_state[Wall Switch][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',
|
||||
'switch',
|
||||
),
|
||||
}),
|
||||
'is_new': False,
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'VeSync',
|
||||
'model': 'ESWL01',
|
||||
'model_id': None,
|
||||
'name': 'Wall Switch',
|
||||
'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[Wall Switch][entities]
|
||||
list([
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.wall_switch',
|
||||
'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': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'switch',
|
||||
'unit_of_measurement': None,
|
||||
}),
|
||||
])
|
||||
# ---
|
||||
# name: test_switch_state[Wall Switch][switch.wall_switch]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Wall Switch',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.wall_switch',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
50
home-assistant/tests/components/vesync/test_config_flow.py
Normal file
50
home-assistant/tests/components/vesync/test_config_flow.py
Normal file
@@ -0,0 +1,50 @@
|
||||
"""Test for vesync config flow."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.vesync import DOMAIN, config_flow
|
||||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
async def test_abort_already_setup(hass: HomeAssistant) -> None:
|
||||
"""Test if we abort because component is already setup."""
|
||||
flow = config_flow.VeSyncFlowHandler()
|
||||
flow.hass = hass
|
||||
MockConfigEntry(domain=DOMAIN, title="user", data={"user": "pass"}).add_to_hass(
|
||||
hass
|
||||
)
|
||||
result = await flow.async_step_user()
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "single_instance_allowed"
|
||||
|
||||
|
||||
async def test_invalid_login_error(hass: HomeAssistant) -> None:
|
||||
"""Test if we return error for invalid username and password."""
|
||||
test_dict = {CONF_USERNAME: "user", CONF_PASSWORD: "pass"}
|
||||
flow = config_flow.VeSyncFlowHandler()
|
||||
flow.hass = hass
|
||||
with patch("pyvesync.vesync.VeSync.login", return_value=False):
|
||||
result = await flow.async_step_user(user_input=test_dict)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["errors"] == {"base": "invalid_auth"}
|
||||
|
||||
|
||||
async def test_config_flow_user_input(hass: HomeAssistant) -> None:
|
||||
"""Test config flow with user input."""
|
||||
flow = config_flow.VeSyncFlowHandler()
|
||||
flow.hass = hass
|
||||
result = await flow.async_step_user()
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
with patch("pyvesync.vesync.VeSync.login", return_value=True):
|
||||
result = await flow.async_step_user(
|
||||
{CONF_USERNAME: "user", CONF_PASSWORD: "pass"}
|
||||
)
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["data"][CONF_USERNAME] == "user"
|
||||
assert result["data"][CONF_PASSWORD] == "pass"
|
||||
106
home-assistant/tests/components/vesync/test_diagnostics.py
Normal file
106
home-assistant/tests/components/vesync/test_diagnostics.py
Normal file
@@ -0,0 +1,106 @@
|
||||
"""Tests for the diagnostics data provided by the VeSync integration."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from pyvesync.helpers import Helpers
|
||||
from syrupy import SnapshotAssertion
|
||||
from syrupy.matchers import path_type
|
||||
|
||||
from homeassistant.components.vesync.const import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from .common import (
|
||||
call_api_side_effect__no_devices,
|
||||
call_api_side_effect__single_fan,
|
||||
call_api_side_effect__single_humidifier,
|
||||
)
|
||||
|
||||
from tests.components.diagnostics import (
|
||||
get_diagnostics_for_config_entry,
|
||||
get_diagnostics_for_device,
|
||||
)
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_async_get_config_entry_diagnostics__no_devices(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
config_entry: ConfigEntry,
|
||||
config: ConfigType,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test diagnostics for config entry."""
|
||||
with patch.object(Helpers, "call_api") as call_api:
|
||||
call_api.side_effect = call_api_side_effect__no_devices
|
||||
assert await async_setup_component(hass, DOMAIN, config)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
diag = await get_diagnostics_for_config_entry(hass, hass_client, config_entry)
|
||||
|
||||
assert isinstance(diag, dict)
|
||||
assert diag == snapshot
|
||||
|
||||
|
||||
async def test_async_get_config_entry_diagnostics__single_humidifier(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
config_entry: ConfigEntry,
|
||||
config: ConfigType,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test diagnostics for config entry."""
|
||||
with patch.object(Helpers, "call_api") as call_api:
|
||||
call_api.side_effect = call_api_side_effect__single_humidifier
|
||||
assert await async_setup_component(hass, DOMAIN, config)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
diag = await get_diagnostics_for_config_entry(hass, hass_client, config_entry)
|
||||
|
||||
assert isinstance(diag, dict)
|
||||
assert diag == snapshot
|
||||
|
||||
|
||||
async def test_async_get_device_diagnostics__single_fan(
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
hass_client: ClientSessionGenerator,
|
||||
config_entry: ConfigEntry,
|
||||
config: ConfigType,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test diagnostics for config entry."""
|
||||
with patch.object(Helpers, "call_api") as call_api:
|
||||
call_api.side_effect = call_api_side_effect__single_fan
|
||||
assert await async_setup_component(hass, DOMAIN, config)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
device = device_registry.async_get_device(
|
||||
identifiers={(DOMAIN, "abcdefghabcdefghabcdefghabcdefgh")},
|
||||
)
|
||||
assert device is not None
|
||||
|
||||
diag = await get_diagnostics_for_device(hass, hass_client, config_entry, device)
|
||||
|
||||
assert isinstance(diag, dict)
|
||||
diag["home_assistant"]["entities"] = sorted(
|
||||
diag["home_assistant"]["entities"], key=lambda ent: ent["entity_id"]
|
||||
)
|
||||
assert diag == snapshot(
|
||||
matcher=path_type(
|
||||
{
|
||||
"home_assistant.entities.0.state.last_changed": (str,),
|
||||
"home_assistant.entities.0.state.last_reported": (str,),
|
||||
"home_assistant.entities.0.state.last_updated": (str,),
|
||||
"home_assistant.entities.1.state.last_changed": (str,),
|
||||
"home_assistant.entities.1.state.last_reported": (str,),
|
||||
"home_assistant.entities.1.state.last_updated": (str,),
|
||||
"home_assistant.entities.2.state.last_changed": (str,),
|
||||
"home_assistant.entities.2.state.last_reported": (str,),
|
||||
"home_assistant.entities.2.state.last_updated": (str,),
|
||||
}
|
||||
)
|
||||
)
|
||||
51
home-assistant/tests/components/vesync/test_fan.py
Normal file
51
home-assistant/tests/components/vesync/test_fan.py
Normal file
@@ -0,0 +1,51 @@
|
||||
"""Tests for the fan module."""
|
||||
|
||||
import pytest
|
||||
import requests_mock
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.fan import DOMAIN as FAN_DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
||||
from .common import ALL_DEVICE_NAMES, mock_devices_response
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.mark.parametrize("device_name", ALL_DEVICE_NAMES)
|
||||
async def test_fan_state(
|
||||
hass: HomeAssistant,
|
||||
snapshot: SnapshotAssertion,
|
||||
config_entry: MockConfigEntry,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
requests_mock: requests_mock.Mocker,
|
||||
device_name: str,
|
||||
) -> None:
|
||||
"""Test the resulting setup state is as expected for the platform."""
|
||||
|
||||
# Configure the API devices call for device_name
|
||||
mock_devices_response(requests_mock, device_name)
|
||||
|
||||
# setup platform - only including the named device
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
# Check device registry
|
||||
devices = dr.async_entries_for_config_entry(device_registry, config_entry.entry_id)
|
||||
assert devices == snapshot(name="devices")
|
||||
|
||||
# Check entity registry
|
||||
entities = [
|
||||
entity
|
||||
for entity in er.async_entries_for_config_entry(
|
||||
entity_registry, config_entry.entry_id
|
||||
)
|
||||
if entity.domain == FAN_DOMAIN
|
||||
]
|
||||
assert entities == snapshot(name="entities")
|
||||
|
||||
# Check states
|
||||
for entity in entities:
|
||||
assert hass.states.get(entity.entity_id) == snapshot(name=entity.entity_id)
|
||||
87
home-assistant/tests/components/vesync/test_init.py
Normal file
87
home-assistant/tests/components/vesync/test_init.py
Normal file
@@ -0,0 +1,87 @@
|
||||
"""Tests for the init module."""
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import pytest
|
||||
from pyvesync import VeSync
|
||||
|
||||
from homeassistant.components.vesync import async_setup_entry
|
||||
from homeassistant.components.vesync.const import (
|
||||
DOMAIN,
|
||||
VS_FANS,
|
||||
VS_LIGHTS,
|
||||
VS_MANAGER,
|
||||
VS_SENSORS,
|
||||
VS_SWITCHES,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
||||
async def test_async_setup_entry__not_login(
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
manager: VeSync,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
) -> None:
|
||||
"""Test setup does not create config entry when not logged in."""
|
||||
manager.login = Mock(return_value=False)
|
||||
|
||||
with (
|
||||
patch.object(hass.config_entries, "async_forward_entry_setups") as setups_mock,
|
||||
patch("homeassistant.components.vesync.async_process_devices") as process_mock,
|
||||
):
|
||||
assert not await async_setup_entry(hass, config_entry)
|
||||
await hass.async_block_till_done()
|
||||
assert setups_mock.call_count == 0
|
||||
assert process_mock.call_count == 0
|
||||
|
||||
assert manager.login.call_count == 1
|
||||
assert DOMAIN not in hass.data
|
||||
assert "Unable to login to the VeSync server" in caplog.text
|
||||
|
||||
|
||||
async def test_async_setup_entry__no_devices(
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, manager: VeSync
|
||||
) -> None:
|
||||
"""Test setup connects to vesync and creates empty config when no devices."""
|
||||
with patch.object(hass.config_entries, "async_forward_entry_setups") as setups_mock:
|
||||
assert await async_setup_entry(hass, config_entry)
|
||||
# Assert platforms loaded
|
||||
await hass.async_block_till_done()
|
||||
assert setups_mock.call_count == 1
|
||||
assert setups_mock.call_args.args[0] == config_entry
|
||||
assert setups_mock.call_args.args[1] == []
|
||||
|
||||
assert manager.login.call_count == 1
|
||||
assert hass.data[DOMAIN][VS_MANAGER] == manager
|
||||
assert not hass.data[DOMAIN][VS_SWITCHES]
|
||||
assert not hass.data[DOMAIN][VS_FANS]
|
||||
assert not hass.data[DOMAIN][VS_LIGHTS]
|
||||
assert not hass.data[DOMAIN][VS_SENSORS]
|
||||
|
||||
|
||||
async def test_async_setup_entry__loads_fans(
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, manager: VeSync, fan
|
||||
) -> None:
|
||||
"""Test setup connects to vesync and loads fan platform."""
|
||||
fans = [fan]
|
||||
manager.fans = fans
|
||||
manager._dev_list = {
|
||||
"fans": fans,
|
||||
}
|
||||
|
||||
with patch.object(hass.config_entries, "async_forward_entry_setups") as setups_mock:
|
||||
assert await async_setup_entry(hass, config_entry)
|
||||
# Assert platforms loaded
|
||||
await hass.async_block_till_done()
|
||||
assert setups_mock.call_count == 1
|
||||
assert setups_mock.call_args.args[0] == config_entry
|
||||
assert setups_mock.call_args.args[1] == [Platform.FAN, Platform.SENSOR]
|
||||
assert manager.login.call_count == 1
|
||||
assert hass.data[DOMAIN][VS_MANAGER] == manager
|
||||
assert not hass.data[DOMAIN][VS_SWITCHES]
|
||||
assert hass.data[DOMAIN][VS_FANS] == [fan]
|
||||
assert not hass.data[DOMAIN][VS_LIGHTS]
|
||||
assert hass.data[DOMAIN][VS_SENSORS] == [fan]
|
||||
51
home-assistant/tests/components/vesync/test_light.py
Normal file
51
home-assistant/tests/components/vesync/test_light.py
Normal file
@@ -0,0 +1,51 @@
|
||||
"""Tests for the light module."""
|
||||
|
||||
import pytest
|
||||
import requests_mock
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
||||
from .common import ALL_DEVICE_NAMES, mock_devices_response
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.mark.parametrize("device_name", ALL_DEVICE_NAMES)
|
||||
async def test_light_state(
|
||||
hass: HomeAssistant,
|
||||
snapshot: SnapshotAssertion,
|
||||
config_entry: MockConfigEntry,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
requests_mock: requests_mock.Mocker,
|
||||
device_name: str,
|
||||
) -> None:
|
||||
"""Test the resulting setup state is as expected for the platform."""
|
||||
|
||||
# Configure the API devices call for device_name
|
||||
mock_devices_response(requests_mock, device_name)
|
||||
|
||||
# setup platform - only including the named device
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
# Check device registry
|
||||
devices = dr.async_entries_for_config_entry(device_registry, config_entry.entry_id)
|
||||
assert devices == snapshot(name="devices")
|
||||
|
||||
# Check entity registry
|
||||
entities = [
|
||||
entity
|
||||
for entity in er.async_entries_for_config_entry(
|
||||
entity_registry, config_entry.entry_id
|
||||
)
|
||||
if entity.domain == LIGHT_DOMAIN
|
||||
]
|
||||
assert entities == snapshot(name="entities")
|
||||
|
||||
# Check states
|
||||
for entity in entities:
|
||||
assert hass.states.get(entity.entity_id) == snapshot(name=entity.entity_id)
|
||||
51
home-assistant/tests/components/vesync/test_sensor.py
Normal file
51
home-assistant/tests/components/vesync/test_sensor.py
Normal file
@@ -0,0 +1,51 @@
|
||||
"""Tests for the sensor module."""
|
||||
|
||||
import pytest
|
||||
import requests_mock
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
||||
from .common import ALL_DEVICE_NAMES, mock_devices_response
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.mark.parametrize("device_name", ALL_DEVICE_NAMES)
|
||||
async def test_sensor_state(
|
||||
hass: HomeAssistant,
|
||||
snapshot: SnapshotAssertion,
|
||||
config_entry: MockConfigEntry,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
requests_mock: requests_mock.Mocker,
|
||||
device_name: str,
|
||||
) -> None:
|
||||
"""Test the resulting setup state is as expected for the platform."""
|
||||
|
||||
# Configure the API devices call for device_name
|
||||
mock_devices_response(requests_mock, device_name)
|
||||
|
||||
# setup platform - only including the named device
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
# Check device registry
|
||||
devices = dr.async_entries_for_config_entry(device_registry, config_entry.entry_id)
|
||||
assert devices == snapshot(name="devices")
|
||||
|
||||
# Check entity registry
|
||||
entities = [
|
||||
entity
|
||||
for entity in er.async_entries_for_config_entry(
|
||||
entity_registry, config_entry.entry_id
|
||||
)
|
||||
if entity.domain == SENSOR_DOMAIN
|
||||
]
|
||||
assert entities == snapshot(name="entities")
|
||||
|
||||
# Check states
|
||||
for entity in entities:
|
||||
assert hass.states.get(entity.entity_id) == snapshot(name=entity.entity_id)
|
||||
51
home-assistant/tests/components/vesync/test_switch.py
Normal file
51
home-assistant/tests/components/vesync/test_switch.py
Normal file
@@ -0,0 +1,51 @@
|
||||
"""Tests for the switch module."""
|
||||
|
||||
import pytest
|
||||
import requests_mock
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
||||
from .common import ALL_DEVICE_NAMES, mock_devices_response
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.mark.parametrize("device_name", ALL_DEVICE_NAMES)
|
||||
async def test_switch_state(
|
||||
hass: HomeAssistant,
|
||||
snapshot: SnapshotAssertion,
|
||||
config_entry: MockConfigEntry,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
requests_mock: requests_mock.Mocker,
|
||||
device_name: str,
|
||||
) -> None:
|
||||
"""Test the resulting setup state is as expected for the platform."""
|
||||
|
||||
# Configure the API devices call for device_name
|
||||
mock_devices_response(requests_mock, device_name)
|
||||
|
||||
# setup platform - only including the named device
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
# Check device registry
|
||||
devices = dr.async_entries_for_config_entry(device_registry, config_entry.entry_id)
|
||||
assert devices == snapshot(name="devices")
|
||||
|
||||
# Check entity registry
|
||||
entities = [
|
||||
entity
|
||||
for entity in er.async_entries_for_config_entry(
|
||||
entity_registry, config_entry.entry_id
|
||||
)
|
||||
if entity.domain == SWITCH_DOMAIN
|
||||
]
|
||||
assert entities == snapshot(name="entities")
|
||||
|
||||
# Check states
|
||||
for entity in entities:
|
||||
assert hass.states.get(entity.entity_id) == snapshot(name=entity.entity_id)
|
||||
Reference in New Issue
Block a user