Skip to content

Instantly share code, notes, and snippets.

@frenck
Created January 22, 2019 22:35
Show Gist options
  • Save frenck/1b4f0ea98f1f6d86d597c2d9636636db to your computer and use it in GitHub Desktop.
Save frenck/1b4f0ea98f1f6d86d597c2d9636636db to your computer and use it in GitHub Desktop.
Sonoff POW R2 Washing Machine Sensor Example
esphomeyaml:
name: pow
platform: ESP8266
board: esp01_1m
board_flash_mode: dout
wifi:
ssid: 'Demo'
password: 'Livestream'
# Enable logging
logger:
baud_rate: 0
uart:
rx_pin: RX
baud_rate: 4800
# Enable Home Assistant API
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "Sonoff POW Button"
on_press:
- switch.toggle: fakebutton
- platform: template
name: "Washing Machine Running"
filters:
- delayed_off: 15s
lambda: |-
if (isnan(id(power).state)) {
return {};
} else if (id(power).state > 4) {
// Running
return true;
} else {
// Not running
return false;
}
switch:
- platform: template
name: "Sonoff POW Relay"
optimistic: true
id: fakebutton
turn_on_action:
- switch.turn_on: relay
- light.turn_on: led
turn_off_action:
- switch.turn_off: relay
- light.turn_off: led
- platform: gpio
id: relay
pin: GPIO12
output:
- platform: esp8266_pwm
id: pow_blue_led
pin:
number: GPIO13
inverted: True
light:
- platform: monochromatic
name: "Sonoff POW Blue LED"
output: pow_blue_led
id: led
sensor:
- platform: wifi_signal
name: "Sonoff POW WiFi Signal"
update_interval: 60s
- platform: uptime
name: "Sonoff POW Uptime"
- platform: cse7766
update_interval: 2s
current:
name: "Sonoff POW Current"
voltage:
name: "Sonoff POW Voltage"
power:
name: "Sonoff POW Power"
id: power
on_value_range:
- above: 4.0
then:
- light.turn_on: led
- below: 3.0
then:
- light.turn_off: led
text_sensor:
- platform: version
name: "Sonoff POW ESPHome Version"
@moshe19803
Copy link

can i connect tmp sensor?

@JoeAGU
Copy link

JoeAGU commented Apr 25, 2020

Hello.

Please how can I reprogram SONOFF POW R2 to run using ESPHome ?

@mathgim
Copy link

mathgim commented Jun 14, 2020

Hi @frenck,
As always, it's a great pleasure to read through your work! Thank you!

@mathgim
Copy link

mathgim commented Jun 14, 2020

@frenck, I have got one question for you here.
If I understand correctly what you achieved here, you used the blue LED to see when the washing machin is actually using more than 4 W.
If this is correct, why switching on the LED when the relay turns on? Why not waiting for the power to rise above 4?

@mathgim
Copy link

mathgim commented Jun 14, 2020

how do i get Washing Machine Power Usage - TODAY YESTERDAY ?

You can use utility_meter inside ESPHome or in Home Assistant. That's what I do.

@mathgim
Copy link

mathgim commented Jun 14, 2020

Hello.

Please how can I reprogram SONOFF POW R2 to run using ESPHome ?

Go on esphome.io, they explain quite well how to reprogram it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment