Fix missed case for device tuple fallback in rfxtrx (#93575)

* rfxtrx: add missed case for device tuple fallback

Previously the code was prepared for a backward compatible
migration of tuples, where both styles of identifiers might exist
in device registry at the same time.

This place was sadly missed

* No need to raise special, we can assert instead

* Add some basic tests
This commit is contained in:
Joakim Plate
2023-05-29 19:59:11 +02:00
committed by GitHub
parent e1ef027461
commit 617ff24b9b
3 changed files with 23 additions and 2 deletions

View File

@@ -89,6 +89,14 @@ async def test_get_actions(
device_entry = device_registry.async_get_device(device.device_identifiers, set())
assert device_entry
# Add alternate identifiers, to make sure we can handle future formats
identifiers: list[str] = list(*device_entry.identifiers)
device_registry.async_update_device(
device_entry.id, merge_identifiers={(identifiers[0], "_".join(identifiers[1:]))}
)
device_entry = device_registry.async_get_device(device.device_identifiers, set())
assert device_entry
actions = await async_get_device_automations(
hass, DeviceAutomationType.ACTION, device_entry.id
)