mirror of
https://github.com/home-assistant/core.git
synced 2025-07-12 15:57:06 +00:00
Add icon translations to Lametric (#111854)
This commit is contained in:
parent
21a021944f
commit
f9b2c35418
@ -31,28 +31,24 @@ BUTTONS = [
|
|||||||
LaMetricButtonEntityDescription(
|
LaMetricButtonEntityDescription(
|
||||||
key="app_next",
|
key="app_next",
|
||||||
translation_key="app_next",
|
translation_key="app_next",
|
||||||
icon="mdi:arrow-right-bold",
|
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
press_fn=lambda api: api.app_next(),
|
press_fn=lambda api: api.app_next(),
|
||||||
),
|
),
|
||||||
LaMetricButtonEntityDescription(
|
LaMetricButtonEntityDescription(
|
||||||
key="app_previous",
|
key="app_previous",
|
||||||
translation_key="app_previous",
|
translation_key="app_previous",
|
||||||
icon="mdi:arrow-left-bold",
|
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
press_fn=lambda api: api.app_previous(),
|
press_fn=lambda api: api.app_previous(),
|
||||||
),
|
),
|
||||||
LaMetricButtonEntityDescription(
|
LaMetricButtonEntityDescription(
|
||||||
key="dismiss_current",
|
key="dismiss_current",
|
||||||
translation_key="dismiss_current",
|
translation_key="dismiss_current",
|
||||||
icon="mdi:bell-cancel",
|
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
press_fn=lambda api: api.dismiss_current_notification(),
|
press_fn=lambda api: api.dismiss_current_notification(),
|
||||||
),
|
),
|
||||||
LaMetricButtonEntityDescription(
|
LaMetricButtonEntityDescription(
|
||||||
key="dismiss_all",
|
key="dismiss_all",
|
||||||
translation_key="dismiss_all",
|
translation_key="dismiss_all",
|
||||||
icon="mdi:bell-cancel",
|
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
press_fn=lambda api: api.dismiss_all_notifications(),
|
press_fn=lambda api: api.dismiss_all_notifications(),
|
||||||
),
|
),
|
||||||
|
45
homeassistant/components/lametric/icons.json
Normal file
45
homeassistant/components/lametric/icons.json
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
"entity": {
|
||||||
|
"button": {
|
||||||
|
"app_next": {
|
||||||
|
"default": "mdi:arrow-right-bold"
|
||||||
|
},
|
||||||
|
"app_previous": {
|
||||||
|
"default": "mdi:arrow-left-bold"
|
||||||
|
},
|
||||||
|
"dismiss_current": {
|
||||||
|
"default": "mdi:bell-cancel"
|
||||||
|
},
|
||||||
|
"dismiss_all": {
|
||||||
|
"default": "mdi:bell-cancel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"number": {
|
||||||
|
"brightness": {
|
||||||
|
"default": "mdi:brightness-6"
|
||||||
|
},
|
||||||
|
"volume": {
|
||||||
|
"default": "mdi:volume-high"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"select": {
|
||||||
|
"brightness_mode": {
|
||||||
|
"default": "mdi:brightness-auto"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sensor": {
|
||||||
|
"rssi": {
|
||||||
|
"default": "mdi:wifi"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"switch": {
|
||||||
|
"bluetooth": {
|
||||||
|
"default": "mdi:bluetooth"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"services": {
|
||||||
|
"chart": "mdi:chart-areaspline-variant",
|
||||||
|
"message": "mdi:message"
|
||||||
|
}
|
||||||
|
}
|
@ -31,8 +31,8 @@ class LaMetricNumberEntityDescription(NumberEntityDescription):
|
|||||||
NUMBERS = [
|
NUMBERS = [
|
||||||
LaMetricNumberEntityDescription(
|
LaMetricNumberEntityDescription(
|
||||||
key="brightness",
|
key="brightness",
|
||||||
|
translation_key="brightness",
|
||||||
name="Brightness",
|
name="Brightness",
|
||||||
icon="mdi:brightness-6",
|
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
native_step=1,
|
native_step=1,
|
||||||
native_min_value=0,
|
native_min_value=0,
|
||||||
@ -43,8 +43,8 @@ NUMBERS = [
|
|||||||
),
|
),
|
||||||
LaMetricNumberEntityDescription(
|
LaMetricNumberEntityDescription(
|
||||||
key="volume",
|
key="volume",
|
||||||
|
translation_key="volume",
|
||||||
name="Volume",
|
name="Volume",
|
||||||
icon="mdi:volume-high",
|
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
native_step=1,
|
native_step=1,
|
||||||
native_min_value=0,
|
native_min_value=0,
|
||||||
|
@ -32,7 +32,6 @@ SELECTS = [
|
|||||||
LaMetricSelectEntityDescription(
|
LaMetricSelectEntityDescription(
|
||||||
key="brightness_mode",
|
key="brightness_mode",
|
||||||
translation_key="brightness_mode",
|
translation_key="brightness_mode",
|
||||||
icon="mdi:brightness-auto",
|
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
options=["auto", "manual"],
|
options=["auto", "manual"],
|
||||||
current_fn=lambda device: device.display.brightness_mode.value,
|
current_fn=lambda device: device.display.brightness_mode.value,
|
||||||
|
@ -33,7 +33,6 @@ SENSORS = [
|
|||||||
LaMetricSensorEntityDescription(
|
LaMetricSensorEntityDescription(
|
||||||
key="rssi",
|
key="rssi",
|
||||||
translation_key="rssi",
|
translation_key="rssi",
|
||||||
icon="mdi:wifi",
|
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
|
@ -33,7 +33,6 @@ SWITCHES = [
|
|||||||
LaMetricSwitchEntityDescription(
|
LaMetricSwitchEntityDescription(
|
||||||
key="bluetooth",
|
key="bluetooth",
|
||||||
translation_key="bluetooth",
|
translation_key="bluetooth",
|
||||||
icon="mdi:bluetooth",
|
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
available_fn=lambda device: device.bluetooth.available,
|
available_fn=lambda device: device.bluetooth.available,
|
||||||
is_on_fn=lambda device: device.bluetooth.active,
|
is_on_fn=lambda device: device.bluetooth.active,
|
||||||
|
@ -9,7 +9,6 @@ from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN, SERVICE_PRE
|
|||||||
from homeassistant.components.lametric.const import DOMAIN
|
from homeassistant.components.lametric.const import DOMAIN
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
ATTR_ICON,
|
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
EntityCategory,
|
EntityCategory,
|
||||||
@ -33,7 +32,6 @@ async def test_button_app_next(
|
|||||||
"""Test the LaMetric next app button."""
|
"""Test the LaMetric next app button."""
|
||||||
state = hass.states.get("button.frenck_s_lametric_next_app")
|
state = hass.states.get("button.frenck_s_lametric_next_app")
|
||||||
assert state
|
assert state
|
||||||
assert state.attributes.get(ATTR_ICON) == "mdi:arrow-right-bold"
|
|
||||||
assert state.state == STATE_UNKNOWN
|
assert state.state == STATE_UNKNOWN
|
||||||
|
|
||||||
entry = entity_registry.async_get("button.frenck_s_lametric_next_app")
|
entry = entity_registry.async_get("button.frenck_s_lametric_next_app")
|
||||||
@ -80,7 +78,6 @@ async def test_button_app_previous(
|
|||||||
"""Test the LaMetric previous app button."""
|
"""Test the LaMetric previous app button."""
|
||||||
state = hass.states.get("button.frenck_s_lametric_previous_app")
|
state = hass.states.get("button.frenck_s_lametric_previous_app")
|
||||||
assert state
|
assert state
|
||||||
assert state.attributes.get(ATTR_ICON) == "mdi:arrow-left-bold"
|
|
||||||
assert state.state == STATE_UNKNOWN
|
assert state.state == STATE_UNKNOWN
|
||||||
|
|
||||||
entry = entity_registry.async_get("button.frenck_s_lametric_previous_app")
|
entry = entity_registry.async_get("button.frenck_s_lametric_previous_app")
|
||||||
@ -127,7 +124,6 @@ async def test_button_dismiss_current_notification(
|
|||||||
"""Test the LaMetric dismiss current notification button."""
|
"""Test the LaMetric dismiss current notification button."""
|
||||||
state = hass.states.get("button.frenck_s_lametric_dismiss_current_notification")
|
state = hass.states.get("button.frenck_s_lametric_dismiss_current_notification")
|
||||||
assert state
|
assert state
|
||||||
assert state.attributes.get(ATTR_ICON) == "mdi:bell-cancel"
|
|
||||||
assert state.state == STATE_UNKNOWN
|
assert state.state == STATE_UNKNOWN
|
||||||
|
|
||||||
entry = entity_registry.async_get(
|
entry = entity_registry.async_get(
|
||||||
@ -176,7 +172,6 @@ async def test_button_dismiss_all_notifications(
|
|||||||
"""Test the LaMetric dismiss all notifications button."""
|
"""Test the LaMetric dismiss all notifications button."""
|
||||||
state = hass.states.get("button.frenck_s_lametric_dismiss_all_notifications")
|
state = hass.states.get("button.frenck_s_lametric_dismiss_all_notifications")
|
||||||
assert state
|
assert state
|
||||||
assert state.attributes.get(ATTR_ICON) == "mdi:bell-cancel"
|
|
||||||
assert state.state == STATE_UNKNOWN
|
assert state.state == STATE_UNKNOWN
|
||||||
|
|
||||||
entry = entity_registry.async_get(
|
entry = entity_registry.async_get(
|
||||||
|
@ -18,7 +18,6 @@ from homeassistant.const import (
|
|||||||
ATTR_DEVICE_CLASS,
|
ATTR_DEVICE_CLASS,
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
ATTR_FRIENDLY_NAME,
|
ATTR_FRIENDLY_NAME,
|
||||||
ATTR_ICON,
|
|
||||||
ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
@ -42,7 +41,6 @@ async def test_brightness(
|
|||||||
assert state
|
assert state
|
||||||
assert state.attributes.get(ATTR_DEVICE_CLASS) is None
|
assert state.attributes.get(ATTR_DEVICE_CLASS) is None
|
||||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Frenck's LaMetric Brightness"
|
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Frenck's LaMetric Brightness"
|
||||||
assert state.attributes.get(ATTR_ICON) == "mdi:brightness-6"
|
|
||||||
assert state.attributes.get(ATTR_MAX) == 100
|
assert state.attributes.get(ATTR_MAX) == 100
|
||||||
assert state.attributes.get(ATTR_MIN) == 0
|
assert state.attributes.get(ATTR_MIN) == 0
|
||||||
assert state.attributes.get(ATTR_STEP) == 1
|
assert state.attributes.get(ATTR_STEP) == 1
|
||||||
@ -92,7 +90,6 @@ async def test_volume(
|
|||||||
assert state
|
assert state
|
||||||
assert state.attributes.get(ATTR_DEVICE_CLASS) is None
|
assert state.attributes.get(ATTR_DEVICE_CLASS) is None
|
||||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Frenck's LaMetric Volume"
|
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Frenck's LaMetric Volume"
|
||||||
assert state.attributes.get(ATTR_ICON) == "mdi:volume-high"
|
|
||||||
assert state.attributes.get(ATTR_MAX) == 100
|
assert state.attributes.get(ATTR_MAX) == 100
|
||||||
assert state.attributes.get(ATTR_MIN) == 0
|
assert state.attributes.get(ATTR_MIN) == 0
|
||||||
assert state.attributes.get(ATTR_STEP) == 1
|
assert state.attributes.get(ATTR_STEP) == 1
|
||||||
|
@ -14,7 +14,6 @@ from homeassistant.components.select import (
|
|||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
ATTR_FRIENDLY_NAME,
|
ATTR_FRIENDLY_NAME,
|
||||||
ATTR_ICON,
|
|
||||||
ATTR_OPTION,
|
ATTR_OPTION,
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
EntityCategory,
|
EntityCategory,
|
||||||
@ -38,7 +37,6 @@ async def test_brightness_mode(
|
|||||||
assert (
|
assert (
|
||||||
state.attributes.get(ATTR_FRIENDLY_NAME) == "Frenck's LaMetric Brightness mode"
|
state.attributes.get(ATTR_FRIENDLY_NAME) == "Frenck's LaMetric Brightness mode"
|
||||||
)
|
)
|
||||||
assert state.attributes.get(ATTR_ICON) == "mdi:brightness-auto"
|
|
||||||
assert state.attributes.get(ATTR_OPTIONS) == ["auto", "manual"]
|
assert state.attributes.get(ATTR_OPTIONS) == ["auto", "manual"]
|
||||||
assert state.state == BrightnessMode.AUTO
|
assert state.state == BrightnessMode.AUTO
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ from homeassistant.components.sensor import ATTR_STATE_CLASS, SensorStateClass
|
|||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_DEVICE_CLASS,
|
ATTR_DEVICE_CLASS,
|
||||||
ATTR_FRIENDLY_NAME,
|
ATTR_FRIENDLY_NAME,
|
||||||
ATTR_ICON,
|
|
||||||
ATTR_UNIT_OF_MEASUREMENT,
|
ATTR_UNIT_OF_MEASUREMENT,
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
EntityCategory,
|
EntityCategory,
|
||||||
@ -30,7 +29,6 @@ async def test_wifi_signal(
|
|||||||
assert state
|
assert state
|
||||||
assert state.attributes.get(ATTR_DEVICE_CLASS) is None
|
assert state.attributes.get(ATTR_DEVICE_CLASS) is None
|
||||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Frenck's LaMetric Wi-Fi signal"
|
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Frenck's LaMetric Wi-Fi signal"
|
||||||
assert state.attributes.get(ATTR_ICON) == "mdi:wifi"
|
|
||||||
assert state.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.MEASUREMENT
|
assert state.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.MEASUREMENT
|
||||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||||
assert state.state == "21"
|
assert state.state == "21"
|
||||||
|
@ -15,7 +15,6 @@ from homeassistant.const import (
|
|||||||
ATTR_DEVICE_CLASS,
|
ATTR_DEVICE_CLASS,
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
ATTR_FRIENDLY_NAME,
|
ATTR_FRIENDLY_NAME,
|
||||||
ATTR_ICON,
|
|
||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
EntityCategory,
|
EntityCategory,
|
||||||
@ -41,7 +40,6 @@ async def test_bluetooth(
|
|||||||
assert state
|
assert state
|
||||||
assert state.attributes.get(ATTR_DEVICE_CLASS) is None
|
assert state.attributes.get(ATTR_DEVICE_CLASS) is None
|
||||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Frenck's LaMetric Bluetooth"
|
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Frenck's LaMetric Bluetooth"
|
||||||
assert state.attributes.get(ATTR_ICON) == "mdi:bluetooth"
|
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
entry = entity_registry.async_get(state.entity_id)
|
entry = entity_registry.async_get(state.entity_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user