Hi All – I’ve been working with these EcoPlug/Wion units from Home Depot for a while now. Wanted to post my results to get more eyes on them and share my ‘methodology’ …and to see if i’m doing anything unintelligent.
http://www.homedepot.com/p/15-Amp-Wi-Fi-Adapter-Single-Outlet-White-CT-065W/206948864
They’re both 8266 based with identical internal control boards, and they run a goofy firmware that allows control only from phone app (and calls out to a server in china). I flashed mine to ESPEasy and have been trying to get them to work properly via HA and via the hardware button on the module itself.
relay: gpio15
button: gpio13
Relay is kept in sync by using a small client-side rule. This rule lets me use different esp8266 modules (electrodragon, sonoff, ecoplug, etc) that all have different GPIO bindings for buttons and actual relay controls without having to change the rules or handling of the module in home-assistant at all. Just setup the devices themselves, give them conventional names, and irrespective of the hardware module/platform, i can use the same rule and home-assistant config for all.
Here’s the config for the buttons, gpio’s and names.
Here is the config page for the button
Here is the config page for the relay itself
Here are the ESPEasy rules that i have configured:
on button#buttonstate do
if [relay#relaystate]=1
gpio,15,0
publish /%sysname%/relay/relaystate,0
else
gpio,15,1
publish /%sysname%/relay/relaystate,1
endif
endon
I’m using HA on a raspi3 using the hassbian installer. I have enabled the mosquitto MQTT broker. Here is my switch config:
- platform: mqtt
name: “Breezeway Light”
state_topic: “/bzwy/relay/relaystate”
command_topic: “/bzwy/gpio/15”
payload_on: “1”
payload_off: “0”
qos: 1
retain: true
Essentially, to make the button work properly, I’m using a local rule on the ESP to check the state of the relay and issue a GPIO command based on the current state of the relay. The state of the button is basically ignored. For a while I was updating it and tracking it but then i realized that it seems to have no purpose in this setup.
thanks for your time.