mirror of
https://github.com/home-assistant/core
synced 2024-09-09 12:51:22 +02:00
Add MAC to Roku device (#63422)
This commit is contained in:
parent
0ef30c4e37
commit
213b1bf684
@ -1,6 +1,7 @@
|
||||
"""Base Entity for Roku."""
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
from homeassistant.helpers.entity import DeviceInfo, EntityDescription
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
@ -37,6 +38,14 @@ class RokuEntity(CoordinatorEntity):
|
||||
|
||||
return DeviceInfo(
|
||||
identifiers={(DOMAIN, self._device_id)},
|
||||
connections={
|
||||
(CONNECTION_NETWORK_MAC, mac_address)
|
||||
for mac_address in (
|
||||
self.coordinator.data.info.wifi_mac,
|
||||
self.coordinator.data.info.ethernet_mac,
|
||||
)
|
||||
if mac_address is not None
|
||||
},
|
||||
name=self.coordinator.data.info.name,
|
||||
manufacturer=self.coordinator.data.info.brand,
|
||||
model=self.coordinator.data.info.model_name,
|
||||
|
@ -68,6 +68,10 @@ async def test_roku_binary_sensors(
|
||||
device_entry = device_registry.async_get(entry.device_id)
|
||||
assert device_entry
|
||||
assert device_entry.identifiers == {(DOMAIN, UPNP_SERIAL)}
|
||||
assert device_entry.connections == {
|
||||
(dr.CONNECTION_NETWORK_MAC, "b0:a7:37:96:4d:fb"),
|
||||
(dr.CONNECTION_NETWORK_MAC, "b0:a7:37:96:4d:fa"),
|
||||
}
|
||||
assert device_entry.manufacturer == "Roku"
|
||||
assert device_entry.model == "Roku 3"
|
||||
assert device_entry.name == "My Roku 3"
|
||||
@ -154,6 +158,10 @@ async def test_rokutv_binary_sensors(
|
||||
device_entry = device_registry.async_get(entry.device_id)
|
||||
assert device_entry
|
||||
assert device_entry.identifiers == {(DOMAIN, "YN00H5555555")}
|
||||
assert device_entry.connections == {
|
||||
(dr.CONNECTION_NETWORK_MAC, "d8:13:99:f8:b0:c6"),
|
||||
(dr.CONNECTION_NETWORK_MAC, "d4:3a:2e:07:fd:cb"),
|
||||
}
|
||||
assert device_entry.manufacturer == "Onn"
|
||||
assert device_entry.model == "100005844"
|
||||
assert device_entry.name == '58" Onn Roku TV'
|
||||
|
@ -99,6 +99,10 @@ async def test_setup(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker) -
|
||||
device_entry = device_registry.async_get(entry.device_id)
|
||||
assert device_entry
|
||||
assert device_entry.identifiers == {(DOMAIN, UPNP_SERIAL)}
|
||||
assert device_entry.connections == {
|
||||
(dr.CONNECTION_NETWORK_MAC, "b0:a7:37:96:4d:fb"),
|
||||
(dr.CONNECTION_NETWORK_MAC, "b0:a7:37:96:4d:fa"),
|
||||
}
|
||||
assert device_entry.manufacturer == "Roku"
|
||||
assert device_entry.model == "Roku 3"
|
||||
assert device_entry.name == "My Roku 3"
|
||||
@ -145,6 +149,10 @@ async def test_tv_setup(
|
||||
device_entry = device_registry.async_get(entry.device_id)
|
||||
assert device_entry
|
||||
assert device_entry.identifiers == {(DOMAIN, TV_SERIAL)}
|
||||
assert device_entry.connections == {
|
||||
(dr.CONNECTION_NETWORK_MAC, "d8:13:99:f8:b0:c6"),
|
||||
(dr.CONNECTION_NETWORK_MAC, "d4:3a:2e:07:fd:cb"),
|
||||
}
|
||||
assert device_entry.manufacturer == TV_MANUFACTURER
|
||||
assert device_entry.model == TV_MODEL
|
||||
assert device_entry.name == '58" Onn Roku TV'
|
||||
|
Loading…
Reference in New Issue
Block a user