mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Fix version extraction for APsystems (#138023)
Co-authored-by: Marlon <mawol@protonmail.com>
This commit is contained in:
parent
8bf870f296
commit
620141cfb1
@ -19,10 +19,20 @@ class ApSystemsEntity(Entity):
|
|||||||
data: ApSystemsData,
|
data: ApSystemsData,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the APsystems entity."""
|
"""Initialize the APsystems entity."""
|
||||||
|
|
||||||
|
# Handle device version safely
|
||||||
|
sw_version = None
|
||||||
|
if data.coordinator.device_version:
|
||||||
|
version_parts = data.coordinator.device_version.split(" ")
|
||||||
|
if len(version_parts) > 1:
|
||||||
|
sw_version = version_parts[1]
|
||||||
|
else:
|
||||||
|
sw_version = version_parts[0]
|
||||||
|
|
||||||
self._attr_device_info = DeviceInfo(
|
self._attr_device_info = DeviceInfo(
|
||||||
identifiers={(DOMAIN, data.device_id)},
|
identifiers={(DOMAIN, data.device_id)},
|
||||||
manufacturer="APsystems",
|
manufacturer="APsystems",
|
||||||
model="EZ1-M",
|
model="EZ1-M",
|
||||||
serial_number=data.device_id,
|
serial_number=data.device_id,
|
||||||
sw_version=data.coordinator.device_version.split(" ")[1],
|
sw_version=sw_version,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user