mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Add snapshots tests for new platforms in tuya (#148334)
This commit is contained in:
parent
7875290256
commit
b0f7c985e4
@ -7,10 +7,50 @@ from unittest.mock import patch
|
||||
from tuya_sharing import CustomerDevice
|
||||
|
||||
from homeassistant.components.tuya import ManagerCompat
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
DEVICE_MOCKS = {
|
||||
"cs_arete_two_12l_dehumidifier_air_purifier": [
|
||||
Platform.FAN,
|
||||
Platform.HUMIDIFIER,
|
||||
Platform.SELECT,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
],
|
||||
"cwwsq_cleverio_pf100": [
|
||||
# https://github.com/home-assistant/core/issues/144745
|
||||
Platform.NUMBER,
|
||||
Platform.SENSOR,
|
||||
],
|
||||
"cwysj_pixi_smart_drinking_fountain": [
|
||||
# https://github.com/home-assistant/core/pull/146599
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
],
|
||||
"cz_dual_channel_metering": [
|
||||
# https://github.com/home-assistant/core/issues/147149
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
],
|
||||
"mcs_door_sensor": [
|
||||
# https://github.com/home-assistant/core/issues/108301
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.SENSOR,
|
||||
],
|
||||
"sfkzq_valve_controller": [
|
||||
# https://github.com/home-assistant/core/issues/148116
|
||||
Platform.SWITCH,
|
||||
],
|
||||
"tdq_4_443": [
|
||||
# https://github.com/home-assistant/core/issues/146845
|
||||
Platform.SELECT,
|
||||
Platform.SWITCH,
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
async def initialize_entry(
|
||||
hass: HomeAssistant,
|
||||
|
@ -18,6 +18,7 @@ from homeassistant.components.tuya.const import (
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.json import json_dumps
|
||||
|
||||
from tests.common import MockConfigEntry, async_load_json_object_fixture
|
||||
|
||||
@ -142,11 +143,11 @@ async def mock_device(hass: HomeAssistant, mock_device_code: str) -> CustomerDev
|
||||
device.product_name = details["product_name"]
|
||||
device.online = details["online"]
|
||||
device.function = {
|
||||
key: MagicMock(type=value["type"], values=value["values"])
|
||||
key: MagicMock(type=value["type"], values=json_dumps(value["value"]))
|
||||
for key, value in details["function"].items()
|
||||
}
|
||||
device.status_range = {
|
||||
key: MagicMock(type=value["type"], values=value["values"])
|
||||
key: MagicMock(type=value["type"], values=json_dumps(value["value"]))
|
||||
for key, value in details["status_range"].items()
|
||||
}
|
||||
device.status = details["status"]
|
||||
|
@ -6,39 +6,41 @@
|
||||
"product_name": "Arete\u00ae Two 12L Dehumidifier/Air Purifier",
|
||||
"online": true,
|
||||
"function": {
|
||||
"switch": { "type": "Boolean", "values": "{}" },
|
||||
"switch": { "type": "Boolean", "value": {} },
|
||||
"dehumidify_set_value": {
|
||||
"type": "Integer",
|
||||
"values": "{\"unit\": \"%\", \"min\": 35, \"max\": 70, \"scale\": 0, \"step\": 5}"
|
||||
"value": { "unit": "%", "min": 35, "max": 70, "scale": 0, "step": 5 }
|
||||
},
|
||||
"child_lock": { "type": "Boolean", "values": "{}" },
|
||||
"child_lock": { "type": "Boolean", "value": {} },
|
||||
"countdown_set": {
|
||||
"type": "Enum",
|
||||
"values": "{\"range\": [\"cancel\", \"1h\", \"2h\", \"3h\"]}"
|
||||
"value": { "range": ["cancel", "1h", "2h", "3h"] }
|
||||
}
|
||||
},
|
||||
"status_range": {
|
||||
"switch": { "type": "Boolean", "values": "{}" },
|
||||
"switch": { "type": "Boolean", "value": {} },
|
||||
"dehumidify_set_value": {
|
||||
"type": "Integer",
|
||||
"values": "{\"unit\": \"%\", \"min\": 35, \"max\": 70, \"scale\": 0, \"step\": 5}"
|
||||
"value": { "unit": "%", "min": 35, "max": 70, "scale": 0, "step": 5 }
|
||||
},
|
||||
"child_lock": { "type": "Boolean", "values": "{}" },
|
||||
"child_lock": { "type": "Boolean", "value": {} },
|
||||
"humidity_indoor": {
|
||||
"type": "Integer",
|
||||
"values": "{\"unit\": \"%\", \"min\": 0, \"max\": 100, \"scale\": 0, \"step\": 1}"
|
||||
"value": { "unit": "%", "min": 0, "max": 100, "scale": 0, "step": 1 }
|
||||
},
|
||||
"countdown_set": {
|
||||
"type": "Enum",
|
||||
"values": "{\"range\": [\"cancel\", \"1h\", \"2h\", \"3h\"]}"
|
||||
"value": { "range": ["cancel", "1h", "2h", "3h"] }
|
||||
},
|
||||
"countdown_left": {
|
||||
"type": "Integer",
|
||||
"values": "{\"unit\": \"h\", \"min\": 0, \"max\": 24, \"scale\": 0, \"step\": 1}"
|
||||
"value": { "unit": "h", "min": 0, "max": 24, "scale": 0, "step": 1 }
|
||||
},
|
||||
"fault": {
|
||||
"type": "Bitmap",
|
||||
"values": "{\"label\": [\"tankfull\", \"defrost\", \"E1\", \"E2\", \"L2\", \"L3\", \"L4\", \"wet\"]}"
|
||||
"value": {
|
||||
"label": ["tankfull", "defrost", "E1", "E2", "L2", "L3", "L4", "wet"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
|
101
tests/components/tuya/fixtures/cwwsq_cleverio_pf100.json
Normal file
101
tests/components/tuya/fixtures/cwwsq_cleverio_pf100.json
Normal file
@ -0,0 +1,101 @@
|
||||
{
|
||||
"endpoint": "https://apigw.tuyaeu.com",
|
||||
"terminal_id": "1747045731408d0tb5M",
|
||||
"mqtt_connected": true,
|
||||
"disabled_by": null,
|
||||
"disabled_polling": false,
|
||||
"id": "bfd0273e59494eb34esvrx",
|
||||
"name": "Cleverio PF100",
|
||||
"category": "cwwsq",
|
||||
"product_id": "wfkzyy0evslzsmoi",
|
||||
"product_name": "Cleverio PF100",
|
||||
"online": true,
|
||||
"sub": false,
|
||||
"time_zone": "+02:00",
|
||||
"active_time": "2024-10-20T13:09:34+00:00",
|
||||
"create_time": "2024-10-20T13:09:34+00:00",
|
||||
"update_time": "2024-10-20T13:09:34+00:00",
|
||||
"function": {
|
||||
"meal_plan": {
|
||||
"type": "Raw",
|
||||
"value": {}
|
||||
},
|
||||
"manual_feed": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "",
|
||||
"min": 1,
|
||||
"max": 20,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"factory_reset": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"light": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
}
|
||||
},
|
||||
"status_range": {
|
||||
"meal_plan": {
|
||||
"type": "Raw",
|
||||
"value": {}
|
||||
},
|
||||
"manual_feed": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "",
|
||||
"min": 1,
|
||||
"max": 20,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"factory_reset": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"battery_percentage": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "%",
|
||||
"min": 0,
|
||||
"max": 100,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"charge_state": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"feed_report": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "",
|
||||
"min": 0,
|
||||
"max": 20,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"light": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"meal_plan": "fwQAAgB/BgABAH8JAAIBfwwAAQB/DwACAX8VAAIBfxcAAQAIEgABAQ==",
|
||||
"manual_feed": 1,
|
||||
"factory_reset": false,
|
||||
"battery_percentage": 90,
|
||||
"charge_state": false,
|
||||
"feed_report": 2,
|
||||
"light": true
|
||||
},
|
||||
"set_up": true,
|
||||
"support_local": true
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
{
|
||||
"endpoint": "https://apigw.tuyaeu.com",
|
||||
"terminal_id": "1751729689584Vh0VoL",
|
||||
"mqtt_connected": true,
|
||||
"disabled_by": null,
|
||||
"disabled_polling": false,
|
||||
"id": "23536058083a8dc57d96",
|
||||
"name": "PIXI Smart Drinking Fountain",
|
||||
"category": "cwysj",
|
||||
"product_id": "z3rpyvznfcch99aa",
|
||||
"product_name": "",
|
||||
"online": true,
|
||||
"sub": false,
|
||||
"time_zone": "+01:00",
|
||||
"active_time": "2025-06-17T13:29:17+00:00",
|
||||
"create_time": "2025-06-17T13:29:17+00:00",
|
||||
"update_time": "2025-06-17T13:29:17+00:00",
|
||||
"function": {
|
||||
"switch": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"water_reset": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"filter_reset": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"pump_reset": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"uv": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"uv_runtime": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "s",
|
||||
"min": 0,
|
||||
"max": 10800,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"status_range": {
|
||||
"switch": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"water_time": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "min",
|
||||
"min": 0,
|
||||
"max": 7200,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"filter_life": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "min",
|
||||
"min": 0,
|
||||
"max": 43200,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"pump_time": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "min",
|
||||
"min": 0,
|
||||
"max": 86400,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"water_reset": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"filter_reset": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"pump_reset": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"uv": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"uv_runtime": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "s",
|
||||
"min": 0,
|
||||
"max": 10800,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"water_level": {
|
||||
"type": "Enum",
|
||||
"value": {
|
||||
"range": ["level_1", "level_2", "level_3"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"switch": true,
|
||||
"water_time": 0,
|
||||
"filter_life": 18965,
|
||||
"pump_time": 18965,
|
||||
"water_reset": false,
|
||||
"filter_reset": false,
|
||||
"pump_reset": false,
|
||||
"uv": false,
|
||||
"uv_runtime": 0,
|
||||
"water_level": "level_3"
|
||||
},
|
||||
"set_up": true,
|
||||
"support_local": true
|
||||
}
|
88
tests/components/tuya/fixtures/cz_dual_channel_metering.json
Normal file
88
tests/components/tuya/fixtures/cz_dual_channel_metering.json
Normal file
@ -0,0 +1,88 @@
|
||||
{
|
||||
"endpoint": "https://apigw.tuyaus.com",
|
||||
"terminal_id": "1742695000703Ozq34h",
|
||||
"mqtt_connected": true,
|
||||
"disabled_by": null,
|
||||
"disabled_polling": false,
|
||||
"id": "eb0c772dabbb19d653ssi5",
|
||||
"name": "HVAC Meter",
|
||||
"category": "cz",
|
||||
"product_id": "2jxesipczks0kdct",
|
||||
"product_name": "Dual channel metering",
|
||||
"online": true,
|
||||
"sub": false,
|
||||
"time_zone": "-07:00",
|
||||
"active_time": "2025-06-19T14:19:08+00:00",
|
||||
"create_time": "2025-06-19T14:19:08+00:00",
|
||||
"update_time": "2025-06-19T14:19:08+00:00",
|
||||
"function": {
|
||||
"switch_1": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"switch_2": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
}
|
||||
},
|
||||
"status_range": {
|
||||
"switch_1": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"switch_2": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"add_ele": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "kwh",
|
||||
"min": 0,
|
||||
"max": 50000,
|
||||
"scale": 3,
|
||||
"step": 100
|
||||
}
|
||||
},
|
||||
"cur_current": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "A",
|
||||
"min": 0,
|
||||
"max": 80000,
|
||||
"scale": 3,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"cur_power": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "W",
|
||||
"min": 0,
|
||||
"max": 200000,
|
||||
"scale": 1,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"cur_voltage": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "V",
|
||||
"min": 0,
|
||||
"max": 5000,
|
||||
"scale": 1,
|
||||
"step": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"switch_1": true,
|
||||
"switch_2": true,
|
||||
"add_ele": 190,
|
||||
"cur_current": 83,
|
||||
"cur_power": 64,
|
||||
"cur_voltage": 1217
|
||||
},
|
||||
"set_up": true,
|
||||
"support_local": true
|
||||
}
|
@ -1,16 +1,38 @@
|
||||
{
|
||||
"endpoint": "https://openapi.tuyaeu.com",
|
||||
"auth_type": 0,
|
||||
"country_code": "380",
|
||||
"app_type": "smartlife",
|
||||
"mqtt_connected": true,
|
||||
"disabled_by": null,
|
||||
"disabled_polling": false,
|
||||
"id": "bf5cccf9027080e2dbb9w3",
|
||||
"name": "Door Sensor",
|
||||
"name": "Door Garage ",
|
||||
"model": "",
|
||||
"category": "mcs",
|
||||
"product_id": "7jIGJAymiH8OsFFb",
|
||||
"product_name": "Door Sensor",
|
||||
"online": true,
|
||||
"sub": true,
|
||||
"time_zone": "+01:00",
|
||||
"active_time": "2024-01-18T12:27:56+00:00",
|
||||
"create_time": "2024-01-18T12:27:56+00:00",
|
||||
"update_time": "2024-01-18T12:29:19+00:00",
|
||||
"function": {},
|
||||
"status_range": {
|
||||
"switch": { "type": "Boolean", "values": "{}" },
|
||||
"switch": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"battery": {
|
||||
"type": "Integer",
|
||||
"values": "{\"unit\": \"\", \"min\": 0, \"max\": 500, \"scale\": 0, \"step\": 1}"
|
||||
"value": {
|
||||
"unit": "",
|
||||
"min": 0,
|
||||
"max": 500,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
|
56
tests/components/tuya/fixtures/sfkzq_valve_controller.json
Normal file
56
tests/components/tuya/fixtures/sfkzq_valve_controller.json
Normal file
@ -0,0 +1,56 @@
|
||||
{
|
||||
"endpoint": "https://apigw.tuyaeu.com",
|
||||
"terminal_id": "1739471569144tcmeiO",
|
||||
"mqtt_connected": true,
|
||||
"disabled_by": null,
|
||||
"disabled_polling": false,
|
||||
"id": "bfb9bfc18eeaed2d85yt5m",
|
||||
"name": "Sprinkler Cesare",
|
||||
"category": "sfkzq",
|
||||
"product_id": "o6dagifntoafakst",
|
||||
"product_name": "Valve Controller",
|
||||
"online": true,
|
||||
"sub": false,
|
||||
"time_zone": "+02:00",
|
||||
"active_time": "2025-06-19T07:56:02+00:00",
|
||||
"create_time": "2025-06-19T07:56:02+00:00",
|
||||
"update_time": "2025-06-19T07:56:02+00:00",
|
||||
"function": {
|
||||
"switch": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"countdown": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "s",
|
||||
"min": 0,
|
||||
"max": 86400,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"status_range": {
|
||||
"switch": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"countdown": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "s",
|
||||
"min": 0,
|
||||
"max": 86400,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"switch": false,
|
||||
"countdown": 0
|
||||
},
|
||||
"set_up": true,
|
||||
"support_local": true
|
||||
}
|
248
tests/components/tuya/fixtures/tdq_4_443.json
Normal file
248
tests/components/tuya/fixtures/tdq_4_443.json
Normal file
@ -0,0 +1,248 @@
|
||||
{
|
||||
"endpoint": "https://apigw.tuyaeu.com",
|
||||
"terminal_id": "1748383912663Y2lvlm",
|
||||
"mqtt_connected": true,
|
||||
"disabled_by": null,
|
||||
"disabled_polling": false,
|
||||
"id": "bf082711d275c0c883vb4p",
|
||||
"name": "4-433",
|
||||
"category": "tdq",
|
||||
"product_id": "cq1p0nt0a4rixnex",
|
||||
"product_name": "4-433",
|
||||
"online": false,
|
||||
"sub": false,
|
||||
"time_zone": "+02:00",
|
||||
"active_time": "2025-06-12T16:57:13+00:00",
|
||||
"create_time": "2025-06-12T16:57:13+00:00",
|
||||
"update_time": "2025-06-12T16:57:13+00:00",
|
||||
"function": {
|
||||
"switch_1": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"switch_2": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"switch_3": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"switch_4": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"countdown_1": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "s",
|
||||
"min": 0,
|
||||
"max": 86400,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"countdown_2": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "s",
|
||||
"min": 0,
|
||||
"max": 86400,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"countdown_3": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "s",
|
||||
"min": 0,
|
||||
"max": 86400,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"countdown_4": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "s",
|
||||
"min": 0,
|
||||
"max": 86400,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"relay_status": {
|
||||
"type": "Enum",
|
||||
"value": {
|
||||
"range": ["0", "1", "2"]
|
||||
}
|
||||
},
|
||||
"random_time": {
|
||||
"type": "String",
|
||||
"value": {
|
||||
"maxlen": 255
|
||||
}
|
||||
},
|
||||
"cycle_time": {
|
||||
"type": "String",
|
||||
"value": {
|
||||
"maxlen": 255
|
||||
}
|
||||
},
|
||||
"switch_inching": {
|
||||
"type": "String",
|
||||
"value": {
|
||||
"maxlen": 255
|
||||
}
|
||||
},
|
||||
"switch_type": {
|
||||
"type": "Enum",
|
||||
"value": {
|
||||
"range": ["flip", "sync", "button"]
|
||||
}
|
||||
},
|
||||
"switch_interlock": {
|
||||
"type": "Raw",
|
||||
"value": {}
|
||||
},
|
||||
"remote_add": {
|
||||
"type": "Raw",
|
||||
"value": {}
|
||||
},
|
||||
"remote_list": {
|
||||
"type": "Raw",
|
||||
"value": {}
|
||||
}
|
||||
},
|
||||
"status_range": {
|
||||
"switch_1": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"switch_2": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"switch_3": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"switch_4": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"countdown_1": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "s",
|
||||
"min": 0,
|
||||
"max": 86400,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"countdown_2": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "s",
|
||||
"min": 0,
|
||||
"max": 86400,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"countdown_3": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "s",
|
||||
"min": 0,
|
||||
"max": 86400,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"countdown_4": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "s",
|
||||
"min": 0,
|
||||
"max": 86400,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"test_bit": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"min": 0,
|
||||
"max": 5,
|
||||
"scale": 0,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"relay_status": {
|
||||
"type": "Enum",
|
||||
"value": {
|
||||
"range": ["0", "1", "2"]
|
||||
}
|
||||
},
|
||||
"random_time": {
|
||||
"type": "String",
|
||||
"value": {
|
||||
"maxlen": 255
|
||||
}
|
||||
},
|
||||
"cycle_time": {
|
||||
"type": "String",
|
||||
"value": {
|
||||
"maxlen": 255
|
||||
}
|
||||
},
|
||||
"switch_inching": {
|
||||
"type": "String",
|
||||
"value": {
|
||||
"maxlen": 255
|
||||
}
|
||||
},
|
||||
"switch_type": {
|
||||
"type": "Enum",
|
||||
"value": {
|
||||
"range": ["flip", "sync", "button"]
|
||||
}
|
||||
},
|
||||
"switch_interlock": {
|
||||
"type": "Raw",
|
||||
"value": {}
|
||||
},
|
||||
"remote_add": {
|
||||
"type": "Raw",
|
||||
"value": {}
|
||||
},
|
||||
"remote_list": {
|
||||
"type": "Raw",
|
||||
"value": {}
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"switch_1": false,
|
||||
"switch_2": false,
|
||||
"switch_3": false,
|
||||
"switch_4": true,
|
||||
"countdown_1": 0,
|
||||
"countdown_2": 0,
|
||||
"countdown_3": 0,
|
||||
"countdown_4": 0,
|
||||
"test_bit": 0,
|
||||
"relay_status": 2,
|
||||
"random_time": "",
|
||||
"cycle_time": "",
|
||||
"switch_inching": "AQAjAwAeBAACBgAC",
|
||||
"switch_type": "button",
|
||||
"switch_interlock": "",
|
||||
"remote_add": "AAA=",
|
||||
"remote_list": "AA=="
|
||||
},
|
||||
"set_up": true,
|
||||
"support_local": true
|
||||
}
|
50
tests/components/tuya/snapshots/test_binary_sensor.ambr
Normal file
50
tests/components/tuya/snapshots/test_binary_sensor.ambr
Normal file
@ -0,0 +1,50 @@
|
||||
# serializer version: 1
|
||||
# name: test_platform_setup_and_discovery[mcs_door_sensor][binary_sensor.door_garage_door-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'binary_sensor.door_garage_door',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.DOOR: 'door'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Door',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'tuya.bf5cccf9027080e2dbb9w3switch',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[mcs_door_sensor][binary_sensor.door_garage_door-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'door',
|
||||
'friendly_name': 'Door Garage Door',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.door_garage_door',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
58
tests/components/tuya/snapshots/test_number.ambr
Normal file
58
tests/components/tuya/snapshots/test_number.ambr
Normal file
@ -0,0 +1,58 @@
|
||||
# serializer version: 1
|
||||
# name: test_platform_setup_and_discovery[cwwsq_cleverio_pf100][number.cleverio_pf100_feed-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 20.0,
|
||||
'min': 1.0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': None,
|
||||
'entity_id': 'number.cleverio_pf100_feed',
|
||||
'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': 'Feed',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'feed',
|
||||
'unique_id': 'tuya.bfd0273e59494eb34esvrxmanual_feed',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwwsq_cleverio_pf100][number.cleverio_pf100_feed-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Cleverio PF100 Feed',
|
||||
'max': 20.0,
|
||||
'min': 1.0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.cleverio_pf100_feed',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '1.0',
|
||||
})
|
||||
# ---
|
@ -60,3 +60,62 @@
|
||||
'state': 'cancel',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[tdq_4_443][select.4_433_power_on_behavior-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'options': list([
|
||||
'0',
|
||||
'1',
|
||||
'2',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'select',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'select.4_433_power_on_behavior',
|
||||
'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': 'Power on behavior',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'relay_status',
|
||||
'unique_id': 'tuya.bf082711d275c0c883vb4prelay_status',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[tdq_4_443][select.4_433_power_on_behavior-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': '4-433 Power on behavior',
|
||||
'options': list([
|
||||
'0',
|
||||
'1',
|
||||
'2',
|
||||
]),
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'select.4_433_power_on_behavior',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unavailable',
|
||||
})
|
||||
# ---
|
||||
|
@ -52,7 +52,483 @@
|
||||
'state': '47.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[mcs_door_sensor][sensor.door_sensor_battery-entry]
|
||||
# name: test_platform_setup_and_discovery[cwwsq_cleverio_pf100][sensor.cleverio_pf100_last_amount-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.cleverio_pf100_last_amount',
|
||||
'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': 'Last amount',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'last_amount',
|
||||
'unique_id': 'tuya.bfd0273e59494eb34esvrxfeed_report',
|
||||
'unit_of_measurement': '',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwwsq_cleverio_pf100][sensor.cleverio_pf100_last_amount-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Cleverio PF100 Last amount',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': '',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.cleverio_pf100_last_amount',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '2.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][sensor.pixi_smart_drinking_fountain_filter_duration-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.pixi_smart_drinking_fountain_filter_duration',
|
||||
'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': 'Filter duration',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'filter_duration',
|
||||
'unique_id': 'tuya.23536058083a8dc57d96filter_life',
|
||||
'unit_of_measurement': 'min',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][sensor.pixi_smart_drinking_fountain_filter_duration-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'PIXI Smart Drinking Fountain Filter duration',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': 'min',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.pixi_smart_drinking_fountain_filter_duration',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '18965.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][sensor.pixi_smart_drinking_fountain_uv_runtime-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.pixi_smart_drinking_fountain_uv_runtime',
|
||||
'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': 'UV runtime',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'uv_runtime',
|
||||
'unique_id': 'tuya.23536058083a8dc57d96uv_runtime',
|
||||
'unit_of_measurement': 's',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][sensor.pixi_smart_drinking_fountain_uv_runtime-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'PIXI Smart Drinking Fountain UV runtime',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': 's',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.pixi_smart_drinking_fountain_uv_runtime',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '0.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][sensor.pixi_smart_drinking_fountain_water_level-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.pixi_smart_drinking_fountain_water_level',
|
||||
'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': 'Water level',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'water_level_state',
|
||||
'unique_id': 'tuya.23536058083a8dc57d96water_level',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][sensor.pixi_smart_drinking_fountain_water_level-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'PIXI Smart Drinking Fountain Water level',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.pixi_smart_drinking_fountain_water_level',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'level_3',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][sensor.pixi_smart_drinking_fountain_water_pump_duration-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.pixi_smart_drinking_fountain_water_pump_duration',
|
||||
'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': 'Water pump duration',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'pump_time',
|
||||
'unique_id': 'tuya.23536058083a8dc57d96pump_time',
|
||||
'unit_of_measurement': 'min',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][sensor.pixi_smart_drinking_fountain_water_pump_duration-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'PIXI Smart Drinking Fountain Water pump duration',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': 'min',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.pixi_smart_drinking_fountain_water_pump_duration',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '18965.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][sensor.pixi_smart_drinking_fountain_water_usage_duration-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.pixi_smart_drinking_fountain_water_usage_duration',
|
||||
'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': 'Water usage duration',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'water_time',
|
||||
'unique_id': 'tuya.23536058083a8dc57d96water_time',
|
||||
'unit_of_measurement': 'min',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][sensor.pixi_smart_drinking_fountain_water_usage_duration-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'PIXI Smart Drinking Fountain Water usage duration',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': 'min',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.pixi_smart_drinking_fountain_water_usage_duration',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '0.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cz_dual_channel_metering][sensor.hvac_meter_current-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.hvac_meter_current',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 2,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.CURRENT: 'current'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Current',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'current',
|
||||
'unique_id': 'tuya.eb0c772dabbb19d653ssi5cur_current',
|
||||
'unit_of_measurement': <UnitOfElectricCurrent.AMPERE: 'A'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cz_dual_channel_metering][sensor.hvac_meter_current-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'current',
|
||||
'friendly_name': 'HVAC Meter Current',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': <UnitOfElectricCurrent.AMPERE: 'A'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.hvac_meter_current',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '0.083',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cz_dual_channel_metering][sensor.hvac_meter_power-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.hvac_meter_power',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 0,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.POWER: 'power'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Power',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'power',
|
||||
'unique_id': 'tuya.eb0c772dabbb19d653ssi5cur_power',
|
||||
'unit_of_measurement': <UnitOfPower.WATT: 'W'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cz_dual_channel_metering][sensor.hvac_meter_power-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'power',
|
||||
'friendly_name': 'HVAC Meter Power',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': <UnitOfPower.WATT: 'W'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.hvac_meter_power',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '6.4',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cz_dual_channel_metering][sensor.hvac_meter_voltage-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.hvac_meter_voltage',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 0,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.VOLTAGE: 'voltage'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Voltage',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'voltage',
|
||||
'unique_id': 'tuya.eb0c772dabbb19d653ssi5cur_voltage',
|
||||
'unit_of_measurement': <UnitOfElectricPotential.VOLT: 'V'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cz_dual_channel_metering][sensor.hvac_meter_voltage-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'voltage',
|
||||
'friendly_name': 'HVAC Meter Voltage',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': <UnitOfElectricPotential.VOLT: 'V'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.hvac_meter_voltage',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '121.7',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[mcs_door_sensor][sensor.door_garage_battery-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
@ -67,7 +543,7 @@
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.door_sensor_battery',
|
||||
'entity_id': 'sensor.door_garage_battery',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
@ -89,16 +565,16 @@
|
||||
'unit_of_measurement': '%',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[mcs_door_sensor][sensor.door_sensor_battery-state]
|
||||
# name: test_platform_setup_and_discovery[mcs_door_sensor][sensor.door_garage_battery-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'battery',
|
||||
'friendly_name': 'Door Sensor Battery',
|
||||
'friendly_name': 'Door Garage Battery',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': '%',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.door_sensor_battery',
|
||||
'entity_id': 'sensor.door_garage_battery',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
632
tests/components/tuya/snapshots/test_switch.ambr
Normal file
632
tests/components/tuya/snapshots/test_switch.ambr
Normal file
@ -0,0 +1,632 @@
|
||||
# serializer version: 1
|
||||
# name: test_platform_setup_and_discovery[cs_arete_two_12l_dehumidifier_air_purifier][switch.dehumidifier_child_lock-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'switch.dehumidifier_child_lock',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:account-lock',
|
||||
'original_name': 'Child lock',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'child_lock',
|
||||
'unique_id': 'tuya.bf3fce6af592f12df3gbgqchild_lock',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cs_arete_two_12l_dehumidifier_air_purifier][switch.dehumidifier_child_lock-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Dehumidifier Child lock',
|
||||
'icon': 'mdi:account-lock',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.dehumidifier_child_lock',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][switch.pixi_smart_drinking_fountain_filter_reset-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'switch.pixi_smart_drinking_fountain_filter_reset',
|
||||
'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': 'Filter reset',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'filter_reset',
|
||||
'unique_id': 'tuya.23536058083a8dc57d96filter_reset',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][switch.pixi_smart_drinking_fountain_filter_reset-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'PIXI Smart Drinking Fountain Filter reset',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.pixi_smart_drinking_fountain_filter_reset',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][switch.pixi_smart_drinking_fountain_power-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.pixi_smart_drinking_fountain_power',
|
||||
'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': 'Power',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'power',
|
||||
'unique_id': 'tuya.23536058083a8dc57d96switch',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][switch.pixi_smart_drinking_fountain_power-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'PIXI Smart Drinking Fountain Power',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.pixi_smart_drinking_fountain_power',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][switch.pixi_smart_drinking_fountain_reset_of_water_usage_days-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'switch.pixi_smart_drinking_fountain_reset_of_water_usage_days',
|
||||
'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': 'Reset of water usage days',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'reset_of_water_usage_days',
|
||||
'unique_id': 'tuya.23536058083a8dc57d96water_reset',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][switch.pixi_smart_drinking_fountain_reset_of_water_usage_days-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'PIXI Smart Drinking Fountain Reset of water usage days',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.pixi_smart_drinking_fountain_reset_of_water_usage_days',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][switch.pixi_smart_drinking_fountain_uv_sterilization-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'switch.pixi_smart_drinking_fountain_uv_sterilization',
|
||||
'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': 'UV sterilization',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'uv_sterilization',
|
||||
'unique_id': 'tuya.23536058083a8dc57d96uv',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][switch.pixi_smart_drinking_fountain_uv_sterilization-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'PIXI Smart Drinking Fountain UV sterilization',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.pixi_smart_drinking_fountain_uv_sterilization',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][switch.pixi_smart_drinking_fountain_water_pump_reset-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'switch.pixi_smart_drinking_fountain_water_pump_reset',
|
||||
'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': 'Water pump reset',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'water_pump_reset',
|
||||
'unique_id': 'tuya.23536058083a8dc57d96pump_reset',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cwysj_pixi_smart_drinking_fountain][switch.pixi_smart_drinking_fountain_water_pump_reset-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'PIXI Smart Drinking Fountain Water pump reset',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.pixi_smart_drinking_fountain_water_pump_reset',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cz_dual_channel_metering][switch.hvac_meter_socket_1-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.hvac_meter_socket_1',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SwitchDeviceClass.OUTLET: 'outlet'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Socket 1',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'socket_1',
|
||||
'unique_id': 'tuya.eb0c772dabbb19d653ssi5switch_1',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cz_dual_channel_metering][switch.hvac_meter_socket_1-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'outlet',
|
||||
'friendly_name': 'HVAC Meter Socket 1',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.hvac_meter_socket_1',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cz_dual_channel_metering][switch.hvac_meter_socket_2-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.hvac_meter_socket_2',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SwitchDeviceClass.OUTLET: 'outlet'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Socket 2',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'socket_2',
|
||||
'unique_id': 'tuya.eb0c772dabbb19d653ssi5switch_2',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[cz_dual_channel_metering][switch.hvac_meter_socket_2-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'outlet',
|
||||
'friendly_name': 'HVAC Meter Socket 2',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.hvac_meter_socket_2',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[sfkzq_valve_controller][switch.sprinkler_cesare_switch-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.sprinkler_cesare_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': 'Switch',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'switch',
|
||||
'unique_id': 'tuya.bfb9bfc18eeaed2d85yt5mswitch',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[sfkzq_valve_controller][switch.sprinkler_cesare_switch-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Sprinkler Cesare Switch',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.sprinkler_cesare_switch',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[tdq_4_443][switch.4_433_switch_1-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.4_433_switch_1',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SwitchDeviceClass.OUTLET: 'outlet'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Switch 1',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'switch_1',
|
||||
'unique_id': 'tuya.bf082711d275c0c883vb4pswitch_1',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[tdq_4_443][switch.4_433_switch_1-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'outlet',
|
||||
'friendly_name': '4-433 Switch 1',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.4_433_switch_1',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unavailable',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[tdq_4_443][switch.4_433_switch_2-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.4_433_switch_2',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SwitchDeviceClass.OUTLET: 'outlet'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Switch 2',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'switch_2',
|
||||
'unique_id': 'tuya.bf082711d275c0c883vb4pswitch_2',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[tdq_4_443][switch.4_433_switch_2-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'outlet',
|
||||
'friendly_name': '4-433 Switch 2',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.4_433_switch_2',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unavailable',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[tdq_4_443][switch.4_433_switch_3-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.4_433_switch_3',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SwitchDeviceClass.OUTLET: 'outlet'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Switch 3',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'switch_3',
|
||||
'unique_id': 'tuya.bf082711d275c0c883vb4pswitch_3',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[tdq_4_443][switch.4_433_switch_3-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'outlet',
|
||||
'friendly_name': '4-433 Switch 3',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.4_433_switch_3',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unavailable',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[tdq_4_443][switch.4_433_switch_4-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.4_433_switch_4',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SwitchDeviceClass.OUTLET: 'outlet'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Switch 4',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'switch_4',
|
||||
'unique_id': 'tuya.bf082711d275c0c883vb4pswitch_4',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[tdq_4_443][switch.4_433_switch_4-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'outlet',
|
||||
'friendly_name': '4-433 Switch 4',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.4_433_switch_4',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unavailable',
|
||||
})
|
||||
# ---
|
58
tests/components/tuya/test_binary_sensor.py
Normal file
58
tests/components/tuya/test_binary_sensor.py
Normal file
@ -0,0 +1,58 @@
|
||||
"""Test Tuya binary sensor platform."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
from tuya_sharing import CustomerDevice
|
||||
|
||||
from homeassistant.components.tuya import ManagerCompat
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from . import DEVICE_MOCKS, initialize_entry
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mock_device_code",
|
||||
[k for k, v in DEVICE_MOCKS.items() if Platform.BINARY_SENSOR in v],
|
||||
)
|
||||
@patch("homeassistant.components.tuya.PLATFORMS", [Platform.BINARY_SENSOR])
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_platform_setup_and_discovery(
|
||||
hass: HomeAssistant,
|
||||
mock_manager: ManagerCompat,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_device: CustomerDevice,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test platform setup and discovery."""
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mock_device_code",
|
||||
[k for k, v in DEVICE_MOCKS.items() if Platform.BINARY_SENSOR not in v],
|
||||
)
|
||||
@patch("homeassistant.components.tuya.PLATFORMS", [Platform.BINARY_SENSOR])
|
||||
async def test_platform_setup_no_discovery(
|
||||
hass: HomeAssistant,
|
||||
mock_manager: ManagerCompat,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_device: CustomerDevice,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test platform setup and discovery."""
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
assert not er.async_entries_for_config_entry(
|
||||
entity_registry, mock_config_entry.entry_id
|
||||
)
|
@ -13,13 +13,13 @@ from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from . import initialize_entry
|
||||
from . import DEVICE_MOCKS, initialize_entry
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mock_device_code", ["cs_arete_two_12l_dehumidifier_air_purifier"]
|
||||
"mock_device_code", [k for k, v in DEVICE_MOCKS.items() if Platform.FAN in v]
|
||||
)
|
||||
@patch("homeassistant.components.tuya.PLATFORMS", [Platform.FAN])
|
||||
async def test_platform_setup_and_discovery(
|
||||
@ -34,3 +34,22 @@ async def test_platform_setup_and_discovery(
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mock_device_code", [k for k, v in DEVICE_MOCKS.items() if Platform.FAN not in v]
|
||||
)
|
||||
@patch("homeassistant.components.tuya.PLATFORMS", [Platform.FAN])
|
||||
async def test_platform_setup_no_discovery(
|
||||
hass: HomeAssistant,
|
||||
mock_manager: ManagerCompat,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_device: CustomerDevice,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test platform setup and discovery."""
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
assert not er.async_entries_for_config_entry(
|
||||
entity_registry, mock_config_entry.entry_id
|
||||
)
|
||||
|
@ -13,13 +13,13 @@ from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from . import initialize_entry
|
||||
from . import DEVICE_MOCKS, initialize_entry
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mock_device_code", ["cs_arete_two_12l_dehumidifier_air_purifier"]
|
||||
"mock_device_code", [k for k, v in DEVICE_MOCKS.items() if Platform.HUMIDIFIER in v]
|
||||
)
|
||||
@patch("homeassistant.components.tuya.PLATFORMS", [Platform.HUMIDIFIER])
|
||||
async def test_platform_setup_and_discovery(
|
||||
@ -34,3 +34,23 @@ async def test_platform_setup_and_discovery(
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mock_device_code",
|
||||
[k for k, v in DEVICE_MOCKS.items() if Platform.HUMIDIFIER not in v],
|
||||
)
|
||||
@patch("homeassistant.components.tuya.PLATFORMS", [Platform.HUMIDIFIER])
|
||||
async def test_platform_setup_no_discovery(
|
||||
hass: HomeAssistant,
|
||||
mock_manager: ManagerCompat,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_device: CustomerDevice,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test platform setup and discovery."""
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
assert not er.async_entries_for_config_entry(
|
||||
entity_registry, mock_config_entry.entry_id
|
||||
)
|
||||
|
55
tests/components/tuya/test_number.py
Normal file
55
tests/components/tuya/test_number.py
Normal file
@ -0,0 +1,55 @@
|
||||
"""Test Tuya number platform."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
from tuya_sharing import CustomerDevice
|
||||
|
||||
from homeassistant.components.tuya import ManagerCompat
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from . import DEVICE_MOCKS, initialize_entry
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mock_device_code", [k for k, v in DEVICE_MOCKS.items() if Platform.NUMBER in v]
|
||||
)
|
||||
@patch("homeassistant.components.tuya.PLATFORMS", [Platform.NUMBER])
|
||||
async def test_platform_setup_and_discovery(
|
||||
hass: HomeAssistant,
|
||||
mock_manager: ManagerCompat,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_device: CustomerDevice,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test platform setup and discovery."""
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mock_device_code", [k for k, v in DEVICE_MOCKS.items() if Platform.NUMBER not in v]
|
||||
)
|
||||
@patch("homeassistant.components.tuya.PLATFORMS", [Platform.NUMBER])
|
||||
async def test_platform_setup_no_discovery(
|
||||
hass: HomeAssistant,
|
||||
mock_manager: ManagerCompat,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_device: CustomerDevice,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test platform setup and discovery."""
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
assert not er.async_entries_for_config_entry(
|
||||
entity_registry, mock_config_entry.entry_id
|
||||
)
|
@ -13,13 +13,13 @@ from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from . import initialize_entry
|
||||
from . import DEVICE_MOCKS, initialize_entry
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mock_device_code", ["cs_arete_two_12l_dehumidifier_air_purifier"]
|
||||
"mock_device_code", [k for k, v in DEVICE_MOCKS.items() if Platform.SELECT in v]
|
||||
)
|
||||
@patch("homeassistant.components.tuya.PLATFORMS", [Platform.SELECT])
|
||||
async def test_platform_setup_and_discovery(
|
||||
@ -34,3 +34,22 @@ async def test_platform_setup_and_discovery(
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mock_device_code", [k for k, v in DEVICE_MOCKS.items() if Platform.SELECT not in v]
|
||||
)
|
||||
@patch("homeassistant.components.tuya.PLATFORMS", [Platform.SELECT])
|
||||
async def test_platform_setup_no_discovery(
|
||||
hass: HomeAssistant,
|
||||
mock_manager: ManagerCompat,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_device: CustomerDevice,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test platform setup and discovery."""
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
assert not er.async_entries_for_config_entry(
|
||||
entity_registry, mock_config_entry.entry_id
|
||||
)
|
||||
|
@ -13,16 +13,16 @@ from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from . import initialize_entry
|
||||
from . import DEVICE_MOCKS, initialize_entry
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mock_device_code",
|
||||
["cs_arete_two_12l_dehumidifier_air_purifier", "mcs_door_sensor"],
|
||||
"mock_device_code", [k for k, v in DEVICE_MOCKS.items() if Platform.SENSOR in v]
|
||||
)
|
||||
@patch("homeassistant.components.tuya.PLATFORMS", [Platform.SENSOR])
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_platform_setup_and_discovery(
|
||||
hass: HomeAssistant,
|
||||
mock_manager: ManagerCompat,
|
||||
@ -35,3 +35,22 @@ async def test_platform_setup_and_discovery(
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mock_device_code", [k for k, v in DEVICE_MOCKS.items() if Platform.SENSOR not in v]
|
||||
)
|
||||
@patch("homeassistant.components.tuya.PLATFORMS", [Platform.SENSOR])
|
||||
async def test_platform_setup_no_discovery(
|
||||
hass: HomeAssistant,
|
||||
mock_manager: ManagerCompat,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_device: CustomerDevice,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test platform setup and discovery."""
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
assert not er.async_entries_for_config_entry(
|
||||
entity_registry, mock_config_entry.entry_id
|
||||
)
|
||||
|
55
tests/components/tuya/test_switch.py
Normal file
55
tests/components/tuya/test_switch.py
Normal file
@ -0,0 +1,55 @@
|
||||
"""Test Tuya switch platform."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
from tuya_sharing import CustomerDevice
|
||||
|
||||
from homeassistant.components.tuya import ManagerCompat
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from . import DEVICE_MOCKS, initialize_entry
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mock_device_code", [k for k, v in DEVICE_MOCKS.items() if Platform.SWITCH in v]
|
||||
)
|
||||
@patch("homeassistant.components.tuya.PLATFORMS", [Platform.SWITCH])
|
||||
async def test_platform_setup_and_discovery(
|
||||
hass: HomeAssistant,
|
||||
mock_manager: ManagerCompat,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_device: CustomerDevice,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test platform setup and discovery."""
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"mock_device_code", [k for k, v in DEVICE_MOCKS.items() if Platform.SWITCH not in v]
|
||||
)
|
||||
@patch("homeassistant.components.tuya.PLATFORMS", [Platform.SWITCH])
|
||||
async def test_platform_setup_no_discovery(
|
||||
hass: HomeAssistant,
|
||||
mock_manager: ManagerCompat,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_device: CustomerDevice,
|
||||
entity_registry: er.EntityRegistry,
|
||||
) -> None:
|
||||
"""Test platform setup and discovery."""
|
||||
await initialize_entry(hass, mock_manager, mock_config_entry, mock_device)
|
||||
|
||||
assert not er.async_entries_for_config_entry(
|
||||
entity_registry, mock_config_entry.entry_id
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user