Add sw_version to apsystems (#134441)

pull/134440/head^2
Thomas55555 2025-01-02 12:28:48 +01:00 committed by GitHub
parent 08019e76d8
commit 4bcc551b61
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 2 deletions

View File

@ -29,6 +29,8 @@ class ApSystemsSensorData:
class ApSystemsDataCoordinator(DataUpdateCoordinator[ApSystemsSensorData]):
"""Coordinator used for all sensors."""
device_version: str
def __init__(self, hass: HomeAssistant, api: APsystemsEZ1M) -> None:
"""Initialize my coordinator."""
super().__init__(
@ -46,6 +48,7 @@ class ApSystemsDataCoordinator(DataUpdateCoordinator[ApSystemsSensorData]):
raise UpdateFailed from None
self.api.max_power = device_info.maxPower
self.api.min_power = device_info.minPower
self.device_version = device_info.devVer
async def _async_update_data(self) -> ApSystemsSensorData:
try:

View File

@ -21,7 +21,8 @@ class ApSystemsEntity(Entity):
"""Initialize the APsystems entity."""
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, data.device_id)},
serial_number=data.device_id,
manufacturer="APsystems",
model="EZ1-M",
serial_number=data.device_id,
sw_version=data.coordinator.device_version.split(" ")[1],
)

View File

@ -38,7 +38,7 @@ def mock_apsystems() -> Generator[MagicMock]:
mock_api = mock_client.return_value
mock_api.get_device_info.return_value = ReturnDeviceInfo(
deviceId="MY_SERIAL_NUMBER",
devVer="1.0.0",
devVer="EZ1 1.0.0",
ssid="MY_SSID",
ipAddr="127.0.01",
minPower=0,