mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 13:57:10 +00:00
Add entity translations to Goodwe (#98224)
* Add entity translations to Goodwe * Add entity translations to Goodwe
This commit is contained in:
parent
c3c00e6984
commit
318aa9b95a
@ -34,7 +34,7 @@ class GoodweButtonEntityDescription(
|
|||||||
|
|
||||||
SYNCHRONIZE_CLOCK = GoodweButtonEntityDescription(
|
SYNCHRONIZE_CLOCK = GoodweButtonEntityDescription(
|
||||||
key="synchronize_clock",
|
key="synchronize_clock",
|
||||||
name="Synchronize inverter clock",
|
translation_key="synchronize_clock",
|
||||||
icon="mdi:clock-check-outline",
|
icon="mdi:clock-check-outline",
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
action=lambda inv: inv.write_setting("time", datetime.now()),
|
action=lambda inv: inv.write_setting("time", datetime.now()),
|
||||||
@ -66,6 +66,7 @@ class GoodweButtonEntity(ButtonEntity):
|
|||||||
"""Entity representing the inverter clock synchronization button."""
|
"""Entity representing the inverter clock synchronization button."""
|
||||||
|
|
||||||
_attr_should_poll = False
|
_attr_should_poll = False
|
||||||
|
_attr_has_entity_name = True
|
||||||
entity_description: GoodweButtonEntityDescription
|
entity_description: GoodweButtonEntityDescription
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -45,10 +45,12 @@ def _get_setting_unit(inverter: Inverter, setting: str) -> str:
|
|||||||
|
|
||||||
|
|
||||||
NUMBERS = (
|
NUMBERS = (
|
||||||
|
# Only one of the export limits are added.
|
||||||
|
# Availability is checked in the filter method.
|
||||||
# Export limit in W
|
# Export limit in W
|
||||||
GoodweNumberEntityDescription(
|
GoodweNumberEntityDescription(
|
||||||
key="grid_export_limit",
|
key="grid_export_limit",
|
||||||
name="Grid export limit",
|
translation_key="grid_export_limit",
|
||||||
icon="mdi:transmission-tower",
|
icon="mdi:transmission-tower",
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
device_class=NumberDeviceClass.POWER,
|
device_class=NumberDeviceClass.POWER,
|
||||||
@ -63,7 +65,7 @@ NUMBERS = (
|
|||||||
# Export limit in %
|
# Export limit in %
|
||||||
GoodweNumberEntityDescription(
|
GoodweNumberEntityDescription(
|
||||||
key="grid_export_limit",
|
key="grid_export_limit",
|
||||||
name="Grid export limit",
|
translation_key="grid_export_limit",
|
||||||
icon="mdi:transmission-tower",
|
icon="mdi:transmission-tower",
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
@ -76,7 +78,7 @@ NUMBERS = (
|
|||||||
),
|
),
|
||||||
GoodweNumberEntityDescription(
|
GoodweNumberEntityDescription(
|
||||||
key="battery_discharge_depth",
|
key="battery_discharge_depth",
|
||||||
name="Depth of discharge (on-grid)",
|
translation_key="battery_discharge_depth",
|
||||||
icon="mdi:battery-arrow-down",
|
icon="mdi:battery-arrow-down",
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
@ -120,6 +122,7 @@ class InverterNumberEntity(NumberEntity):
|
|||||||
"""Inverter numeric setting entity."""
|
"""Inverter numeric setting entity."""
|
||||||
|
|
||||||
_attr_should_poll = False
|
_attr_should_poll = False
|
||||||
|
_attr_has_entity_name = True
|
||||||
entity_description: GoodweNumberEntityDescription
|
entity_description: GoodweNumberEntityDescription
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -31,7 +31,6 @@ _OPTION_TO_MODE: dict[str, OperationMode] = {
|
|||||||
|
|
||||||
OPERATION_MODE = SelectEntityDescription(
|
OPERATION_MODE = SelectEntityDescription(
|
||||||
key="operation_mode",
|
key="operation_mode",
|
||||||
name="Inverter operation mode",
|
|
||||||
icon="mdi:solar-power",
|
icon="mdi:solar-power",
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
translation_key="operation_mode",
|
translation_key="operation_mode",
|
||||||
@ -72,6 +71,7 @@ class InverterOperationModeEntity(SelectEntity):
|
|||||||
"""Entity representing the inverter operation mode."""
|
"""Entity representing the inverter operation mode."""
|
||||||
|
|
||||||
_attr_should_poll = False
|
_attr_should_poll = False
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
@ -18,8 +18,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"entity": {
|
"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": {
|
"select": {
|
||||||
"operation_mode": {
|
"operation_mode": {
|
||||||
|
"name": "Inverter operation mode",
|
||||||
"state": {
|
"state": {
|
||||||
"general": "General mode",
|
"general": "General mode",
|
||||||
"off_grid": "Off grid mode",
|
"off_grid": "Off grid mode",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user