Browse Source

Smol bug fix for when UPnP device has no friendly name

master
Micke Nordin 4 months ago
parent
commit
c9a6f256ae
Signed by: Micke Nordin <hej@mic.ke> GPG Key ID: 014B273D614BE877
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      tinge/__init__.py

+ 4
- 3
tinge/__init__.py View File

@@ -4,7 +4,6 @@ import http
4 4
 import os
5 5
 from typing import Union
6 6
 
7
-import simplejson
8 7
 import toml
9 8
 from upnpy import UPnP
10 9
 
@@ -56,8 +55,10 @@ class Tinge:
56 55
             if (device.host not in self.m_discovered) and (device.host not in seen_ips):
57 56
                 seen_ips.append(device.host)
58 57
                 # Let's check if the device has the default name, if so we assume it's a hue bridge
59
-                if device.get_friendly_name().startswith("Philips hue"):
60
-                    discovered = True
58
+                f_name = device.get_friendly_name()
59
+                if f_name:
60
+                    if f_name.startswith("Philips hue"):
61
+                        discovered = True
61 62
                 # If not we try to do a request against the api and see if we get an answer we can understand
62 63
                 else:
63 64
                     discovered = is_bridge(device.host)

Loading…
Cancel
Save