mirror of
https://github.com/home-assistant/core.git
synced 2026-06-24 23:55:21 +02:00
Cast numeric firmware to string for squeezebox hw_version (#174076)
This commit is contained in:
@@ -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),
|
||||
)
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user