From c9a6f256aea22a873505d07679a5079b26170307 Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Wed, 9 Jun 2021 11:22:45 +0200 Subject: [PATCH] Smol bug fix for when UPnP device has no friendly name --- tinge/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tinge/__init__.py b/tinge/__init__.py index ffc5df8..418eb9c 100644 --- a/tinge/__init__.py +++ b/tinge/__init__.py @@ -4,7 +4,6 @@ import http import os from typing import Union -import simplejson import toml from upnpy import UPnP @@ -56,8 +55,10 @@ class Tinge: if (device.host not in self.m_discovered) and (device.host not in seen_ips): seen_ips.append(device.host) # Let's check if the device has the default name, if so we assume it's a hue bridge - if device.get_friendly_name().startswith("Philips hue"): - discovered = True + f_name = device.get_friendly_name() + if f_name: + if f_name.startswith("Philips hue"): + discovered = True # If not we try to do a request against the api and see if we get an answer we can understand else: discovered = is_bridge(device.host)