Add device model ID if provided by NUT (#124189)
Co-authored-by: J. Nick Koston <nick@koston.org>pull/129882/head
parent
ae37c8cc7a
commit
27dc82d7d0
|
@ -130,6 +130,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: NutConfigEntry) -> bool:
|
|||
name=data.name.title(),
|
||||
manufacturer=data.device_info.manufacturer,
|
||||
model=data.device_info.model,
|
||||
model_id=data.device_info.model_id,
|
||||
sw_version=data.device_info.firmware,
|
||||
serial_number=data.device_info.serial,
|
||||
suggested_area=data.device_info.device_location,
|
||||
|
@ -210,6 +211,7 @@ class NUTDeviceInfo:
|
|||
|
||||
manufacturer: str | None = None
|
||||
model: str | None = None
|
||||
model_id: str | None = None
|
||||
firmware: str | None = None
|
||||
serial: str | None = None
|
||||
device_location: str | None = None
|
||||
|
@ -271,10 +273,13 @@ class PyNUTData:
|
|||
|
||||
manufacturer = _manufacturer_from_status(self._status)
|
||||
model = _model_from_status(self._status)
|
||||
model_id: str | None = self._status.get("device.part")
|
||||
firmware = _firmware_from_status(self._status)
|
||||
serial = _serial_from_status(self._status)
|
||||
device_location: str | None = self._status.get("device.location")
|
||||
return NUTDeviceInfo(manufacturer, model, firmware, serial, device_location)
|
||||
return NUTDeviceInfo(
|
||||
manufacturer, model, model_id, firmware, serial, device_location
|
||||
)
|
||||
|
||||
async def _async_get_status(self) -> dict[str, str]:
|
||||
"""Get the ups status from NUT."""
|
||||
|
|
Loading…
Reference in New Issue