mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Add device model ID if provided by NUT (#124189)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
ae37c8cc7a
commit
27dc82d7d0
@ -130,6 +130,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: NutConfigEntry) -> bool:
|
|||||||
name=data.name.title(),
|
name=data.name.title(),
|
||||||
manufacturer=data.device_info.manufacturer,
|
manufacturer=data.device_info.manufacturer,
|
||||||
model=data.device_info.model,
|
model=data.device_info.model,
|
||||||
|
model_id=data.device_info.model_id,
|
||||||
sw_version=data.device_info.firmware,
|
sw_version=data.device_info.firmware,
|
||||||
serial_number=data.device_info.serial,
|
serial_number=data.device_info.serial,
|
||||||
suggested_area=data.device_info.device_location,
|
suggested_area=data.device_info.device_location,
|
||||||
@ -210,6 +211,7 @@ class NUTDeviceInfo:
|
|||||||
|
|
||||||
manufacturer: str | None = None
|
manufacturer: str | None = None
|
||||||
model: str | None = None
|
model: str | None = None
|
||||||
|
model_id: str | None = None
|
||||||
firmware: str | None = None
|
firmware: str | None = None
|
||||||
serial: str | None = None
|
serial: str | None = None
|
||||||
device_location: str | None = None
|
device_location: str | None = None
|
||||||
@ -271,10 +273,13 @@ class PyNUTData:
|
|||||||
|
|
||||||
manufacturer = _manufacturer_from_status(self._status)
|
manufacturer = _manufacturer_from_status(self._status)
|
||||||
model = _model_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)
|
firmware = _firmware_from_status(self._status)
|
||||||
serial = _serial_from_status(self._status)
|
serial = _serial_from_status(self._status)
|
||||||
device_location: str | None = self._status.get("device.location")
|
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]:
|
async def _async_get_status(self) -> dict[str, str]:
|
||||||
"""Get the ups status from NUT."""
|
"""Get the ups status from NUT."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user