Skip to content

Commit 840613f

Browse files
authored
Add mac to Reolink IPC cam device info (#140822)
* Add mac to Reolink IPC cams * Add test * check mac none
1 parent e78a19a commit 840613f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

homeassistant/components/reolink/entity.py

+5
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,13 @@ def __init__(
178178
else:
179179
self._dev_id = f"{self._host.unique_id}_ch{dev_ch}"
180180

181+
connections = set()
182+
if mac := self._host.api.baichuan.mac_address(dev_ch):
183+
connections.add((CONNECTION_NETWORK_MAC, mac))
184+
181185
self._attr_device_info = DeviceInfo(
182186
identifiers={(DOMAIN, self._dev_id)},
187+
connections=connections,
183188
via_device=(DOMAIN, self._host.unique_id),
184189
name=self._host.api.camera_name(dev_ch),
185190
model=self._host.api.camera_model(dev_ch),

tests/components/reolink/conftest.py

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
TEST_PASSWORD2 = "new_password"
3636
TEST_MAC = "aa:bb:cc:dd:ee:ff"
3737
TEST_MAC2 = "ff:ee:dd:cc:bb:aa"
38+
TEST_MAC_CAM = "11:22:33:44:55:66"
3839
DHCP_FORMATTED_MAC = "aabbccddeeff"
3940
TEST_UID = "ABC1234567D89EFG"
4041
TEST_UID_CAM = "DEF7654321D89GHT"
@@ -142,6 +143,7 @@ def reolink_connect_class() -> Generator[MagicMock]:
142143
# Disable tcp push by default for tests
143144
host_mock.baichuan.port = TEST_BC_PORT
144145
host_mock.baichuan.events_active = False
146+
host_mock.baichuan.mac_address.return_value = TEST_MAC_CAM
145147
host_mock.baichuan.privacy_mode.return_value = False
146148
host_mock.baichuan.day_night_state.return_value = "day"
147149
host_mock.baichuan.subscribe_events.side_effect = ReolinkError("Test error")

0 commit comments

Comments
 (0)