Cast numeric firmware to string for squeezebox hw_version (#174076)

This commit is contained in:
Franck Nijhof
2026-06-17 21:31:43 +02:00
parent b2e1a296d4
commit 157e137ea9
2 changed files with 20 additions and 1 deletions
@@ -160,7 +160,7 @@ async def async_setup_entry(
model=model,
manufacturer=manufacturer,
model_id=model_id,
hw_version=player.firmware,
hw_version=str(player.firmware) if player.firmware is not None else None,
sw_version=sw_version,
via_device=(DOMAIN, coordinator.server_uuid),
)
+19
View File
@@ -123,6 +123,25 @@ async def test_device_registry(
assert reg_device == snapshot
async def test_device_registry_numeric_firmware(
hass: HomeAssistant,
device_registry: DeviceRegistry,
config_entry: MockConfigEntry,
lms: MagicMock,
) -> None:
"""Test that numeric firmware values are stored as strings in the device registry."""
players = await lms.async_get_players()
players[0].firmware = 137
with patch("homeassistant.components.squeezebox.Server", return_value=lms):
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
reg_device = device_registry.async_get_device(identifiers={(DOMAIN, TEST_MAC[0])})
assert reg_device is not None
assert reg_device.hw_version == "137"
async def test_device_registry_server_merged(
hass: HomeAssistant,
device_registry: DeviceRegistry,