Handle all zero serial numbers in NUT (#34045)

* Handle all zero serial numbers in NUT

* Add additional nut tests

* Update homeassistant/components/nut/__init__.py

Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>

* remove re

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
J. Nick KostonandPaulus Schoutsen authored and GitHub committed 2020-04-12 15:29:35 -07:00
1 parent c75d3ce8c7
commit 173d7fa060
5 files changed
+157 -5

No files matched your search

+1 -1
View File
@@ -134,7 +134,7 @@ 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 == "unknown":
if serial and (serial.lower() == "unknown" or serial.count("0") == len(serial)):
return None
return serial