Etekcity and VeSync

My wife gave me some of the Etekcity WiFi outlets for Christmas.

I’m working on getting it working with HomeAssistant.

During my searching, I came across the following codebase:

http://www.pythonexample.com/snippet/vesyncpy_tylergets_python

I’m still working on getting it to work. What I find curious is the https link in the code goes to a 404

Does this happen when code is no longer maintained?

I managed to get this working this morning. the vesync.py file had a typo:

– for switch in switch_data.items():
++ for switch in devices:
switches.append(VesyncSwitch(switch,api))

@niget2002 Can you post the config you used to get them working?

The python code I used is in the link in the first post. The code change I made is in my last post as a pseudo-diff. Put the python file /config/custom_components/switch/

switch:
– platform: vesync
username: <username
password: <password

Understand that this code is just making calls to the VeSync servers, so it’s not controlling the switches directly. It seems to be working well for me so far.

Just to be clear, i have to delete “for switch in switch_data.items():” and add “for switch in devices:”?

Yes. Sorry.

All you’re really doing is replacing switch_data.items() with the word devices.

Shoot, doesnt look like it fetches the energy usage stats. Thats one of the key reasons i bought them.

So I have tried to get this to work. I installed vesync 1.0.1 and added the vesync.py file to my custom_component\switch and modified the device: part. added in
switch:

  • platform: vesync
    username: !secret dfd
    password: !secret dff
    it keeps saying
    ERROR (MainThread) [homeassistant.loader] Unable to find component switch.vesync

I have also tried to get it to work.

  • I edited the vesync.py file and then uploaded it to /config/custom_components/switch
  • I then added the following to my switch component:

Configure VeSync switches

  • platform: vesync
    username: myemail
    password: mypassword

Shouldn’t I also have to add "host: theVesyncSwitchIP in there?

This is the error I get.
ERROR:
2018-02-10 15:00:43 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform vesync Traceback (most recent call last): File “/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py”, line 189, in _async_setup_platform SLOW_SETUP_MAX_WAIT, loop=self.hass.loop) File “/usr/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for return fut.result() File “/usr/lib/python3.6/asyncio/futures.py”, line 245, in result raise self._exception File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run result = self.fn(*self.args, **self.kwargs) File “/config/custom_components/switch/vesync.py”, line 30, in setup_platform from vesync.api import VesyncApi ModuleNotFoundError: No module named ‘vesync’

I’ll double check. There may be a missing library in my instructions.

Do ya’ll have a vesync folder in your

deps/lib/python3.6/site packages folder?

I also noticed that I have a vesync.py file in my components folder. I’ll need to verify where to put the python file.

Also. Please verify you’ve configured the outlets through the vesync app and that they work through it.

My user error and I apologize.

Yes, I can verify I have a vesync folder there (also in that directory is /vesync-1.0.1-py3.6.egg-info folder).

Yes I verified with my VeSync Andriod app but the password I entered in the YAML entry was incorrect.

I can confirm everything is working and I did add a “host: vesyncip” line but looks like I didn’t need to as it found both of my Etekcity plugs.

Thanks for taking the time to help me out!

Thank you for letting me know. Enjoy.

Maybe one day we can retrieve the electricty consumption data from the these switches too but I’m sure that’s complex! :smile:

Probably just an api call of some type. I’ll try to take a look at some point.

Ok guys so I’m a little newer to this than you guys. So i added a custom_components folder to within my hassio config folder and added the vesync.py file with the devices change. I added the config.yaml code as well. Am I doing this right? Also i can’t get my config to validate, I"m getting a mapping value are not allowed here error. Heres my yaml code https://www.hastebin.com/tohepijewo.go THanks!

@jksigmon Could you re-paste your yaml code link? I can’t seem to bring it up.

Its basically this.

switch:
– platform: vesync
username: myemail
password: password

I put the python file in config/custom_components/switch.

Still no luck

Can you access the VeSync app on your phone and control/see them?

I have exactly the same entry as you in my switch.yaml file. It detects my 2 switches and I don’t need to add in the ip address or anything. It wasn’t working for me until I verified the password as I had that wrong, thus I went back to the VeSync app to confirm it was working.

If you have that 1 line edit to the vesync.py and it looks like it is in the correct directory…hmm… not sure, perhaps a hard reboot and then check your logs.