Add hardware version to Roku device info (#63249)

* add hardware version to Roku device info.

* Update test_media_player.py

* Update test_media_player.py

* Update test_media_player.py
pull/63254/head
Chris Talkington 2022-01-02 18:35:09 -06:00 committed by GitHub
parent ea0b24a5f0
commit c693b6f455
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 10 deletions

View File

@ -31,6 +31,7 @@ class RokuEntity(CoordinatorEntity):
name=self.coordinator.data.info.name,
manufacturer=self.coordinator.data.info.brand,
model=self.coordinator.data.info.model_name,
hw_version=self.coordinator.data.info.model_number,
sw_version=self.coordinator.data.info.version,
suggested_area=self.coordinator.data.info.device_location,
)

View File

@ -85,12 +85,26 @@ async def test_setup(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker) -
await setup_integration(hass, aioclient_mock)
entity_registry = er.async_get(hass)
main = entity_registry.async_get(MAIN_ENTITY_ID)
device_registry = dr.async_get(hass)
assert hass.states.get(MAIN_ENTITY_ID)
assert main
assert main.original_device_class is MediaPlayerDeviceClass.RECEIVER
assert main.unique_id == UPNP_SERIAL
state = hass.states.get(MAIN_ENTITY_ID)
entry = entity_registry.async_get(MAIN_ENTITY_ID)
assert state
assert entry
assert entry.original_device_class is MediaPlayerDeviceClass.RECEIVER
assert entry.unique_id == UPNP_SERIAL
assert entry.device_id
device_entry = device_registry.async_get(entry.device_id)
assert device_entry
assert device_entry.identifiers == {(DOMAIN, UPNP_SERIAL)}
assert device_entry.manufacturer == "Roku"
assert device_entry.model == "Roku 3"
assert device_entry.name == "My Roku 3"
assert device_entry.entry_type is None
assert device_entry.hw_version == "4200X"
assert device_entry.sw_version == "7.5.0"
async def test_idle_setup(
@ -117,12 +131,26 @@ async def test_tv_setup(
)
entity_registry = er.async_get(hass)
tv = entity_registry.async_get(TV_ENTITY_ID)
device_registry = dr.async_get(hass)
assert hass.states.get(TV_ENTITY_ID)
assert tv
assert tv.original_device_class is MediaPlayerDeviceClass.TV
assert tv.unique_id == TV_SERIAL
state = hass.states.get(TV_ENTITY_ID)
entry = entity_registry.async_get(TV_ENTITY_ID)
assert state
assert entry
assert entry.original_device_class is MediaPlayerDeviceClass.TV
assert entry.unique_id == TV_SERIAL
assert entry.device_id
device_entry = device_registry.async_get(entry.device_id)
assert device_entry
assert device_entry.identifiers == {(DOMAIN, TV_SERIAL)}
assert device_entry.manufacturer == TV_MANUFACTURER
assert device_entry.model == TV_MODEL
assert device_entry.name == '58" Onn Roku TV'
assert device_entry.entry_type is None
assert device_entry.hw_version == "7820X"
assert device_entry.sw_version == TV_SW_VERSION
async def test_availability(