Update apsystems library to support battery inverter (#140086)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
Marlon 2025-03-30 16:11:22 +02:00 committed by GitHub
parent 5a1aeff85c
commit acbee815be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 8 additions and 3 deletions

View File

@ -43,6 +43,7 @@ class ApSystemsDataCoordinator(DataUpdateCoordinator[ApSystemsSensorData]):
config_entry: ApSystemsConfigEntry
device_version: str
battery_system: bool
def __init__(
self,
@ -68,6 +69,7 @@ class ApSystemsDataCoordinator(DataUpdateCoordinator[ApSystemsSensorData]):
self.api.max_power = device_info.maxPower
self.api.min_power = device_info.minPower
self.device_version = device_info.devVer
self.battery_system = device_info.isBatterySystem
async def _async_update_data(self) -> ApSystemsSensorData:
try:

View File

@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/apsystems",
"integration_type": "device",
"iot_class": "local_polling",
"requirements": ["apsystems-ez1==2.4.0"]
"requirements": ["apsystems-ez1==2.5.0"]
}

View File

@ -36,6 +36,8 @@ class ApSystemsInverterSwitch(ApSystemsEntity, SwitchEntity):
super().__init__(data)
self._api = data.coordinator.api
self._attr_unique_id = f"{data.device_id}_inverter_status"
if data.coordinator.battery_system:
self._attr_available = False
async def async_update(self) -> None:
"""Update switch status and availability."""

2
requirements_all.txt generated
View File

@ -491,7 +491,7 @@ apprise==1.9.1
aprslib==0.7.2
# homeassistant.components.apsystems
apsystems-ez1==2.4.0
apsystems-ez1==2.5.0
# homeassistant.components.aqualogic
aqualogic==2.6

View File

@ -464,7 +464,7 @@ apprise==1.9.1
aprslib==0.7.2
# homeassistant.components.apsystems
apsystems-ez1==2.4.0
apsystems-ez1==2.5.0
# homeassistant.components.aranet
aranet4==2.5.1

View File

@ -43,6 +43,7 @@ def mock_apsystems() -> Generator[MagicMock]:
ipAddr="127.0.01",
minPower=0,
maxPower=1000,
isBatterySystem=False,
)
mock_api.get_output_data.return_value = ReturnOutputData(
p1=2.0,