Skip to content

Commit

Permalink
Set min_power similar to max_power to support all inverters from apsy…
Browse files Browse the repository at this point in the history
…stems (#124247)

Set min_power similar to max_power to support all inverters from apsystems ez1 series
  • Loading branch information
mawoka-myblock authored and balloob committed Sep 6, 2024
1 parent 0b95cf1 commit 5cf89bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions homeassistant/components/apsystems/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ def __init__(self, hass: HomeAssistant, api: APsystemsEZ1M) -> None:

async def _async_setup(self) -> None:
try:
max_power = (await self.api.get_device_info()).maxPower
device_info = await self.api.get_device_info()
except (ConnectionError, TimeoutError):
raise UpdateFailed from None
self.api.max_power = max_power
self.api.max_power = device_info.maxPower
self.api.min_power = device_info.minPower

async def _async_update_data(self) -> ApSystemsSensorData:
output_data = await self.api.get_output_data()
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/apsystems/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ async def async_setup_entry(
class ApSystemsMaxOutputNumber(ApSystemsEntity, NumberEntity):
"""Base sensor to be used with description."""

_attr_native_min_value = 30
_attr_native_step = 1
_attr_device_class = NumberDeviceClass.POWER
_attr_mode = NumberMode.BOX
Expand All @@ -42,6 +41,7 @@ def __init__(
self._api = data.coordinator.api
self._attr_unique_id = f"{data.device_id}_output_limit"
self._attr_native_max_value = data.coordinator.api.max_power
self._attr_native_min_value = data.coordinator.api.min_power

async def async_update(self) -> None:
"""Set the state with the value fetched from the inverter."""
Expand Down

0 comments on commit 5cf89bf

Please sign in to comment.