Etekcity and VeSync

Yeah I can control them via the vesync app just fine. Did I do it correctly by creating a custom_components folder then a switch folder in the config folder where my yaml files are?

Config/custom_components/switch/vesync.py

Also. I just opened a new python file and pasted the code from the link above and corrected the devices part. Did I do that right as well? I’m new to the whole custom components thing.

Do you have a separate switch file that it called up in the config.yaml? I only have two garage door wemos d1s w/ relays set up as covers right now so I haven’t broken those out that way.

Thanks!

Yes, you have the right directory location, same as mine.
I also edited the python file and new to it as well :slight_smile:
I just replaced that one line, should be line 47 and it should read:

for switch in devices:

No, my switch.yaml file is the only reference to the Etekcity switches.
So when you check your states (< >) on the menu, you can’t see any new switches there?

One thing I also did is I have in my config a device tracker (nmap and also one for my router) which scans my network and then outputs all the detected devices to known_devices.yaml which is where I went in and then saw the Etekcity switches, I then went to my customize.yaml and created friendly names and special icons for each plug.
Can you see the smart plugs on your router wireless client list?

My configuration.yaml file for the network device tracker is:

# Configure presence tracking
device_tracker:
  - platform: nmap_tracker
    hosts: 192.168.1.1-255
    exclude:
      - 192.168.1.7
      - 192.168.0.254
    home_interval: 10
    interval_seconds: 180
    consider_home: 300
    scan_options: " --privileged -sP "
# Configure Asus router
  - platform: asuswrt
    host: 192.168.1.1
    username: myusername
    password: mypassword
    interval_seconds: 30
    consider_home: 300
    track_new_devices: yes
# Configure Owntracks
  - platform: owntracks

Then in my known_devices.yaml file the smart plugs show as:

2c3ae84048ff:
  hide_if_away: false
  icon: mdi:power-socket-us
  mac: 2C:3A:E8:40:48:FF
  name: Elekticity Smart Plug 1
  picture:
  track: true
  vendor: Espressif Inc.

600194633a72:
  hide_if_away: false
  icon: mdi:power-socket-us
  mac: 60:01:94:63:3A:72
  name: Elekticity Smart Plug 2
  picture:
  track: true
  vendor: Espressif Inc.

I hope this helps, I’m new to HA so just sharing what I did and this thread, especially @niget2002 was really helpful as you can see!

That’s great! I’ll sit down when I get a little bit of time and make sure I follow what you’ve got and I’ll report back. Thanks for the feedback!

1 Like

With this configuration, does it still require access to their cloud provider? I was hoping to remove the default gateway from these devices to avoid outgoing traffic to shady websites.

Also, are you guys running on hass or hassbian?

You still have to go through Etekcity’s servers, so this isn’t a localized option. I don’t know about everyone else, but I’m running Hassbian on an RPI3 and this works great. The only problem I’m having (which I’m sure is a user error) is that while I can get the switches to work in HA in general, I can’t get them to play nice with my floorplan.

I’m running hass.io on a RPI3.

It does still require internet access. It’s just making API calls to their servers.

I purchased one of these and configured the component - and I get the on/off status- but not electricity consumption. Does anyone have this working? I’ve tested on 0.69 and the release candidate for 0.70

No. No one’s written an api for that part of the hardware yet.

So is the component documentation wrong?

Not sure what you’re referring to. There’s nothing in the The python file I linked that has anything to do with the energy usage stats.

I’m talking about https://www.home-assistant.io/components/switch.vesync/

That link was broken when I first wrote this topic. I’m not sure how accurate it is.

Seems I was just not patient enough. Electricity usage updated after some time. Need to test how close to realtime it is, but it definitely works

Interesting. If it’s built in to the code now, then it may not be necessary to go through all the other steps I did.

Quick test.

I remove the vesync stuff from the custom_component directory and restarted hass.io after upgrading to the latest version.

All the switches still showed up and worked after the restart… so, yeah. It doesn’t look like it’s necessary to load your own code anymore.

This thread is a few months old. Just got some of these switches. They work great. I am not seeing the 2 power attributes listed on the component page at https://www.home-assistant.io/components/switch.vesync/

Someone above did mention that it worked, but had to wait a little bit to show up. How long? And where do you see these attributes in ha?

Did you ever get an answer or figure this out? I just got one a little bit ago, simple to add it to HA and can control it but I am not seeing the power attributes yet.

yes, the power attributes did should up the next day I checked. Very strange.

oh thankds. longer than i thought