Add entity name translations to LaMetric (#90538)

* Add entity name translations to LaMetric

* Consistency
This commit is contained in:
Franck Nijhof 2023-03-31 02:54:31 +02:00 committed by GitHub
parent a2efe2445a
commit 47af325a88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 7 deletions

View File

@ -36,28 +36,28 @@ class LaMetricButtonEntityDescription(
BUTTONS = [ BUTTONS = [
LaMetricButtonEntityDescription( LaMetricButtonEntityDescription(
key="app_next", key="app_next",
name="Next app", translation_key="app_next",
icon="mdi:arrow-right-bold", 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",
name="Previous app", translation_key="app_previous",
icon="mdi:arrow-left-bold", 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",
name="Dismiss current notification", translation_key="dismiss_current",
icon="mdi:bell-cancel", 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",
name="Dismiss all notifications", translation_key="dismiss_all",
icon="mdi:bell-cancel", 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(),

View File

@ -37,11 +37,10 @@ class LaMetricSelectEntityDescription(
SELECTS = [ SELECTS = [
LaMetricSelectEntityDescription( LaMetricSelectEntityDescription(
key="brightness_mode", key="brightness_mode",
name="Brightness mode", translation_key="brightness_mode",
icon="mdi:brightness-auto", icon="mdi:brightness-auto",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
options=["auto", "manual"], options=["auto", "manual"],
translation_key="brightness_mode",
current_fn=lambda device: device.display.brightness_mode.value, current_fn=lambda device: device.display.brightness_mode.value,
select_fn=lambda api, opt: api.display(brightness_mode=BrightnessMode(opt)), select_fn=lambda api, opt: api.display(brightness_mode=BrightnessMode(opt)),
), ),

View File

@ -38,6 +38,7 @@ class LaMetricSensorEntityDescription(
SENSORS = [ SENSORS = [
LaMetricSensorEntityDescription( LaMetricSensorEntityDescription(
key="rssi", key="rssi",
translation_key="rssi",
name="Wi-Fi signal", name="Wi-Fi signal",
icon="mdi:wifi", icon="mdi:wifi",
entity_category=EntityCategory.DIAGNOSTIC, entity_category=EntityCategory.DIAGNOSTIC,

View File

@ -45,13 +45,38 @@
} }
}, },
"entity": { "entity": {
"button": {
"app_next": {
"name": "Next app"
},
"app_previous": {
"name": "Previous app"
},
"dismiss_current": {
"name": "Dismiss current notification"
},
"dismiss_all": {
"name": "Dismiss all notifications"
}
},
"sensor": {
"rssi": {
"name": "Wi-Fi signal"
}
},
"select": { "select": {
"brightness_mode": { "brightness_mode": {
"name": "Brightness mode",
"state": { "state": {
"auto": "Automatic", "auto": "Automatic",
"manual": "Manual" "manual": "Manual"
} }
} }
},
"switch": {
"bluetooth": {
"name": "Bluetooth"
}
} }
} }
} }

View File

@ -39,7 +39,7 @@ class LaMetricSwitchEntityDescription(
SWITCHES = [ SWITCHES = [
LaMetricSwitchEntityDescription( LaMetricSwitchEntityDescription(
key="bluetooth", key="bluetooth",
name="Bluetooth", translation_key="bluetooth",
icon="mdi: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,