core: Vesync integration errors

The problem

It appears that an issue with the pyvesync library could be causing the integration to fail to properly configure after a reboot. I’ve also opened up https://github.com/webdjoe/pyvesync/issues/130 on the lib repo for tracking the issue there as well.

What version of Home Assistant Core has the issue?

2022.4.5

What was the last working version of Home Assistant Core?

2022.4.2

What type of installation are you running?

Home Assistant OS

Integration causing the issue

vesync

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 335, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/vesync/__init__.py", line 46, in async_setup_entry
    device_dict = await async_process_devices(hass, manager)
  File "/usr/src/homeassistant/homeassistant/components/vesync/common.py", line 19, in async_process_devices
    await hass.async_add_executor_job(manager.update)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/pyvesync/vesync.py", line 296, in update
    device.update()
  File "/usr/local/lib/python3.9/site-packages/pyvesync/vesyncoutlet.py", line 69, in update
    self.get_details()
  File "/usr/local/lib/python3.9/site-packages/pyvesync/vesyncoutlet.py", line 175, in get_details
    power = round(float(Helpers.calculate_hex(power)), 2)
  File "/usr/local/lib/python3.9/site-packages/pyvesync/helpers.py", line 139, in calculate_hex
    converted_hex = (int(hex_conv[0], 16) + int(hex_conv[1], 16)) / 8192
IndexError: list index out of range


### Additional information

_No response_

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 8
  • Comments: 31 (9 by maintainers)

Most upvoted comments

I have the same older generation plug with the same firmware and it is all working for me in my fresh local dev instance of Home Assistant. I’m guessing despite the manifest change the proper pyvesync files aren’t getting pulled in when trying to override the component via custom_components

If anyone wants to fix the integration right now, before the next version of Home Assistant is released, the fix referenced above (bumping the python lib to 2.0.2) works, and it’s possible to override the built in HA integration.

  1. Clone the following repo and check out the vesync2.0.2 branch
  2. If you’re using the rpi instance, install the Samba addon on your Home Assistant instance so you can access the /config/ directory. If it’s installed another way, or in a container, get access to the filesystem somehow - as long as you can access /config/
  3. Create a directory named custom_components inside the /config/ folder
  4. Copy all plugin files from the repo above (homeassistant/components/vesync/*) to the config directory (config/custom_components/vesync/*)
  5. In manifest.json (homeassistant/custom_components/vesync/manifest.json, add a version attribute at the end of the file. It should look something like this. (the version number doesn’t matter. I used SemVer:
     "loggers": ["pyvesync"],
     "version": 1.2.3
    }
    
  6. Restart HA Core

Note: I would recommend deleting this override after upgrading, and restarting. If you forget, it will be stuck on this version indefinitely even if there are future upstream updates.

Thanks - Sorry for missing that long debug entry. I will wait for the debug version.

This will be in the next beta release (27-APR)

I can confirm above. Cloned the 2.0.2 to HA and restarted, Etekcity model ESW01-USA with firmware 2.125 still fails with error seen by [jcefoli](https://github.com/jcefoli].

Error setting up entry XXXXXXXX for vesync Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 335, in async_setup result = await component.async_setup_entry(hass, self) File “/usr/src/homeassistant/homeassistant/components/vesync/init.py”, line 46, in async_setup_entry device_dict = await async_process_devices(hass, manager) File “/usr/src/homeassistant/homeassistant/components/vesync/common.py”, line 19, in async_process_devices await hass.async_add_executor_job(manager.update) File “/usr/local/lib/python3.9/concurrent/futures/thread.py”, line 58, in run result = self.fn(*self.args, **self.kwargs) File “/usr/local/lib/python3.9/site-packages/pyvesync/vesync.py”, line 296, in update device.update() File “/usr/local/lib/python3.9/site-packages/pyvesync/vesyncoutlet.py”, line 69, in update self.get_details() File “/usr/local/lib/python3.9/site-packages/pyvesync/vesyncoutlet.py”, line 175, in get_details power = round(float(Helpers.calculate_hex(power)), 2) File “/usr/local/lib/python3.9/site-packages/pyvesync/helpers.py”, line 139, in calculate_hex converted_hex = (int(hex_conv[0], 16) + int(hex_conv[1], 16)) / 8192 IndexError: list index out of range