Add Tuya test fixtures (#151185)

This commit is contained in:
epenet
2025-08-26 11:46:53 +02:00
committed by GitHub
parent 4b5ab472ad
commit d0c5f291fc
6 changed files with 450 additions and 0 deletions

View File

@@ -179,6 +179,7 @@ DEVICE_MOCKS = [
"sp_rjKXWRohlvOTyLBu", # https://github.com/home-assistant/core/issues/149704
"sp_rudejjigkywujjvs", # https://github.com/home-assistant/core/issues/146164
"sp_sdd5f5f2dl5wydjf", # https://github.com/home-assistant/core/issues/144087
"swtz_3rzngbyy", # https://github.com/orgs/home-assistant/discussions/688
"tdq_1aegphq4yfd50e6b", # https://github.com/home-assistant/core/issues/143209
"tdq_9htyiowaf5rtdhrv", # https://github.com/home-assistant/core/issues/143209
"tdq_cq1p0nt0a4rixnex", # https://github.com/home-assistant/core/issues/146845
@@ -215,6 +216,7 @@ DEVICE_MOCKS = [
"wsdcg_yqiqbaldtr0i7mru", # https://github.com/home-assistant/core/issues/136223
"wxkg_ja5osu5g", # https://github.com/orgs/home-assistant/discussions/482
"wxkg_l8yaz4um5b3pwyvf", # https://github.com/home-assistant/core/issues/93975
"xdd_shx9mmadyyeaq88t", # https://github.com/home-assistant/core/issues/151141
"ydkt_jevroj5aguwdbs2e", # https://github.com/orgs/home-assistant/discussions/288
"ygsb_l6ax0u6jwbz82atk", # https://github.com/home-assistant/core/issues/146319
"ykq_bngwdjsr", # https://github.com/orgs/home-assistant/discussions/482

View File

@@ -0,0 +1,116 @@
{
"endpoint": "https://apigw.tuyaeu.com",
"mqtt_connected": true,
"disabled_by": null,
"disabled_polling": false,
"name": "Grillh\u0151m\u00e9r\u0151",
"category": "swtz",
"product_id": "3rzngbyy",
"product_name": "Cooking Thermometer",
"online": false,
"sub": true,
"time_zone": "+02:00",
"active_time": "2025-08-17T19:59:22+00:00",
"create_time": "2025-08-17T19:59:22+00:00",
"update_time": "2025-08-17T19:59:22+00:00",
"function": {
"cook_temperature": {
"type": "Integer",
"value": {
"unit": "\u2103",
"min": -300,
"max": 3000,
"scale": 1,
"step": 1
}
},
"cook_temperature_2": {
"type": "Integer",
"value": {
"unit": "\u2103",
"min": -300,
"max": 3000,
"scale": 1,
"step": 1
}
},
"temp_unit_convert": {
"type": "Enum",
"value": {
"range": ["c", "f"]
}
},
"alarm_switch": {
"type": "Boolean",
"value": {}
}
},
"status_range": {
"battery_percentage": {
"type": "Integer",
"value": {
"unit": "%",
"min": 0,
"max": 100,
"scale": 0,
"step": 1
}
},
"temp_current": {
"type": "Integer",
"value": {
"unit": "\u2103",
"min": -300,
"max": 3000,
"scale": 1,
"step": 1
}
},
"temp_current_2": {
"type": "Integer",
"value": {
"unit": "\u2103",
"min": -300,
"max": 3000,
"scale": 1,
"step": 1
}
},
"cook_temperature": {
"type": "Integer",
"value": {
"unit": "\u2103",
"min": -300,
"max": 3000,
"scale": 1,
"step": 1
}
},
"cook_temperature_2": {
"type": "Integer",
"value": {
"unit": "\u2103",
"min": -300,
"max": 3000,
"scale": 1,
"step": 1
}
},
"temp_unit_convert": {
"type": "Enum",
"value": {
"range": ["c", "f"]
}
}
},
"status": {
"battery_percentage": 100,
"temp_current": 290,
"temp_current_2": 290,
"cook_temperature": -300,
"cook_temperature_2": -300,
"temp_unit_convert": "c"
},
"set_up": false,
"support_local": true
}

View File

@@ -0,0 +1,139 @@
{
"endpoint": "https://apigw.tuyaeu.com",
"mqtt_connected": true,
"disabled_by": null,
"disabled_polling": false,
"name": "Plafond bureau ",
"category": "xdd",
"product_id": "shx9mmadyyeaq88t",
"product_name": "Five way ceiling lamp",
"online": true,
"sub": false,
"time_zone": "+01:00",
"active_time": "2023-11-10T15:45:03+00:00",
"create_time": "2023-11-10T15:45:03+00:00",
"update_time": "2023-11-10T15:45:03+00:00",
"function": {
"switch_led": {
"type": "Boolean",
"value": {}
},
"work_mode": {
"type": "Enum",
"value": {
"range": ["white", "colour", "scene", "music"]
}
},
"bright_value": {
"type": "Integer",
"value": {
"min": 10,
"max": 1000,
"scale": 0,
"step": 1
}
},
"temp_value": {
"type": "Integer",
"value": {
"min": 0,
"max": 1000,
"scale": 0,
"step": 1
}
},
"colour_data": {
"type": "Json",
"value": {}
},
"countdown": {
"type": "Integer",
"value": {
"unit": "s",
"min": 0,
"max": 86400,
"scale": 0,
"step": 1
}
},
"music_data": {
"type": "String",
"value": {
"maxlen": 255
}
},
"control_data": {
"type": "String",
"value": {
"maxlen": 255
}
},
"do_not_disturb": {
"type": "Boolean",
"value": {}
}
},
"status_range": {
"switch_led": {
"type": "Boolean",
"value": {}
},
"work_mode": {
"type": "Enum",
"value": {
"range": ["white", "colour", "scene", "music"]
}
},
"bright_value": {
"type": "Integer",
"value": {
"min": 10,
"max": 1000,
"scale": 0,
"step": 1
}
},
"temp_value": {
"type": "Integer",
"value": {
"min": 0,
"max": 1000,
"scale": 0,
"step": 1
}
},
"colour_data": {
"type": "Json",
"value": {}
},
"countdown": {
"type": "Integer",
"value": {
"unit": "s",
"min": 0,
"max": 86400,
"scale": 0,
"step": 1
}
},
"do_not_disturb": {
"type": "Boolean",
"value": {}
}
},
"status": {
"switch_led": true,
"work_mode": "white",
"bright_value": 946,
"temp_value": 689,
"colour_data": {
"h": 308,
"s": 381,
"v": 1000
},
"countdown": 0,
"do_not_disturb": false
},
"set_up": true,
"support_local": true
}

View File

@@ -5672,6 +5672,37 @@
'via_device_id': None,
})
# ---
# name: test_device_registry[t88qaeyydamm9xhsddx]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'config_entries_subentries': <ANY>,
'configuration_url': None,
'connections': set({
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'tuya',
't88qaeyydamm9xhsddx',
),
}),
'labels': set({
}),
'manufacturer': 'Tuya',
'model': 'Five way ceiling lamp',
'model_id': 'shx9mmadyyeaq88t',
'name': 'Plafond bureau ',
'name_by_user': None,
'primary_config_entry': <ANY>,
'serial_number': None,
'sw_version': None,
'via_device_id': None,
})
# ---
# name: test_device_registry[tcdk0skzcpisexj2zc]
DeviceRegistryEntrySnapshot({
'area_id': None,
@@ -6416,6 +6447,37 @@
'via_device_id': None,
})
# ---
# name: test_device_registry[yybgnzr3ztws]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'config_entries_subentries': <ANY>,
'configuration_url': None,
'connections': set({
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'tuya',
'yybgnzr3ztws',
),
}),
'labels': set({
}),
'manufacturer': 'Tuya',
'model': 'Cooking Thermometer (unsupported)',
'model_id': '3rzngbyy',
'name': 'Grillhőmérő',
'name_by_user': None,
'primary_config_entry': <ANY>,
'serial_number': None,
'sw_version': None,
'via_device_id': None,
})
# ---
# name: test_device_registry[z7cu5t8bl9tt9fabjd]
DeviceRegistryEntrySnapshot({
'area_id': None,

View File

@@ -2347,6 +2347,89 @@
'state': 'unavailable',
})
# ---
# name: test_platform_setup_and_discovery[light.plafond_bureau-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'max_color_temp_kelvin': 6500,
'max_mireds': 500,
'min_color_temp_kelvin': 2000,
'min_mireds': 153,
'supported_color_modes': list([
<ColorMode.COLOR_TEMP: 'color_temp'>,
<ColorMode.HS: 'hs'>,
]),
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'light',
'entity_category': None,
'entity_id': 'light.plafond_bureau',
'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': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'tuya.t88qaeyydamm9xhsddxswitch_led',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[light.plafond_bureau-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'brightness': 241,
'color_mode': <ColorMode.COLOR_TEMP: 'color_temp'>,
'color_temp': 260,
'color_temp_kelvin': 3832,
'friendly_name': 'Plafond bureau ',
'hs_color': tuple(
26.903,
38.001,
),
'max_color_temp_kelvin': 6500,
'max_mireds': 500,
'min_color_temp_kelvin': 2000,
'min_mireds': 153,
'rgb_color': tuple(
255,
202,
158,
),
'supported_color_modes': list([
<ColorMode.COLOR_TEMP: 'color_temp'>,
<ColorMode.HS: 'hs'>,
]),
'supported_features': <LightEntityFeature: 0>,
'xy_color': tuple(
0.43,
0.368,
),
}),
'context': <ANY>,
'entity_id': 'light.plafond_bureau',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_platform_setup_and_discovery[light.pokerlamp_1-entry]
EntityRegistryEntrySnapshot({
'aliases': set({

View File

@@ -5948,6 +5948,54 @@
'state': 'off',
})
# ---
# name: test_platform_setup_and_discovery[switch.plafond_bureau_do_not_disturb-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.plafond_bureau_do_not_disturb',
'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': 'Do not disturb',
'platform': 'tuya',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'do_not_disturb',
'unique_id': 'tuya.t88qaeyydamm9xhsddxdo_not_disturb',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[switch.plafond_bureau_do_not_disturb-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Plafond bureau Do not disturb',
}),
'context': <ANY>,
'entity_id': 'switch.plafond_bureau_do_not_disturb',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_platform_setup_and_discovery[switch.powerplug_5_socket_1-entry]
EntityRegistryEntrySnapshot({
'aliases': set({