Skip to content

Commit

Permalink
Bump apsystems-ez1 to 2.1.0 (#123225)
Browse files Browse the repository at this point in the history
Library update for apsystems fixing breaking changes
  • Loading branch information
mawoka-myblock authored Aug 19, 2024
1 parent 110ee9f commit f4997e4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
8 changes: 4 additions & 4 deletions homeassistant/components/apsystems/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,28 @@ class ApsystemsLocalApiBinarySensorDescription(BinarySensorEntityDescription):
translation_key="off_grid_status",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
is_on=lambda c: bool(c.og),
is_on=lambda c: c.offgrid,
),
ApsystemsLocalApiBinarySensorDescription(
key="dc_1_short_circuit_error_status",
translation_key="dc_1_short_circuit_error_status",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
is_on=lambda c: bool(c.isce1),
is_on=lambda c: c.shortcircuit_1,
),
ApsystemsLocalApiBinarySensorDescription(
key="dc_2_short_circuit_error_status",
translation_key="dc_2_short_circuit_error_status",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
is_on=lambda c: bool(c.isce2),
is_on=lambda c: c.shortcircuit_2,
),
ApsystemsLocalApiBinarySensorDescription(
key="output_fault_status",
translation_key="output_fault_status",
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
is_on=lambda c: bool(c.oe),
is_on=lambda c: not c.operating,
),
)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/apsystems/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/apsystems",
"integration_type": "device",
"iot_class": "local_polling",
"requirements": ["apsystems-ez1==1.3.3"]
"requirements": ["apsystems-ez1==2.1.0"]
}
7 changes: 3 additions & 4 deletions homeassistant/components/apsystems/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import Any

from aiohttp.client_exceptions import ClientConnectionError
from APsystemsEZ1 import Status

from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity
from homeassistant.core import HomeAssistant
Expand Down Expand Up @@ -45,12 +44,12 @@ async def async_update(self) -> None:
self._attr_available = False
else:
self._attr_available = True
self._attr_is_on = status == Status.normal
self._attr_is_on = status

async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn the switch on."""
await self._api.set_device_power_status(0)
await self._api.set_device_power_status(True)

async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn the switch off."""
await self._api.set_device_power_status(1)
await self._api.set_device_power_status(False)
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ apprise==1.8.0
aprslib==0.7.2

# homeassistant.components.apsystems
apsystems-ez1==1.3.3
apsystems-ez1==2.1.0

# homeassistant.components.aqualogic
aqualogic==2.6
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ apprise==1.8.0
aprslib==0.7.2

# homeassistant.components.apsystems
apsystems-ez1==1.3.3
apsystems-ez1==2.1.0

# homeassistant.components.aranet
aranet4==2.3.4
Expand Down
12 changes: 6 additions & 6 deletions tests/components/apsystems/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from collections.abc import Generator
from unittest.mock import AsyncMock, MagicMock, patch

from APsystemsEZ1 import ReturnAlarmInfo, ReturnDeviceInfo, ReturnOutputData, Status
from APsystemsEZ1 import ReturnAlarmInfo, ReturnDeviceInfo, ReturnOutputData
import pytest

from homeassistant.components.apsystems.const import DOMAIN
Expand Down Expand Up @@ -53,12 +53,12 @@ def mock_apsystems() -> Generator[MagicMock]:
te2=7.0,
)
mock_api.get_alarm_info.return_value = ReturnAlarmInfo(
og=Status.normal,
isce1=Status.alarm,
isce2=Status.normal,
oe=Status.alarm,
offgrid=False,
shortcircuit_1=True,
shortcircuit_2=False,
operating=False,
)
mock_api.get_device_power_status.return_value = Status.normal
mock_api.get_device_power_status.return_value = True
yield mock_api


Expand Down

0 comments on commit f4997e4

Please sign in to comment.