core: Error setting up platform legacy bt_smarthub

The problem

Was working around a couple of weeks ago but then just stopped working sadly at the time I thought it was a router issue as I had just been sent a new one. A bit of digging has thrown up this in the debug log I run Home assistant on a windows machine with Hyper-V (you have no idea how much im looking forward to my Amber) Happy to provide any info needed but you may have to tell me how to get it.

What version of Home Assistant Core has the issue?

core-2021.11.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Device Tracker (BT-Smart Hub 2)

Link to integration documentation on our website

https://www.home-assistant.io/integrations/bt_smarthub/

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Error setting up platform legacy bt_smarthub
11:11:19 am – (ERROR) Device Tracker

Logger: homeassistant.components.device_tracker
Source: components/bt_smarthub/device_tracker.py:97
Integration: Device Tracker (documentation, issues)
First occurred: 11:11:19 am (1 occurrences)
Last logged: 11:11:19 am

Error setting up platform legacy bt_smarthub
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py", line 245, in async_setup_legacy
    scanner = await hass.async_add_executor_job(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/bt_smarthub/device_tracker.py", line 35, in get_scanner
    scanner = BTSmartHubScanner(smarthub_client)
  File "/usr/src/homeassistant/homeassistant/components/bt_smarthub/device_tracker.py", line 62, in __init__
    data = self.get_bt_smarthub_data()
  File "/usr/src/homeassistant/homeassistant/components/bt_smarthub/device_tracker.py", line 97, in get_bt_smarthub_data
    data = self.smarthub.get_devicelist(only_active_devices=True)
  File "/usr/local/lib/python3.9/site-packages/btsmarthub_devicelist/__init__.py", line 61, in get_devicelist
    devicelist = self.get_devicelist_smarthub_2(only_active_devices=only_active_devices)
  File "/usr/local/lib/python3.9/site-packages/btsmarthub_devicelist/__init__.py", line 286, in get_devicelist_smarthub_2
    devices = json.loads(cleaned_jscript_array)
  File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.9/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 12663 (char 12662)

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (3 by maintainers)

Most upvoted comments

The issue seems to be in the library which handles the communication with the device, a referer header is required. I have a working example over at https://github.com/typhoon2099/btsmarthub_devicelist but I need to tidy it up and then figure out how to either get a fixed packed deployed by the owner (the repo has been quiet for a couple of years now), or publish myself and get Home Assistant to use that instead.

I’m getting the same error too now.

Error setting up platform legacy bt_smarthub Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py”, line 233, in async_setup_legacy scanner = await hass.async_add_executor_job( File “/usr/local/lib/python3.8/concurrent/futures/thread.py”, line 57, in run result = self.fn(*self.args, **self.kwargs) File “/usr/src/homeassistant/homeassistant/components/bt_smarthub/device_tracker.py”, line 35, in get_scanner scanner = BTSmartHubScanner(smarthub_client) File “/usr/src/homeassistant/homeassistant/components/bt_smarthub/device_tracker.py”, line 62, in init data = self.get_bt_smarthub_data() File “/usr/src/homeassistant/homeassistant/components/bt_smarthub/device_tracker.py”, line 97, in get_bt_smarthub_data data = self.smarthub.get_devicelist(only_active_devices=True) File “/usr/local/lib/python3.8/site-packages/btsmarthub_devicelist/init.py”, line 61, in get_devicelist devicelist = self.get_devicelist_smarthub_2(only_active_devices=only_active_devices) File “/usr/local/lib/python3.8/site-packages/btsmarthub_devicelist/init.py”, line 286, in get_devicelist_smarthub_2 devices = json.loads(cleaned_jscript_array) File “/usr/local/lib/python3.8/json/init.py”, line 357, in loads return _default_decoder.decode(s) File “/usr/local/lib/python3.8/json/decoder.py”, line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File “/usr/local/lib/python3.8/json/decoder.py”, line 353, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Expecting ‘,’ delimiter: line 1 column 5126 (char 5125)

I’m also seeing the exact same errors in my system - i had been using this integration successfully for a few weeks and now this…

2021-11-17 17:19:40 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform legacy bt_smarthub Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/components/device_tracker/legacy.py”, line 245, in async_setup_legacy scanner = await hass.async_add_executor_job( File “/usr/local/lib/python3.9/concurrent/futures/thread.py”, line 52, in run result = self.fn(*self.args, **self.kwargs) File “/usr/src/homeassistant/homeassistant/components/bt_smarthub/device_tracker.py”, line 35, in get_scanner scanner = BTSmartHubScanner(smarthub_client) File “/usr/src/homeassistant/homeassistant/components/bt_smarthub/device_tracker.py”, line 62, in init data = self.get_bt_smarthub_data() File “/usr/src/homeassistant/homeassistant/components/bt_smarthub/device_tracker.py”, line 97, in get_bt_smarthub_data data = self.smarthub.get_devicelist(only_active_devices=True) File “/usr/local/lib/python3.9/site-packages/btsmarthub_devicelist/init.py”, line 61, in get_devicelist devicelist = self.get_devicelist_smarthub_2(only_active_devices=only_active_devices) File “/usr/local/lib/python3.9/site-packages/btsmarthub_devicelist/init.py”, line 286, in get_devicelist_smarthub_2 devices = json.loads(cleaned_jscript_array) File “/usr/local/lib/python3.9/json/init.py”, line 346, in loads return _default_decoder.decode(s) File “/usr/local/lib/python3.9/json/decoder.py”, line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File “/usr/local/lib/python3.9/json/decoder.py”, line 353, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Expecting ‘,’ delimiter: line 1 column 10312 (char 10311)

Hey there @jxwolstenholme, mind taking a look at this issue as it has been labeled with an integration (bt_smarthub) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)