Skip to content

Commit bc36578

Browse files
authored
Add mac address to SFR Box device registry entries (home-assistant#157752)
1 parent e63242e commit bc36578

File tree

4 files changed

+37
-5
lines changed

4 files changed

+37
-5
lines changed

homeassistant/components/sfr_box/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: SFRConfigEntry) -> bool:
6565
device_registry = dr.async_get(hass)
6666
device_registry.async_get_or_create(
6767
config_entry_id=entry.entry_id,
68+
connections={(dr.CONNECTION_NETWORK_MAC, system_info.mac_addr)},
6869
identifiers={(DOMAIN, system_info.mac_addr)},
6970
name="SFR Box",
70-
model=system_info.product_id,
71+
model=None,
7172
model_id=system_info.product_id,
7273
sw_version=system_info.version_mainfirmware,
7374
configuration_url=f"http://{entry.data[CONF_HOST]}",

homeassistant/components/sfr_box/quality_scale.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ rules:
4242
## Gold
4343
entity-translations: done
4444
entity-device-class: done
45-
devices:
46-
status: todo
47-
comment: MAC address can be set to the connections
45+
devices: done
4846
entity-category: done
4947
entity-disabled-by-default: done
5048
discovery:
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
# serializer version: 1
22
# name: test_device_registry
33
list([
4+
DeviceRegistryEntrySnapshot({
5+
'area_id': None,
6+
'config_entries': <ANY>,
7+
'config_entries_subentries': <ANY>,
8+
'configuration_url': 'http://192.168.0.1',
9+
'connections': set({
10+
tuple(
11+
'mac',
12+
'e4:5d:51:00:11:22',
13+
),
14+
}),
15+
'disabled_by': None,
16+
'entry_type': None,
17+
'hw_version': None,
18+
'id': <ANY>,
19+
'identifiers': set({
20+
tuple(
21+
'sfr_box',
22+
'e4:5d:51:00:11:22',
23+
),
24+
}),
25+
'labels': set({
26+
}),
27+
'manufacturer': None,
28+
'model': None,
29+
'model_id': 'NB6VAC-FXC-r0',
30+
'name': 'SFR Box',
31+
'name_by_user': None,
32+
'primary_config_entry': <ANY>,
33+
'serial_number': None,
34+
'sw_version': 'NB6VAC-MAIN-R4.0.44k',
35+
'via_device_id': None,
36+
}),
437
])
538
# ---

tests/components/sfr_box/test_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async def test_setup_entry_invalid_auth(
8282
assert config_entry_with_auth.state is ConfigEntryState.SETUP_ERROR
8383

8484

85-
@patch("homeassistant.components.sfr_box.PLATFORMS", [])
85+
@pytest.mark.usefixtures("system_get_info", "dsl_get_info", "wan_get_info")
8686
async def test_device_registry(
8787
hass: HomeAssistant,
8888
config_entry: ConfigEntry,

0 commit comments

Comments
 (0)