core: VeSync devices stopped working after the update to 2021.4

The problem

When I attempt to switch a device on or off, I get this error: Failed to call service switch/turn_on. Expecting value: line 1 column 1 (char 0)

What is version of Home Assistant Core has the issue?

2021.4.0

What was the last working version of Home Assistant Core?

2021.3.4

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

VeSync

Link to integration documentation on our website

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

Example YAML snippet

No response

Anything in the logs that might be useful for us?

simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2021-04-08 08:54:07 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140197371992576] Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 143, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1515, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 206, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 649, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 692, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 686, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 717, in async_turn_on
    await self.hass.async_add_executor_job(ft.partial(self.turn_on, **kwargs))
  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/vesync/switch.py", line 63, in turn_on
    self.device.turn_on()
  File "/usr/local/lib/python3.8/site-packages/pyvesync/vesyncoutlet.py", line 224, in turn_on
    _, status_code = Helpers.call_api(
  File "/usr/local/lib/python3.8/site-packages/pyvesync/helpers.py", line 180, in call_api
    response = r.json()
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.8/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.8/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2021-04-08 11:15:19 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2021-04-08 12:10:16 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140197368426896] Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 143, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1515, in _execute_service
    await handler.job.target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 206, in handle_service
    await self.hass.helpers.service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 649, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 692, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 686, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 725, in async_turn_off
    await self.hass.async_add_executor_job(ft.partial(self.turn_off, **kwargs))
  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/vesync/common.py", line 70, in turn_off
    self.device.turn_off()
  File "/usr/local/lib/python3.8/site-packages/pyvesync/vesyncoutlet.py", line 239, in turn_off
    _, status_code = Helpers.call_api(
  File "/usr/local/lib/python3.8/site-packages/pyvesync/helpers.py", line 180, in call_api
    response = r.json()
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.8/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.8/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 18 (5 by maintainers)

Most upvoted comments

I’ve submitted a PR to PyVesync to fix this. Once it’s merged and an updated library is published, VeSync integration in HA will need to be updated to use it.

This may not be the right way to do it, but I logged onto my HA box, went into the docker container and just modified the Python file as it was done in the PR. I’m sure it will get overwritten, but for now…

Seeing the same issue. Device is a smart plug and still works but logs the identical error:

Failed to call service switch/turn_on. Expecting value: line 1 column 1 (char 0)

Started with last update.

Same issue here. Switches actually do work, just reports back something malformed to HA. Extra Bothersome with a Nabu Casa integration is that Google Assistant will toggle the switch no problem and then loudly announce that “Sorry something went wrong” every time you try to engage a device connected to a vesync smart switch. For instance a light in your baby’s room.