mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Only strip from the bluetooth name if it isn't None (#17719)
This prevents the following traceback that will otherwise occur. Traceback (most recent call last): File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/bluetooth_le_tracker.py", line 107, in update_ble see_device(address, devs[address], new_device=True) File "/usr/local/lib/python3.6/site-packages/homeassistant/components/device_tracker/bluetooth_le_tracker.py", line 47, in see_device see(mac=BLE_PREFIX + address, host_name=name.strip("\x00"), AttributeError: 'NoneType' object has no attribute 'strip'
This commit is contained in:
parent
d5a5695411
commit
7def587c93
@ -44,7 +44,10 @@ def setup_scanner(hass, config, see, discovery_info=None):
|
|||||||
new_devices[address] = 1
|
new_devices[address] = 1
|
||||||
return
|
return
|
||||||
|
|
||||||
see(mac=BLE_PREFIX + address, host_name=name.strip("\x00"),
|
if name is not None:
|
||||||
|
name = name.strip("\x00")
|
||||||
|
|
||||||
|
see(mac=BLE_PREFIX + address, host_name=name,
|
||||||
source_type=SOURCE_TYPE_BLUETOOTH_LE)
|
source_type=SOURCE_TYPE_BLUETOOTH_LE)
|
||||||
|
|
||||||
def discover_ble_devices():
|
def discover_ble_devices():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user