mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Fix goodwe export limit unit on single phase DT inverters (#90427)
* Fix export limit unit on single phase DT inverters * Update homeassistant/components/goodwe/number.py --------- Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
parent
d427c35c87
commit
a1c94919de
@ -6,5 +6,5 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/goodwe",
|
||||
"iot_class": "local_polling",
|
||||
"loggers": ["goodwe"],
|
||||
"requirements": ["goodwe==0.2.25"]
|
||||
"requirements": ["goodwe==0.2.29"]
|
||||
}
|
||||
|
@ -39,8 +39,13 @@ class GoodweNumberEntityDescription(
|
||||
"""Class describing Goodwe number entities."""
|
||||
|
||||
|
||||
def _get_setting_unit(inverter: Inverter, setting: str) -> str:
|
||||
"""Return the unit of an inverter setting."""
|
||||
return next((s.unit for s in inverter.settings() if s.id_ == setting), "")
|
||||
|
||||
|
||||
NUMBERS = (
|
||||
# non DT inverters (limit in W)
|
||||
# Export limit in W
|
||||
GoodweNumberEntityDescription(
|
||||
key="grid_export_limit",
|
||||
name="Grid export limit",
|
||||
@ -53,9 +58,9 @@ NUMBERS = (
|
||||
native_max_value=10000,
|
||||
getter=lambda inv: inv.get_grid_export_limit(),
|
||||
setter=lambda inv, val: inv.set_grid_export_limit(val),
|
||||
filter=lambda inv: type(inv).__name__ != "DT",
|
||||
filter=lambda inv: _get_setting_unit(inv, "grid_export_limit") != "%",
|
||||
),
|
||||
# DT inverters (limit is in %)
|
||||
# Export limit in %
|
||||
GoodweNumberEntityDescription(
|
||||
key="grid_export_limit",
|
||||
name="Grid export limit",
|
||||
@ -67,7 +72,7 @@ NUMBERS = (
|
||||
native_max_value=100,
|
||||
getter=lambda inv: inv.get_grid_export_limit(),
|
||||
setter=lambda inv, val: inv.set_grid_export_limit(val),
|
||||
filter=lambda inv: type(inv).__name__ == "DT",
|
||||
filter=lambda inv: _get_setting_unit(inv, "grid_export_limit") == "%",
|
||||
),
|
||||
GoodweNumberEntityDescription(
|
||||
key="battery_discharge_depth",
|
||||
|
@ -798,7 +798,7 @@ glances_api==0.4.1
|
||||
goalzero==0.2.1
|
||||
|
||||
# homeassistant.components.goodwe
|
||||
goodwe==0.2.25
|
||||
goodwe==0.2.29
|
||||
|
||||
# homeassistant.components.google_mail
|
||||
google-api-python-client==2.71.0
|
||||
|
@ -614,7 +614,7 @@ glances_api==0.4.1
|
||||
goalzero==0.2.1
|
||||
|
||||
# homeassistant.components.goodwe
|
||||
goodwe==0.2.25
|
||||
goodwe==0.2.29
|
||||
|
||||
# homeassistant.components.google_mail
|
||||
google-api-python-client==2.71.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user