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

VeSync devices stopped working after the update to 2021.4 #48878

Closed
Frankenberrypi opened this issue Apr 8, 2021 · 18 comments
Closed

VeSync devices stopped working after the update to 2021.4 #48878

Frankenberrypi opened this issue Apr 8, 2021 · 18 comments

Comments

@Frankenberrypi
Copy link

Frankenberrypi commented Apr 8, 2021

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)
@probot-home-assistant
Copy link

vesync documentation
vesync source
(message by IssueLinks)

@probot-home-assistant
Copy link

Hey there @markperdue, @webdjoe, @TheGardenMonkey, mind taking a look at this issue as its been labeled with an integration (vesync) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@alexanv1
Copy link
Contributor

Seeing the same issue but it's worth noting that the devices (at least smart plugs) do actually work. HA reports an error but the device does turn on/off as expected snd HA actually updates the status successfully on the next update interval.

Seems that the response format for on/off calls has changed so, possibly, not related to HA and will need to be fixed in PyVesync library that HA uses.

@rgreve
Copy link

rgreve commented Apr 15, 2021

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.

@715Steve
Copy link

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.

@ThirteenTX
Copy link

The switches do still work. The issue is if you have one of those switches in a script, the script stops at the step that has the veysnc errors. I have adjusted my scripts to now turn off switches that include vesync last as a stop gap measure which seems to work but still has the error.

@alexanv1
Copy link
Contributor

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.

@webdjoe
Copy link
Contributor

webdjoe commented Apr 20, 2021

I'm having trouble replicating this, which switch are you using and what is the firmware version?

I have the ESWL01 and ESWD16 v1.0.39

@ThirteenTX
Copy link

ESW01-USA firmware version: 2.125

@715Steve
Copy link

715Steve commented Apr 20, 2021 via email

@JeffSteinbok
Copy link

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.

New to HA - Is it possible to consume this without waiting for it to be officially included?

@ThirteenTX
Copy link

Is there any other testing I can do to help with this issue? I can try and get logs etc.

@webdjoe
Copy link
Contributor

webdjoe commented Apr 27, 2021

This has been fixed in https://github.com/webdjoe/pyvesync/releases/tag/1.4.0, just released the package. Let me know if there are still any issues.

@ThirteenTX
Copy link

ThirteenTX commented May 5, 2021

I guess it will be a while till this is integrated into Home Assistant Core or are they just slow to update the manifest.json? Still showing the previous version it appears.
https://github.com/home-assistant/core/blob/dev/homeassistant/components/vesync/manifest.json
Edit: Confirmed this is still broken in HA core.

@JeffSteinbok
Copy link

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...

@JeffSteinbok
Copy link

@webdjoe - How can I help validate the package? Can I install it on my HA docker image somehow? I tested it by manually making the same code change in the commit.

@ThirteenTX
Copy link

ThirteenTX commented May 12, 2021

@JeffSteinbok, it won't be merge into home assistant until one of the code owners (@markperdue, @webdjoe, @TheGardenMonkey) merge a pull request with HA Core. Since the added a new device along with the fix, it may be a while till they merge it. I have started looking for other plugs in the mean time cause this broke a lot of my automations and scripts and I am not sure when it will be resolved if ever.

@bdraco
Copy link
Member

bdraco commented May 13, 2021

Fixed via #50216

@bdraco bdraco closed this as completed May 13, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jun 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants