Rename Tuya fixtures (#171169)

This commit is contained in:
epenet
2026-05-19 08:22:09 +02:00
committed by GitHub
parent c80d1ba003
commit d7b63a40db
7 changed files with 126 additions and 122 deletions
@@ -7,19 +7,19 @@
"disabled_by": null,
"disabled_polling": false,
"name": "AK1",
"model": "SP22A",
"name": "Casa1",
"model": "",
"category": "cz",
"product_id": "fbvia0apnlnattcy",
"product_name": "Smart Socket-16A",
"product_id": "ExGgQmjt0SHMdlDZ",
"product_name": "PZ003",
"online": false,
"sub": false,
"time_zone": "+02:00",
"active_time": "2023-06-25T18:04:38+00:00",
"create_time": "2023-05-04T13:26:58+00:00",
"update_time": "2023-07-12T21:24:50+00:00",
"time_zone": "+01:00",
"active_time": "2023-09-18T16:49:48+00:00",
"create_time": "2023-09-18T16:49:48+00:00",
"update_time": "2023-09-18T21:29:56+00:00",
"function": {
"switch_1": {
"switch": {
"type": "Boolean",
"value": {}
},
@@ -35,7 +35,7 @@
}
},
"status_range": {
"switch_1": {
"switch": {
"type": "Boolean",
"value": {}
},
@@ -48,54 +48,10 @@
"scale": 0,
"step": 1
}
},
"add_ele": {
"type": "Integer",
"value": {
"unit": "",
"min": 0,
"max": 50000,
"scale": 3,
"step": 100
}
},
"cur_current": {
"type": "Integer",
"value": {
"unit": "mA",
"min": 0,
"max": 30000,
"scale": 0,
"step": 1
}
},
"cur_power": {
"type": "Integer",
"value": {
"unit": "W",
"min": 0,
"max": 50000,
"scale": 1,
"step": 1
}
},
"cur_voltage": {
"type": "Integer",
"value": {
"unit": "V",
"min": 0,
"max": 5000,
"scale": 1,
"step": 1
}
}
},
"status": {
"switch_1": true,
"countdown_1": 0,
"add_ele": 2,
"cur_current": 0,
"cur_power": 0,
"cur_voltage": 2371
"switch": false,
"countdown_1": 0
}
}
@@ -7,19 +7,19 @@
"disabled_by": null,
"disabled_polling": false,
"name": "Casa1",
"model": "",
"name": "AK1",
"model": "SP22A",
"category": "cz",
"product_id": "ExGgQmjt0SHMdlDZ",
"product_name": "PZ003",
"product_id": "fbvia0apnlnattcy",
"product_name": "Smart Socket-16A",
"online": false,
"sub": false,
"time_zone": "+01:00",
"active_time": "2023-09-18T16:49:48+00:00",
"create_time": "2023-09-18T16:49:48+00:00",
"update_time": "2023-09-18T21:29:56+00:00",
"time_zone": "+02:00",
"active_time": "2023-06-25T18:04:38+00:00",
"create_time": "2023-05-04T13:26:58+00:00",
"update_time": "2023-07-12T21:24:50+00:00",
"function": {
"switch": {
"switch_1": {
"type": "Boolean",
"value": {}
},
@@ -35,7 +35,7 @@
}
},
"status_range": {
"switch": {
"switch_1": {
"type": "Boolean",
"value": {}
},
@@ -48,10 +48,54 @@
"scale": 0,
"step": 1
}
},
"add_ele": {
"type": "Integer",
"value": {
"unit": "",
"min": 0,
"max": 50000,
"scale": 3,
"step": 100
}
},
"cur_current": {
"type": "Integer",
"value": {
"unit": "mA",
"min": 0,
"max": 30000,
"scale": 0,
"step": 1
}
},
"cur_power": {
"type": "Integer",
"value": {
"unit": "W",
"min": 0,
"max": 50000,
"scale": 1,
"step": 1
}
},
"cur_voltage": {
"type": "Integer",
"value": {
"unit": "V",
"min": 0,
"max": 5000,
"scale": 1,
"step": 1
}
}
},
"status": {
"switch": false,
"countdown_1": 0
"switch_1": true,
"countdown_1": 0,
"add_ele": 2,
"cur_current": 0,
"cur_power": 0,
"cur_voltage": 2371
}
}
+37 -37
View File
@@ -1911,9 +1911,9 @@
'labels': set({
}),
'manufacturer': 'Tuya',
'model': 'Smart Socket-16A',
'model_id': 'fbvia0apnlnattcy',
'name': 'AK1',
'model': 'PZ003',
'model_id': 'ExGgQmjt0SHMdlDZ',
'name': 'Casa1',
'name_by_user': None,
'primary_config_entry': <ANY>,
'serial_number': None,
@@ -4649,37 +4649,6 @@
'via_device_id': None,
})
# ---
# name: test_device_registry[ifiw20mpsqld]
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',
'ifiw20mpsqld',
),
}),
'labels': set({
}),
'manufacturer': 'Tuya',
'model': 'SPM02_WiFi',
'model_id': 'fygozcnralhwbauo',
'name': 'SPM02_WiFi',
'name_by_user': None,
'primary_config_entry': <ANY>,
'serial_number': None,
'sw_version': None,
'via_device_id': None,
})
# ---
# name: test_device_registry[ifzgvpgoodrfw2aksc]
DeviceRegistryEntrySnapshot({
'area_id': None,
@@ -6416,6 +6385,37 @@
'via_device_id': None,
})
# ---
# name: test_device_registry[ouabwhlarnczogyfqld]
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',
'ouabwhlarnczogyfqld',
),
}),
'labels': set({
}),
'manufacturer': 'Tuya',
'model': 'SPM02_WiFi',
'model_id': 'fygozcnralhwbauo',
'name': 'SPM02_WiFi',
'name_by_user': None,
'primary_config_entry': <ANY>,
'serial_number': None,
'sw_version': None,
'via_device_id': None,
})
# ---
# name: test_device_registry[owozxdzgbibizu4sjk]
DeviceRegistryEntrySnapshot({
'area_id': None,
@@ -9072,9 +9072,9 @@
'labels': set({
}),
'manufacturer': 'Tuya',
'model': 'PZ003',
'model_id': 'ExGgQmjt0SHMdlDZ',
'name': 'Casa1',
'model': 'Smart Socket-16A',
'model_id': 'fbvia0apnlnattcy',
'name': 'AK1',
'name_by_user': None,
'primary_config_entry': <ANY>,
'serial_number': None,
@@ -702,7 +702,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'current',
'unique_id': 'tuya.ZDldMHS0tjmQgGxEzccur_current',
'unique_id': 'tuya.ycttanlnpa0aivbfzccur_current',
'unit_of_measurement': <UnitOfElectricCurrent.AMPERE: 'A'>,
})
# ---
@@ -760,7 +760,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'power',
'unique_id': 'tuya.ZDldMHS0tjmQgGxEzccur_power',
'unique_id': 'tuya.ycttanlnpa0aivbfzccur_power',
'unit_of_measurement': 'W',
})
# ---
@@ -821,7 +821,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'total_energy',
'unique_id': 'tuya.ZDldMHS0tjmQgGxEzcadd_ele',
'unique_id': 'tuya.ycttanlnpa0aivbfzcadd_ele',
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
})
# ---
@@ -882,7 +882,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'voltage',
'unique_id': 'tuya.ZDldMHS0tjmQgGxEzccur_voltage',
'unique_id': 'tuya.ycttanlnpa0aivbfzccur_voltage',
'unit_of_measurement': <UnitOfElectricPotential.VOLT: 'V'>,
})
# ---
@@ -22140,7 +22140,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'phase_a_current',
'unique_id': 'tuya.ifiw20mpsqldphase_aelectriccurrent',
'unique_id': 'tuya.ouabwhlarnczogyfqldphase_aelectriccurrent',
'unit_of_measurement': 'A',
})
# ---
@@ -22201,7 +22201,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'phase_a_power',
'unique_id': 'tuya.ifiw20mpsqldphase_apower',
'unique_id': 'tuya.ouabwhlarnczogyfqldphase_apower',
'unit_of_measurement': 'kW',
})
# ---
@@ -22259,7 +22259,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'phase_a_voltage',
'unique_id': 'tuya.ifiw20mpsqldphase_avoltage',
'unique_id': 'tuya.ouabwhlarnczogyfqldphase_avoltage',
'unit_of_measurement': 'V',
})
# ---
@@ -22320,7 +22320,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'phase_b_current',
'unique_id': 'tuya.ifiw20mpsqldphase_belectriccurrent',
'unique_id': 'tuya.ouabwhlarnczogyfqldphase_belectriccurrent',
'unit_of_measurement': 'A',
})
# ---
@@ -22381,7 +22381,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'phase_b_power',
'unique_id': 'tuya.ifiw20mpsqldphase_bpower',
'unique_id': 'tuya.ouabwhlarnczogyfqldphase_bpower',
'unit_of_measurement': 'kW',
})
# ---
@@ -22439,7 +22439,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'phase_b_voltage',
'unique_id': 'tuya.ifiw20mpsqldphase_bvoltage',
'unique_id': 'tuya.ouabwhlarnczogyfqldphase_bvoltage',
'unit_of_measurement': 'V',
})
# ---
@@ -22500,7 +22500,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'phase_c_current',
'unique_id': 'tuya.ifiw20mpsqldphase_celectriccurrent',
'unique_id': 'tuya.ouabwhlarnczogyfqldphase_celectriccurrent',
'unit_of_measurement': 'A',
})
# ---
@@ -22561,7 +22561,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'phase_c_power',
'unique_id': 'tuya.ifiw20mpsqldphase_cpower',
'unique_id': 'tuya.ouabwhlarnczogyfqldphase_cpower',
'unit_of_measurement': 'kW',
})
# ---
@@ -22619,7 +22619,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'phase_c_voltage',
'unique_id': 'tuya.ifiw20mpsqldphase_cvoltage',
'unique_id': 'tuya.ouabwhlarnczogyfqldphase_cvoltage',
'unit_of_measurement': 'V',
})
# ---
@@ -22677,7 +22677,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'total_energy',
'unique_id': 'tuya.ifiw20mpsqldtotal_forward_energy',
'unique_id': 'tuya.ouabwhlarnczogyfqldtotal_forward_energy',
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
})
# ---
@@ -22735,7 +22735,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'total_production',
'unique_id': 'tuya.ifiw20mpsqldcur_neutral',
'unique_id': 'tuya.ouabwhlarnczogyfqldcur_neutral',
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
})
# ---
@@ -590,7 +590,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'indexed_socket',
'unique_id': 'tuya.ZDldMHS0tjmQgGxEzcswitch_1',
'unique_id': 'tuya.ycttanlnpa0aivbfzcswitch_1',
'unit_of_measurement': None,
})
# ---
@@ -2753,7 +2753,7 @@
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'socket',
'unique_id': 'tuya.ycttanlnpa0aivbfzcswitch',
'unique_id': 'tuya.ZDldMHS0tjmQgGxEzcswitch',
'unit_of_measurement': None,
})
# ---
+4
View File
@@ -352,6 +352,10 @@ async def test_fixtures_valid(hass: HomeAssistant) -> None:
details = await async_load_json_object_fixture(
hass, f"{device_code}.json", DOMAIN
)
expected_code = f"{details['category']}_{details['product_id']}"
assert device_code == expected_code, (
f"Device code {device_code} does not match expected {expected_code}"
)
for key in EXCLUDE_KEYS:
assert key not in details, (
f"Please remove data[`'{key}']` from {device_code}.json"