The newest model of the VeSync / Etekcity outlets (https://www.amazon.com/dp/B07J5B2ZR8) don’t work with Home Assistant. The old ones work fine, but the latest release does not even show up. Some changes to the API may be needed? Would be nice to get this fixed!
note: I found the API to list the new devices in the source code for the android APK, but I cannot interact with them. This works to list the devices:
curl -d '{"accountID":"xxxxx", "token":"xxxxxxxxxx"}' -H "Content-Type: application/json" -X POST https://smartapi.vesync.com:443/platform/v1/app/devices/
Thanks for figuring this out!
I’m not using it for home assistant, i’m using it to import power usage into telegraf/influxDB/Grafana and it works great! Updated my script and the new outlet data showed right up!
Finally finished integrating the changes. Created a new library in hopes HA will integrate it automatically without having to use a custom component.
I’ve uploaded the package to pypi so it can be installed using pip but I haven’t made a pull request to change the HA config in case there are any more changes. I’m new at this so is there anything else I need to do to get it permanently incorporated into home assistant give me a shout.
I’m guessing they changed the API around to support more data collection and streamline the programming for future devices. The old api still works but doesn’t support the newer devices. I made the appropriate corrections for the primary functions, including daily energy usage but I haven’t yet fixed the historical data for yearly, monthly or weekly power usage.
In order to use this with home assistant now you can use the method laid out by @mahodder in his post Etekcity and VeSync :
1st- Move “vesync.py” file from the “src” directory to the “~config/custom_components” folder in your home assistant configuration directory
2nd- Then move the sample home assistant component file (HACustom_Components/switch/vesync.py) to the “~config/custom_components/switch” folder in your home assistant configuration directory
Hopefully this helps someone. I will post the packets I logged in the docs folder of the repository tomorrow in case anyone has any suggestions or changes. Thanks to Mark Perdue for his hard work to create the basis of the code.
2019-03-05 17:31:43 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.vesync.switch. Make sure all dependencies are installed
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/homeassistant/loader.py", line 147, in _load_file
module = importlib.import_module(path)
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 962, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'custom_components.vesync.switch'; 'custom_components.vesync' is not a package
2019-03-05 17:31:43 INFO (MainThread) [homeassistant.loader] Loaded switch.vesync from custom_components.switch.vesync
Do me a favor, include the latest custom component on my github without changing any lines and remove both vesync.py files. Include the the latest file below in
I am running on a virtual environment, and I realized that it automatically installs the pip package in the requirements line. I’m not sure if it does the same on hassio but I don’t see why it wouldn’t.
I apologize for having to change the repo name but I made a stupid error when naming the package by including a “-”. The files on there should work now. The pull request with HA has been approved already so it should be included in the next distribution.
2019-03-05 20:16:40 INFO (MainThread) [homeassistant.components.switch] Setting up switch.vesync
2019-03-05 20:16:42 INFO (SyncWorker_14) [homeassistant.components.switch.vesync] No VeSync devices found
As you can see, Home Assistant can´t see any device, quite strange because in the Vesync App appear two devices.
Do I need something special in my switch.yaml?. Actually I have this:
Oops, me being a selfish American I forgot about the rest of the world .
I am going to try to adjust the library to include the EU suffix, but I have no way of testing the API responses from here. Are you running the vesync app on an android device or ios?
Sorry for the delay, I updated everything so all that you need to do for full VeSync support is to add this custom component to ~/config/custom_components/vesync/switch.py. No other files need to be moved, it will automatically install dependencies until HA incorporates my PR.
I’m having issues getting my plugs recognized. When Home Assistant starts up, it looks like it’s loading VeSync and logging in with my VeSync credentials correctly based on the logs.
I get the “No VeSync devices found” log line near the end of setup. I don’t know if the API call for the devices is failing or if something else is going on.
Just got a couple of these on amazon and discovered that the pyvesync_v2 library doesn’t ‘support’ them at the moment. Submitting a patch now to support ‘ESW01-USA’ (Not sure why it wasn’t added with ESW01-EU in the first place)
Right now the library that is backing this integration (pyvesync_v2.py) supports a very short list of devices. It’s likely that your device needs to be added to the list of supported devices. If your devices isn’t one of
it probably won’t work until this library is updated. I’ve just submitted a patch to add ESW01-USA to the list of supported outlets as that’s what i’ve got. Another problem is that the model printed on the switch itself may not necessarily be the model reported by the API. I have two switches that are labeled as model ESW01-USA, but the API reports them as ESW03-USA.
EDIT: I’ve just come to the realization that the python module that is backing this component is not being maintained and may not see any further updates.
EDIT: Got it! At the bottom of this page there are instructions for installing and using this more recently updated library. It works with my ESW01-USA outlets, I bet yours will show up too