1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-15 07:36:16 +00:00

Add mac address to SFR Box device registry entries (#157752)

This commit is contained in:
epenet
2025-12-02 16:52:09 +01:00
committed by GitHub
parent e63242e465
commit bc36578ada
4 changed files with 37 additions and 5 deletions

View File

@@ -65,9 +65,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: SFRConfigEntry) -> bool:
device_registry = dr.async_get(hass)
device_registry.async_get_or_create(
config_entry_id=entry.entry_id,
connections={(dr.CONNECTION_NETWORK_MAC, system_info.mac_addr)},
identifiers={(DOMAIN, system_info.mac_addr)},
name="SFR Box",
model=system_info.product_id,
model=None,
model_id=system_info.product_id,
sw_version=system_info.version_mainfirmware,
configuration_url=f"http://{entry.data[CONF_HOST]}",

View File

@@ -42,9 +42,7 @@ rules:
## Gold
entity-translations: done
entity-device-class: done
devices:
status: todo
comment: MAC address can be set to the connections
devices: done
entity-category: done
entity-disabled-by-default: done
discovery:

View File

@@ -1,5 +1,38 @@
# serializer version: 1
# name: test_device_registry
list([
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'config_entries_subentries': <ANY>,
'configuration_url': 'http://192.168.0.1',
'connections': set({
tuple(
'mac',
'e4:5d:51:00:11:22',
),
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'sfr_box',
'e4:5d:51:00:11:22',
),
}),
'labels': set({
}),
'manufacturer': None,
'model': None,
'model_id': 'NB6VAC-FXC-r0',
'name': 'SFR Box',
'name_by_user': None,
'primary_config_entry': <ANY>,
'serial_number': None,
'sw_version': 'NB6VAC-MAIN-R4.0.44k',
'via_device_id': None,
}),
])
# ---

View File

@@ -82,7 +82,7 @@ async def test_setup_entry_invalid_auth(
assert config_entry_with_auth.state is ConfigEntryState.SETUP_ERROR
@patch("homeassistant.components.sfr_box.PLATFORMS", [])
@pytest.mark.usefixtures("system_get_info", "dsl_get_info", "wan_get_info")
async def test_device_registry(
hass: HomeAssistant,
config_entry: ConfigEntry,