Implement suggested area in roku (#46819)
* implement suggested area in roku * Update const.py * Update test_media_player.py * Update test_media_player.py * Update test_media_player.py * Update test_media_player.py
This commit is contained in:
parent
2ae790283c
commit
cf69415272
3 changed files with 31 additions and 1 deletions
|
@ -27,6 +27,7 @@ from .const import (
|
|||
ATTR_MANUFACTURER,
|
||||
ATTR_MODEL,
|
||||
ATTR_SOFTWARE_VERSION,
|
||||
ATTR_SUGGESTED_AREA,
|
||||
DOMAIN,
|
||||
)
|
||||
|
||||
|
@ -161,4 +162,5 @@ class RokuEntity(CoordinatorEntity):
|
|||
ATTR_MANUFACTURER: self.coordinator.data.info.brand,
|
||||
ATTR_MODEL: self.coordinator.data.info.model_name,
|
||||
ATTR_SOFTWARE_VERSION: self.coordinator.data.info.version,
|
||||
ATTR_SUGGESTED_AREA: self.coordinator.data.info.device_location,
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ ATTR_KEYWORD = "keyword"
|
|||
ATTR_MANUFACTURER = "manufacturer"
|
||||
ATTR_MODEL = "model"
|
||||
ATTR_SOFTWARE_VERSION = "sw_version"
|
||||
ATTR_SUGGESTED_AREA = "suggested_area"
|
||||
|
||||
# Default Values
|
||||
DEFAULT_PORT = 8060
|
||||
|
|
|
@ -65,14 +65,18 @@ from homeassistant.helpers.typing import HomeAssistantType
|
|||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from tests.common import async_fire_time_changed
|
||||
from tests.components.roku import UPNP_SERIAL, setup_integration
|
||||
from tests.components.roku import NAME_ROKUTV, UPNP_SERIAL, setup_integration
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
MAIN_ENTITY_ID = f"{MP_DOMAIN}.my_roku_3"
|
||||
TV_ENTITY_ID = f"{MP_DOMAIN}.58_onn_roku_tv"
|
||||
|
||||
TV_HOST = "192.168.1.161"
|
||||
TV_LOCATION = "Living room"
|
||||
TV_MANUFACTURER = "Onn"
|
||||
TV_MODEL = "100005844"
|
||||
TV_SERIAL = "YN00H5555555"
|
||||
TV_SW_VERSION = "9.2.0"
|
||||
|
||||
|
||||
async def test_setup(
|
||||
|
@ -304,6 +308,29 @@ async def test_tv_attributes(
|
|||
assert state.attributes.get(ATTR_MEDIA_TITLE) == "Airwolf"
|
||||
|
||||
|
||||
async def test_tv_device_registry(
|
||||
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
|
||||
) -> None:
|
||||
"""Test device registered for Roku TV in the device registry."""
|
||||
await setup_integration(
|
||||
hass,
|
||||
aioclient_mock,
|
||||
device="rokutv",
|
||||
app="tvinput-dtv",
|
||||
host=TV_HOST,
|
||||
unique_id=TV_SERIAL,
|
||||
)
|
||||
|
||||
device_registry = await hass.helpers.device_registry.async_get_registry()
|
||||
reg_device = device_registry.async_get_device(identifiers={(DOMAIN, TV_SERIAL)})
|
||||
|
||||
assert reg_device.model == TV_MODEL
|
||||
assert reg_device.sw_version == TV_SW_VERSION
|
||||
assert reg_device.manufacturer == TV_MANUFACTURER
|
||||
assert reg_device.suggested_area == TV_LOCATION
|
||||
assert reg_device.name == NAME_ROKUTV
|
||||
|
||||
|
||||
async def test_services(
|
||||
hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker
|
||||
) -> None:
|
||||
|
|
Loading…
Add table
Reference in a new issue