Skip to content

Commit

Permalink
Update goodwe library to v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mletenay committed Feb 5, 2024
1 parent 1b59175 commit c237b8a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
5 changes: 3 additions & 2 deletions custom_components/goodwe/button.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""GoodWe PV inverter selection settings entities."""

from collections.abc import Awaitable, Callable
from dataclasses import dataclass
from datetime import datetime
Expand All @@ -18,14 +19,14 @@
_LOGGER = logging.getLogger(__name__)


@dataclass
@dataclass(frozen=True)
class GoodweButtonEntityDescriptionRequired:
"""Required attributes of GoodweButtonEntityDescription."""

action: Callable[[Inverter], Awaitable[None]]


@dataclass
@dataclass(frozen=True)
class GoodweButtonEntityDescription(
ButtonEntityDescription, GoodweButtonEntityDescriptionRequired
):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/goodwe/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/mletenay/home-assistant-goodwe-inverter/issues",
"loggers": ["goodwe"],
"requirements": ["goodwe==0.2.33"],
"requirements": ["goodwe==0.3.0"],
"version": "1.0.0"
}
5 changes: 3 additions & 2 deletions custom_components/goodwe/number.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""GoodWe PV inverter numeric settings entities."""

from __future__ import annotations

from collections.abc import Awaitable, Callable
Expand All @@ -23,7 +24,7 @@
_LOGGER = logging.getLogger(__name__)


@dataclass
@dataclass(frozen=True)
class GoodweNumberEntityDescriptionBase:
"""Required values when describing Goodwe number entities."""

Expand All @@ -33,7 +34,7 @@ class GoodweNumberEntityDescriptionBase:
filter: Callable[[Inverter], bool]


@dataclass
@dataclass(frozen=True)
class GoodweNumberEntityDescription(
NumberEntityDescription, GoodweNumberEntityDescriptionBase
):
Expand Down
15 changes: 8 additions & 7 deletions custom_components/goodwe/sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Support for GoodWe inverter via UDP."""

from __future__ import annotations

from collections.abc import Callable
Expand Down Expand Up @@ -75,16 +76,16 @@
}


@dataclass
@dataclass(frozen=True)
class GoodweSensorEntityDescription(SensorEntityDescription):
"""Class describing Goodwe sensor entities."""

value: Callable[
[GoodweUpdateCoordinator, str], Any
] = lambda coordinator, sensor: coordinator.sensor_value(sensor)
available: Callable[
[GoodweUpdateCoordinator], bool
] = lambda coordinator: coordinator.last_update_success
value: Callable[[GoodweUpdateCoordinator, str], Any] = (
lambda coordinator, sensor: coordinator.sensor_value(sensor)
)
available: Callable[[GoodweUpdateCoordinator], bool] = (
lambda coordinator: coordinator.last_update_success
)


_DESCRIPTIONS: dict[str, GoodweSensorEntityDescription] = {
Expand Down

0 comments on commit c237b8a

Please sign in to comment.