Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] DecodeError on lge_devices_setup #122

Closed
pedrofalmeida opened this issue Feb 7, 2021 · 4 comments
Closed

[BUG] DecodeError on lge_devices_setup #122

pedrofalmeida opened this issue Feb 7, 2021 · 4 comments

Comments

@pedrofalmeida
Copy link

pedrofalmeida commented Feb 7, 2021

Describe the bug
I'm using homeassistant in a venv environment, after upgrade to core-2021.2.1, the component is not loaded at startup with the error:

2021-02-07 08:15:50 INFO (SyncWorker_3) [custom_components.smartthinq_sensors.wideq.core_v2] Loading model info for Washer. Model: WTWN3, Url: https://eic.lgthinq.com:46030/api/webContents/modelJSON?modelName=WTWN3&countryCode=WW&contentsId=JS0427002048497951&authKey=thinq
2021-02-07 08:15:51 WARNING (MainThread) [custom_components.smartthinq_sensors] Connection not available. SmartThinQ platform not ready
Traceback (most recent call last):
  File "/home/<user>/.homeassistant/custom_components/smartthinq_sensors/__init__.py", line 170, in async_setup_entry
    lge_devices = await lge_devices_setup(hass, client)
  File "/home/<user>/.homeassistant/custom_components/smartthinq_sensors/__init__.py", line 501, in lge_devices_setup
    result = await hass.async_add_executor_job(dev.init_device)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/<user>/.homeassistant/custom_components/smartthinq_sensors/__init__.py", line 304, in init_device
    if self._device.init_device_info():
  File "/home/<user>/.homeassistant/custom_components/smartthinq_sensors/wideq/device.py", line 768, in init_device_info
    self._model_lang_pack = self._client.model_url_info(
  File "/home/<user>/.homeassistant/custom_components/smartthinq_sensors/wideq/core_v2.py", line 786, in model_url_info
    self._model_url_info[url] = self._load_json_info(url)
  File "/home/<user>/.homeassistant/custom_components/smartthinq_sensors/wideq/core_v2.py", line 759, in _load_json_info
    return requests.get(info_url, timeout=DEFAULT_TIMEOUT).json()
  File "/home/<user>/homeassistant/lib/python3.8/site-packages/requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.8/json/__init__.py", line 337, in loads
    raise JSONDecodeError("Unexpected UTF-8 BOM (decode using utf-8-sig)",
json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)

Expected behavior
I expect to have the component loaded correctly.

Additional context
I guess this is the file it try to read, but it's in UTF-8-BOM encoding.
MP_WM_WTWN3_LANG_EN-WW_VER_5.zip

@ollo69
Copy link
Owner

ollo69 commented Feb 7, 2021

It was working before upgrading HA?
Can I have some more detail on your HA installation (core, HASSIO, etc...)?

@pedrofalmeida
Copy link
Author

I'm using the HA core installed using venv (https://www.home-assistant.io/docs/installation/virtualenv/).
I reproduce the problem by installing in a clean RPi with python3.8.7, when I installed the version 2021.1.4 of HA it works like a charm, but when I upgraded it to the last HA version 2021.2.1 it stop working, give me the error of decoder.

@ollo69
Copy link
Owner

ollo69 commented Feb 7, 2021

It is strange, doesn't seems that your file contain BOM prefix.
May be is an issue in request, don't know if last HA version update it.
I released a new beta beta version trying to fix this issue (v0.5.15b1), can you test?

@pedrofalmeida
Copy link
Author

I install this version and it works fine! Thank you so much!

ollo69 added a commit that referenced this issue Feb 7, 2021
- Fix errorr loading json info (issue #122)
- Merge pull request #120 from KTibow/patch-3
@ollo69 ollo69 closed this as completed Feb 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants