skycryer
(Skycryer)
April 2, 2020, 8:35am
1
Hi, I am looking for cheap WIFI Wall Plugs that can be used with ESPHOME, can measure Power and are available in EU (Best in Germany). I Have Order 2 different Tasmota usable Plugs but both are not really run like I want. So I can use them over ESPHOME but I can not get them working so I can switch them on/off by pressing the button on the device. I tried the automations script, changed the GPIO settings, but without luck. So maybe the config are wrong or it is not fully supported.
So maybe someone here an recommend a Wall Plug that runs with ESPHOME, can measure power and can be switched on/off by pressing the button on the device.
The latest one I tried was this one
What ESPHome config have you tried?
If you post that someone might be able to point you in the correct direction.
skycryer
(Skycryer)
April 2, 2020, 9:22am
4
Shelly Plug uses cloud or not? I would prefer not to use something that needs cloud access.
skycryer
(Skycryer)
April 2, 2020, 9:24am
5
substitutions:
plug_name: energy_switch_4
# Higher value gives lower watt readout
current_res: "0.00221"
# Lower value gives lower voltage readout
voltage_div: "955"
esphome:
name: energy_switch_05
platform: ESP8266
board: esp01_1m
wifi:
ssid: "mywifi"
password: "wifi_access_code"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Energy Switch 05"
password: "r41jHxjznkKh"
web_server:
port: 80
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
time:
- platform: homeassistant
id: homeassistant_time
switch:
- platform: gpio
name: "${plug_name}_Relay"
pin: 14
id: relay
restore_mode: ALWAYS_ON
- platform: gpio
name: "${plug_name}_LED"
pin: 13
inverted: True
restore_mode: ALWAYS_OFF
id: blue_led
binary_sensor:
- platform: gpio
device_class: plug
pin:
number: 0
inverted: True
name: "${plug_name}_button"
on_press:
then:
- switch.toggle: relay
- if:
condition:
switch.is_on: relay
then:
switch.turn_on: blue_led
else:
switch.turn_off: blue_led
sensor:
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: True
cf_pin: 4
cf1_pin: 5
current_resistor: ${current_res}
voltage_divider: ${voltage_div}
current:
name: "${plug_name}_Amperage"
unit_of_measurement: A
voltage:
name: "${plug_name}_Voltage"
unit_of_measurement: V
power:
name: "${plug_name}_Wattage"
unit_of_measurement: W
id: "${plug_name}_Wattage"
change_mode_every: 8
update_interval: 10s
- platform: total_daily_energy
name: "${plug_name}_Total Daily Energy"
power_id: "${plug_name}_Wattage"
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
unit_of_measurement: kWh
# Extra sensor to keep track of plug uptime
- platform: uptime
name: ${plug_name}_Uptime Sensor
francisp
(Francis)
April 2, 2020, 9:24am
6
With stock firmware you can choose to use cloud or local mqtt
It has an esp, so you can flash tasmota, or as you asked, esphome.
1 Like
It looks like you have your “power button” and LED the wrong way round and also according to that link the relay is GPIO15 not 14. Also the CF and CF1 pin’s are wrong.
switch:
- platform: gpio
name: "${plug_name}_LED"
id: blue_led
pin: GPIO0
- platform: gpio
name: "${plug_name}_Relay"
pin: GPIO15
id: relay
restore_mode: ALWAYS_ON
on_turn_on:
- switch.turn_on: blue_led
on_turn_off:
- switch.turn_off: blue_led
binary_sensor:
- platform: gpio
device_class: plug
pin:
number: GPIO13
inverted: True
name: "${plug_name}_button"
on_press:
- switch.toggle: relay
sensor:
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: True
cf_pin: GPIO05
cf1_pin: GPIO14
current_resistor: ${current_res}
voltage_divider: ${voltage_div}
current:
name: "${plug_name}_Amperage"
unit_of_measurement: A
voltage:
name: "${plug_name}_Voltage"
unit_of_measurement: V
power:
name: "${plug_name}_Wattage"
unit_of_measurement: W
id: "${plug_name}_Wattage"
change_mode_every: 8
update_interval: 10s
- platform: total_daily_energy
name: "${plug_name}_Total Daily Energy"
power_id: "${plug_name}_Wattage"
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
unit_of_measurement: kWh
I followed the example here https://esphome.io/cookbook/brilliant-mirabella-genio-smart-plugs.html#gosund-sp1 using the GPIO numbers from the link in your first post.
skycryer
(Skycryer)
April 2, 2020, 9:50am
8
Hm, I get an error for GPI05 can not be resolved for board esp01_1m.
Sorry typo, it should be “GPIO05”
Will update post.
wills106
(Will)
April 3, 2020, 3:38pm
10
@skycryer
How did you get on with the code change?
Is it functioning how you wanted it to?
skycryer
(Skycryer)
April 3, 2020, 3:52pm
11
I still try to get the build back working. I get timeout while building from Plattformio.org , not sure why. Some weeks back it worked without any changes.
wills106
(Will)
April 5, 2020, 12:16pm
12
I was able to compile your code in the SuperVisor (HASSIO) addon.
But I had to comment some bits out:
#web_server:
# port: 80
#captive_portal:
Total code now looks like:
substitutions:
plug_name: energy_switch_5
# Higher value gives lower watt readout
current_res: "0.00221"
# Lower value gives lower voltage readout
voltage_div: "955"
esphome:
name: energy_switch_5
platform: ESP8266
board: esp01_1m
wifi:
ssid: "mywifi"
password: "wifi_access_code"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Energy Switch 5"
password: "r41jHxjznkKh"
#web_server:
# port: 80
#captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
time:
- platform: homeassistant
id: homeassistant_time
switch:
- platform: gpio
name: "${plug_name}_LED"
id: blue_led
pin: GPIO0
- platform: gpio
name: "${plug_name}_Relay"
pin: GPIO15
id: relay
restore_mode: ALWAYS_ON
on_turn_on:
- switch.turn_on: blue_led
on_turn_off:
- switch.turn_off: blue_led
binary_sensor:
- platform: gpio
device_class: plug
pin:
number: GPIO13
inverted: True
name: "${plug_name}_button"
on_press:
- switch.toggle: relay
sensor:
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: True
cf_pin: GPIO05
cf1_pin: GPIO14
current_resistor: ${current_res}
voltage_divider: ${voltage_div}
current:
name: "${plug_name}_Amperage"
unit_of_measurement: A
voltage:
name: "${plug_name}_Voltage"
unit_of_measurement: V
power:
name: "${plug_name}_Wattage"
unit_of_measurement: W
id: "${plug_name}_Wattage"
change_mode_every: 8
update_interval: 10s
- platform: total_daily_energy
name: "${plug_name}_Total Daily Energy"
power_id: "${plug_name}_Wattage"
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
unit_of_measurement: kWh
# Extra sensor to keep track of plug uptime
- platform: uptime
name: ${plug_name}_Uptime Sensor
skycryer
(Skycryer)
April 6, 2020, 4:11pm
13
@wills106 i was Finale able to compile and test your changes. I am not able to toggle the plug by pressing the button on device or toggle the switch.
skycryer
(Skycryer)
April 6, 2020, 5:36pm
14
Ok got it now correct working also with Button press. The problem was I used the wrong config. The Aisirer AWP07L also has V2 config, this config was correct then.