diff --git a/CHANGELOG.md b/CHANGELOG.md index e11edc4f9..f34f0e54d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Ongoing +- PR [321](https://github.com/plugwise/python-plugwise-usb/pull/321): Catch error reported in Issue [#312](https://github.com/plugwise/plugwise_usb-beta/issues/312) - PR [319](https://github.com/plugwise/python-plugwise-usb/pull/319): Replace unclear warning message when a node is not online, also various small improvements suggested by CRAI. - PR [312](https://github.com/plugwise/python-plugwise-usb/pull/312): properly propagate configuration changes and initialize to available on first node wakeup diff --git a/plugwise_usb/helpers/util.py b/plugwise_usb/helpers/util.py index 19f9d1159..d2293b965 100644 --- a/plugwise_usb/helpers/util.py +++ b/plugwise_usb/helpers/util.py @@ -13,8 +13,12 @@ def validate_mac(mac: str) -> bool: """Validate the supplied string is in a MAC address format.""" - if not re.match("^[A-F0-9]+$", mac): + try: + if not re.match("^[A-F0-9]+$", mac): + return False + except TypeError: return False + try: _ = int(mac, 16) except ValueError: