Add tuya snapshot tests for kg category (#148492)

This commit is contained in:
epenet 2025-07-09 16:20:29 +02:00 committed by GitHub
parent 59fe6da47c
commit 511ffdc03c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 109 additions and 0 deletions

View File

@ -40,6 +40,10 @@ DEVICE_MOCKS = {
Platform.SENSOR, Platform.SENSOR,
Platform.SWITCH, Platform.SWITCH,
], ],
"kg_smart_valve": [
# https://github.com/home-assistant/core/issues/148347
Platform.SWITCH,
],
"kj_bladeless_tower_fan": [ "kj_bladeless_tower_fan": [
# https://github.com/orgs/home-assistant/discussions/61 # https://github.com/orgs/home-assistant/discussions/61
Platform.FAN, Platform.FAN,

View File

@ -0,0 +1,56 @@
{
"endpoint": "https://apigw.tuyaus.com",
"terminal_id": "1750526976566fMhqJs",
"mqtt_connected": true,
"disabled_by": null,
"disabled_polling": true,
"id": "0665305284f3ebe9fdc1",
"name": "QT-Switch",
"category": "kg",
"product_id": "gbm9ata1zrzaez4a",
"product_name": "Smart Valve",
"online": false,
"sub": false,
"time_zone": "-05:00",
"active_time": "2020-01-27T23:37:47+00:00",
"create_time": "2020-01-27T23:37:47+00:00",
"update_time": "2020-01-27T23:37:47+00:00",
"function": {
"switch_1": {
"type": "Boolean",
"value": {}
},
"countdown_1": {
"type": "Integer",
"value": {
"unit": "s",
"min": 0,
"max": 86400,
"scale": 0,
"step": 1
}
}
},
"status_range": {
"switch_1": {
"type": "Boolean",
"value": {}
},
"countdown_1": {
"type": "Integer",
"value": {
"unit": "s",
"min": 0,
"max": 86400,
"scale": 0,
"step": 1
}
}
},
"status": {
"switch_1": false,
"countdown_1": 0
},
"set_up": true,
"support_local": true
}

View File

@ -386,6 +386,55 @@
'state': 'on', 'state': 'on',
}) })
# --- # ---
# name: test_platform_setup_and_discovery[kg_smart_valve][switch.qt_switch_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.qt_switch_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.0665305284f3ebe9fdc1switch_1',
'unit_of_measurement': None,
})
# ---
# name: test_platform_setup_and_discovery[kg_smart_valve][switch.qt_switch_switch_1-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'outlet',
'friendly_name': 'QT-Switch Switch 1',
}),
'context': <ANY>,
'entity_id': 'switch.qt_switch_switch_1',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unavailable',
})
# ---
# name: test_platform_setup_and_discovery[kj_bladeless_tower_fan][switch.bree_power-entry] # name: test_platform_setup_and_discovery[kj_bladeless_tower_fan][switch.bree_power-entry]
EntityRegistryEntrySnapshot({ EntityRegistryEntrySnapshot({
'aliases': set({ 'aliases': set({