Add icon translations to Lametric (#111854)

This commit is contained in:
Joost Lekkerkerker 2024-03-12 18:52:58 +01:00 committed by GitHub
parent 21a021944f
commit f9b2c35418
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 47 additions and 23 deletions

View file

@ -31,28 +31,24 @@ BUTTONS = [
LaMetricButtonEntityDescription(
key="app_next",
translation_key="app_next",
icon="mdi:arrow-right-bold",
entity_category=EntityCategory.CONFIG,
press_fn=lambda api: api.app_next(),
),
LaMetricButtonEntityDescription(
key="app_previous",
translation_key="app_previous",
icon="mdi:arrow-left-bold",
entity_category=EntityCategory.CONFIG,
press_fn=lambda api: api.app_previous(),
),
LaMetricButtonEntityDescription(
key="dismiss_current",
translation_key="dismiss_current",
icon="mdi:bell-cancel",
entity_category=EntityCategory.CONFIG,
press_fn=lambda api: api.dismiss_current_notification(),
),
LaMetricButtonEntityDescription(
key="dismiss_all",
translation_key="dismiss_all",
icon="mdi:bell-cancel",
entity_category=EntityCategory.CONFIG,
press_fn=lambda api: api.dismiss_all_notifications(),
),

View 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"
}
}

View file

@ -31,8 +31,8 @@ class LaMetricNumberEntityDescription(NumberEntityDescription):
NUMBERS = [
LaMetricNumberEntityDescription(
key="brightness",
translation_key="brightness",
name="Brightness",
icon="mdi:brightness-6",
entity_category=EntityCategory.CONFIG,
native_step=1,
native_min_value=0,
@ -43,8 +43,8 @@ NUMBERS = [
),
LaMetricNumberEntityDescription(
key="volume",
translation_key="volume",
name="Volume",
icon="mdi:volume-high",
entity_category=EntityCategory.CONFIG,
native_step=1,
native_min_value=0,

View file

@ -32,7 +32,6 @@ SELECTS = [
LaMetricSelectEntityDescription(
key="brightness_mode",
translation_key="brightness_mode",
icon="mdi:brightness-auto",
entity_category=EntityCategory.CONFIG,
options=["auto", "manual"],
current_fn=lambda device: device.display.brightness_mode.value,

View file

@ -33,7 +33,6 @@ SENSORS = [
LaMetricSensorEntityDescription(
key="rssi",
translation_key="rssi",
icon="mdi:wifi",
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
native_unit_of_measurement=PERCENTAGE,

View file

@ -33,7 +33,6 @@ SWITCHES = [
LaMetricSwitchEntityDescription(
key="bluetooth",
translation_key="bluetooth",
icon="mdi:bluetooth",
entity_category=EntityCategory.CONFIG,
available_fn=lambda device: device.bluetooth.available,
is_on_fn=lambda device: device.bluetooth.active,

View file

@ -9,7 +9,6 @@ from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN, SERVICE_PRE
from homeassistant.components.lametric.const import DOMAIN
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_ICON,
STATE_UNAVAILABLE,
STATE_UNKNOWN,
EntityCategory,
@ -33,7 +32,6 @@ async def test_button_app_next(
"""Test the LaMetric next app button."""
state = hass.states.get("button.frenck_s_lametric_next_app")
assert state
assert state.attributes.get(ATTR_ICON) == "mdi:arrow-right-bold"
assert state.state == STATE_UNKNOWN
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."""
state = hass.states.get("button.frenck_s_lametric_previous_app")
assert state
assert state.attributes.get(ATTR_ICON) == "mdi:arrow-left-bold"
assert state.state == STATE_UNKNOWN
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."""
state = hass.states.get("button.frenck_s_lametric_dismiss_current_notification")
assert state
assert state.attributes.get(ATTR_ICON) == "mdi:bell-cancel"
assert state.state == STATE_UNKNOWN
entry = entity_registry.async_get(
@ -176,7 +172,6 @@ async def test_button_dismiss_all_notifications(
"""Test the LaMetric dismiss all notifications button."""
state = hass.states.get("button.frenck_s_lametric_dismiss_all_notifications")
assert state
assert state.attributes.get(ATTR_ICON) == "mdi:bell-cancel"
assert state.state == STATE_UNKNOWN
entry = entity_registry.async_get(

View file

@ -18,7 +18,6 @@ from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_ENTITY_ID,
ATTR_FRIENDLY_NAME,
ATTR_ICON,
ATTR_UNIT_OF_MEASUREMENT,
PERCENTAGE,
STATE_UNAVAILABLE,
@ -42,7 +41,6 @@ async def test_brightness(
assert state
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_ICON) == "mdi:brightness-6"
assert state.attributes.get(ATTR_MAX) == 100
assert state.attributes.get(ATTR_MIN) == 0
assert state.attributes.get(ATTR_STEP) == 1
@ -92,7 +90,6 @@ async def test_volume(
assert state
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_ICON) == "mdi:volume-high"
assert state.attributes.get(ATTR_MAX) == 100
assert state.attributes.get(ATTR_MIN) == 0
assert state.attributes.get(ATTR_STEP) == 1

View file

@ -14,7 +14,6 @@ from homeassistant.components.select import (
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_FRIENDLY_NAME,
ATTR_ICON,
ATTR_OPTION,
STATE_UNAVAILABLE,
EntityCategory,
@ -38,7 +37,6 @@ async def test_brightness_mode(
assert (
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.state == BrightnessMode.AUTO

View file

@ -7,7 +7,6 @@ from homeassistant.components.sensor import ATTR_STATE_CLASS, SensorStateClass
from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_FRIENDLY_NAME,
ATTR_ICON,
ATTR_UNIT_OF_MEASUREMENT,
PERCENTAGE,
EntityCategory,
@ -30,7 +29,6 @@ async def test_wifi_signal(
assert state
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_ICON) == "mdi:wifi"
assert state.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.MEASUREMENT
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
assert state.state == "21"

View file

@ -15,7 +15,6 @@ from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_ENTITY_ID,
ATTR_FRIENDLY_NAME,
ATTR_ICON,
STATE_OFF,
STATE_UNAVAILABLE,
EntityCategory,
@ -41,7 +40,6 @@ async def test_bluetooth(
assert state
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_ICON) == "mdi:bluetooth"
assert state.state == STATE_OFF
entry = entity_registry.async_get(state.entity_id)