Add sw_version to apsystems (#134441)
parent
08019e76d8
commit
4bcc551b61
|
@ -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:
|
||||
|
|
|
@ -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],
|
||||
)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue