Add entity translations to Goodwe (#98224)

* Add entity translations to Goodwe

* Add entity translations to Goodwe
This commit is contained in:
Joost Lekkerkerker 2023-08-14 19:35:31 +02:00 committed by GitHub
parent c3c00e6984
commit 318aa9b95a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 5 deletions

View file

@ -34,7 +34,7 @@ class GoodweButtonEntityDescription(
SYNCHRONIZE_CLOCK = GoodweButtonEntityDescription(
key="synchronize_clock",
name="Synchronize inverter clock",
translation_key="synchronize_clock",
icon="mdi:clock-check-outline",
entity_category=EntityCategory.CONFIG,
action=lambda inv: inv.write_setting("time", datetime.now()),
@ -66,6 +66,7 @@ class GoodweButtonEntity(ButtonEntity):
"""Entity representing the inverter clock synchronization button."""
_attr_should_poll = False
_attr_has_entity_name = True
entity_description: GoodweButtonEntityDescription
def __init__(

View file

@ -45,10 +45,12 @@ def _get_setting_unit(inverter: Inverter, setting: str) -> str:
NUMBERS = (
# Only one of the export limits are added.
# Availability is checked in the filter method.
# Export limit in W
GoodweNumberEntityDescription(
key="grid_export_limit",
name="Grid export limit",
translation_key="grid_export_limit",
icon="mdi:transmission-tower",
entity_category=EntityCategory.CONFIG,
device_class=NumberDeviceClass.POWER,
@ -63,7 +65,7 @@ NUMBERS = (
# Export limit in %
GoodweNumberEntityDescription(
key="grid_export_limit",
name="Grid export limit",
translation_key="grid_export_limit",
icon="mdi:transmission-tower",
entity_category=EntityCategory.CONFIG,
native_unit_of_measurement=PERCENTAGE,
@ -76,7 +78,7 @@ NUMBERS = (
),
GoodweNumberEntityDescription(
key="battery_discharge_depth",
name="Depth of discharge (on-grid)",
translation_key="battery_discharge_depth",
icon="mdi:battery-arrow-down",
entity_category=EntityCategory.CONFIG,
native_unit_of_measurement=PERCENTAGE,
@ -120,6 +122,7 @@ class InverterNumberEntity(NumberEntity):
"""Inverter numeric setting entity."""
_attr_should_poll = False
_attr_has_entity_name = True
entity_description: GoodweNumberEntityDescription
def __init__(

View file

@ -31,7 +31,6 @@ _OPTION_TO_MODE: dict[str, OperationMode] = {
OPERATION_MODE = SelectEntityDescription(
key="operation_mode",
name="Inverter operation mode",
icon="mdi:solar-power",
entity_category=EntityCategory.CONFIG,
translation_key="operation_mode",
@ -72,6 +71,7 @@ class InverterOperationModeEntity(SelectEntity):
"""Entity representing the inverter operation mode."""
_attr_should_poll = False
_attr_has_entity_name = True
def __init__(
self,

View file

@ -18,8 +18,22 @@
}
},
"entity": {
"button": {
"synchronize_clock": {
"name": "Synchronize inverter clock"
}
},
"number": {
"grid_export_limit": {
"name": "Grid export limit"
},
"battery_discharge_depth": {
"name": "Depth of discharge (on-grid)"
}
},
"select": {
"operation_mode": {
"name": "Inverter operation mode",
"state": {
"general": "General mode",
"off_grid": "Off grid mode",