From 7d1de80926cfbb0eb7f4beb32d3a45b290123fbb Mon Sep 17 00:00:00 2001 From: ollo69 <60491700+ollo69@users.noreply.github.com> Date: Thu, 30 Dec 2021 10:25:44 +0100 Subject: [PATCH] Ignore serial number "blank" from NUT (#63066) --- homeassistant/components/nut/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/nut/__init__.py b/homeassistant/components/nut/__init__.py index cb68e8d3328..6be66fe64c1 100644 --- a/homeassistant/components/nut/__init__.py +++ b/homeassistant/components/nut/__init__.py @@ -31,6 +31,8 @@ from .const import ( PYNUT_UNIQUE_ID, ) +NUT_FAKE_SERIAL = ["unknown", "blank"] + _LOGGER = logging.getLogger(__name__) @@ -145,7 +147,9 @@ def _firmware_from_status(status): def _serial_from_status(status): """Find the best serialvalue from the status.""" serial = status.get("device.serial") or status.get("ups.serial") - if serial and (serial.lower() == "unknown" or serial.count("0") == len(serial)): + if serial and ( + serial.lower() in NUT_FAKE_SERIAL or serial.count("0") == len(serial) + ): return None return serial