mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Add icon translations to Roku (#112214)
* Add icon translations to Roku * Add icon translations to Roku * Fix * Fix
This commit is contained in:
parent
7c4747bb02
commit
b34302e51b
@ -31,27 +31,23 @@ BINARY_SENSORS: tuple[RokuBinarySensorEntityDescription, ...] = (
|
||||
RokuBinarySensorEntityDescription(
|
||||
key="headphones_connected",
|
||||
translation_key="headphones_connected",
|
||||
icon="mdi:headphones",
|
||||
value_fn=lambda device: device.info.headphones_connected,
|
||||
),
|
||||
RokuBinarySensorEntityDescription(
|
||||
key="supports_airplay",
|
||||
translation_key="supports_airplay",
|
||||
icon="mdi:cast-variant",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda device: device.info.supports_airplay,
|
||||
),
|
||||
RokuBinarySensorEntityDescription(
|
||||
key="supports_ethernet",
|
||||
translation_key="supports_ethernet",
|
||||
icon="mdi:ethernet",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda device: device.info.ethernet_support,
|
||||
),
|
||||
RokuBinarySensorEntityDescription(
|
||||
key="supports_find_remote",
|
||||
translation_key="supports_find_remote",
|
||||
icon="mdi:remote",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda device: device.info.supports_find_remote,
|
||||
),
|
||||
|
37
homeassistant/components/roku/icons.json
Normal file
37
homeassistant/components/roku/icons.json
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"entity": {
|
||||
"binary_sensor": {
|
||||
"headphones_connected": {
|
||||
"default": "mdi:headphones"
|
||||
},
|
||||
"supports_airplay": {
|
||||
"default": "mdi:cast-variant"
|
||||
},
|
||||
"supports_ethernet": {
|
||||
"default": "mdi:ethernet"
|
||||
},
|
||||
"supports_find_remote": {
|
||||
"default": "mdi:remote"
|
||||
}
|
||||
},
|
||||
"select": {
|
||||
"application": {
|
||||
"default": "mdi:application"
|
||||
},
|
||||
"channel": {
|
||||
"default": "mdi:television"
|
||||
}
|
||||
},
|
||||
"sensor": {
|
||||
"active_app": {
|
||||
"default": "mdi:application"
|
||||
},
|
||||
"active_app_id": {
|
||||
"default": "mdi:application-cog"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"search": "mdi:magnify"
|
||||
}
|
||||
}
|
@ -90,7 +90,6 @@ ENTITIES: tuple[RokuSelectEntityDescription, ...] = (
|
||||
RokuSelectEntityDescription(
|
||||
key="application",
|
||||
translation_key="application",
|
||||
icon="mdi:application",
|
||||
set_fn=_launch_application,
|
||||
value_fn=_get_application_name,
|
||||
options_fn=_get_applications,
|
||||
@ -101,7 +100,6 @@ ENTITIES: tuple[RokuSelectEntityDescription, ...] = (
|
||||
CHANNEL_ENTITY = RokuSelectEntityDescription(
|
||||
key="channel",
|
||||
translation_key="channel",
|
||||
icon="mdi:television",
|
||||
set_fn=_tune_channel,
|
||||
value_fn=_get_channel_name,
|
||||
options_fn=_get_channels,
|
||||
|
@ -30,14 +30,12 @@ SENSORS: tuple[RokuSensorEntityDescription, ...] = (
|
||||
key="active_app",
|
||||
translation_key="active_app",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
icon="mdi:application",
|
||||
value_fn=lambda device: device.app.name if device.app else None,
|
||||
),
|
||||
RokuSensorEntityDescription(
|
||||
key="active_app_id",
|
||||
translation_key="active_app_id",
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
icon="mdi:application-cog",
|
||||
value_fn=lambda device: device.app.app_id if device.app else None,
|
||||
),
|
||||
)
|
||||
|
@ -7,12 +7,7 @@ from rokuecp import Device as RokuDevice
|
||||
|
||||
from homeassistant.components.binary_sensor import STATE_OFF, STATE_ON
|
||||
from homeassistant.components.roku.const import DOMAIN
|
||||
from homeassistant.const import (
|
||||
ATTR_DEVICE_CLASS,
|
||||
ATTR_FRIENDLY_NAME,
|
||||
ATTR_ICON,
|
||||
EntityCategory,
|
||||
)
|
||||
from homeassistant.const import ATTR_DEVICE_CLASS, ATTR_FRIENDLY_NAME, EntityCategory
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
||||
@ -36,7 +31,6 @@ async def test_roku_binary_sensors(
|
||||
assert entry.entity_category is None
|
||||
assert state.state == STATE_OFF
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "My Roku 3 Headphones connected"
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:headphones"
|
||||
assert ATTR_DEVICE_CLASS not in state.attributes
|
||||
|
||||
state = hass.states.get("binary_sensor.my_roku_3_supports_airplay")
|
||||
@ -47,7 +41,6 @@ async def test_roku_binary_sensors(
|
||||
assert entry.entity_category == EntityCategory.DIAGNOSTIC
|
||||
assert state.state == STATE_OFF
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "My Roku 3 Supports AirPlay"
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:cast-variant"
|
||||
assert ATTR_DEVICE_CLASS not in state.attributes
|
||||
|
||||
state = hass.states.get("binary_sensor.my_roku_3_supports_ethernet")
|
||||
@ -58,7 +51,6 @@ async def test_roku_binary_sensors(
|
||||
assert entry.entity_category == EntityCategory.DIAGNOSTIC
|
||||
assert state.state == STATE_ON
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "My Roku 3 Supports ethernet"
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:ethernet"
|
||||
assert ATTR_DEVICE_CLASS not in state.attributes
|
||||
|
||||
state = hass.states.get("binary_sensor.my_roku_3_supports_find_remote")
|
||||
@ -69,7 +61,6 @@ async def test_roku_binary_sensors(
|
||||
assert entry.entity_category == EntityCategory.DIAGNOSTIC
|
||||
assert state.state == STATE_OFF
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "My Roku 3 Supports find remote"
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:remote"
|
||||
assert ATTR_DEVICE_CLASS not in state.attributes
|
||||
|
||||
assert entry.device_id
|
||||
@ -113,7 +104,6 @@ async def test_rokutv_binary_sensors(
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== '58" Onn Roku TV Headphones connected'
|
||||
)
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:headphones"
|
||||
assert ATTR_DEVICE_CLASS not in state.attributes
|
||||
|
||||
state = hass.states.get("binary_sensor.58_onn_roku_tv_supports_airplay")
|
||||
@ -126,7 +116,6 @@ async def test_rokutv_binary_sensors(
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME) == '58" Onn Roku TV Supports AirPlay'
|
||||
)
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:cast-variant"
|
||||
assert ATTR_DEVICE_CLASS not in state.attributes
|
||||
|
||||
state = hass.states.get("binary_sensor.58_onn_roku_tv_supports_ethernet")
|
||||
@ -139,7 +128,6 @@ async def test_rokutv_binary_sensors(
|
||||
assert (
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME) == '58" Onn Roku TV Supports ethernet'
|
||||
)
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:ethernet"
|
||||
assert ATTR_DEVICE_CLASS not in state.attributes
|
||||
|
||||
state = hass.states.get("binary_sensor.58_onn_roku_tv_supports_find_remote")
|
||||
@ -155,7 +143,6 @@ async def test_rokutv_binary_sensors(
|
||||
state.attributes.get(ATTR_FRIENDLY_NAME)
|
||||
== '58" Onn Roku TV Supports find remote'
|
||||
)
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:remote"
|
||||
assert ATTR_DEVICE_CLASS not in state.attributes
|
||||
|
||||
assert entry.device_id
|
||||
|
@ -18,7 +18,7 @@ from homeassistant.components.select import (
|
||||
ATTR_OPTIONS,
|
||||
DOMAIN as SELECT_DOMAIN,
|
||||
)
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_ICON, SERVICE_SELECT_OPTION
|
||||
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_SELECT_OPTION
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
@ -50,7 +50,6 @@ async def test_application_state(
|
||||
|
||||
state = hass.states.get("select.my_roku_3_application")
|
||||
assert state
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:application"
|
||||
assert state.attributes.get(ATTR_OPTIONS) == [
|
||||
"Home",
|
||||
"Amazon Video on Demand",
|
||||
@ -175,7 +174,6 @@ async def test_channel_state(
|
||||
|
||||
state = hass.states.get("select.58_onn_roku_tv_channel")
|
||||
assert state
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:television"
|
||||
assert state.attributes.get(ATTR_OPTIONS) == [
|
||||
"99.1",
|
||||
"QVC (1.3)",
|
||||
|
@ -8,7 +8,6 @@ from homeassistant.components.roku.const import DOMAIN
|
||||
from homeassistant.const import (
|
||||
ATTR_DEVICE_CLASS,
|
||||
ATTR_FRIENDLY_NAME,
|
||||
ATTR_ICON,
|
||||
STATE_UNKNOWN,
|
||||
EntityCategory,
|
||||
)
|
||||
@ -36,7 +35,6 @@ async def test_roku_sensors(
|
||||
assert entry.entity_category == EntityCategory.DIAGNOSTIC
|
||||
assert state.state == "Roku"
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "My Roku 3 Active app"
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:application"
|
||||
assert ATTR_DEVICE_CLASS not in state.attributes
|
||||
|
||||
state = hass.states.get("sensor.my_roku_3_active_app_id")
|
||||
@ -47,7 +45,6 @@ async def test_roku_sensors(
|
||||
assert entry.entity_category == EntityCategory.DIAGNOSTIC
|
||||
assert state.state == STATE_UNKNOWN
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "My Roku 3 Active app ID"
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:application-cog"
|
||||
assert ATTR_DEVICE_CLASS not in state.attributes
|
||||
|
||||
assert entry.device_id
|
||||
@ -85,7 +82,6 @@ async def test_rokutv_sensors(
|
||||
assert entry.entity_category == EntityCategory.DIAGNOSTIC
|
||||
assert state.state == "Antenna TV"
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == '58" Onn Roku TV Active app'
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:application"
|
||||
assert ATTR_DEVICE_CLASS not in state.attributes
|
||||
|
||||
state = hass.states.get("sensor.58_onn_roku_tv_active_app_id")
|
||||
@ -96,7 +92,6 @@ async def test_rokutv_sensors(
|
||||
assert entry.entity_category == EntityCategory.DIAGNOSTIC
|
||||
assert state.state == "tvinput.dtv"
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == '58" Onn Roku TV Active app ID'
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:application-cog"
|
||||
assert ATTR_DEVICE_CLASS not in state.attributes
|
||||
|
||||
assert entry.device_id
|
||||
|
Loading…
x
Reference in New Issue
Block a user