Created
December 17, 2020 14:04
-
-
Save grischard/dcd12d596594364f0d8d7e460296c506 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Washing machine is a Sonoff POW R2 | |
substitutions: | |
device: lavelinge | |
name: Washing Machine | |
reboot_timeout: 1h | |
update_interval: 60s | |
delayed_on_off: 100ms | |
esphome: | |
name: ${device} | |
platform: ESP8266 | |
board: esp01_1m | |
<<: !include common/common.yaml | |
<<: !include common/logger.yaml | |
# Component sensor.cse7766 requires component uart. | |
uart: | |
rx_pin: RX | |
baud_rate: 4800 | |
binary_sensor: | |
- !include common/binary_sensor/status.yaml | |
- platform: gpio | |
pin: | |
number: GPIO0 | |
mode: INPUT_PULLUP | |
inverted: True | |
name: "${name} Button" | |
on_press: | |
- switch.toggle: fakebutton | |
- platform: template | |
name: "${name} done" | |
filters: | |
- delayed_off: 15s | |
lambda: |- | |
if (isnan(id(power).state)) { | |
return {}; | |
} else if (id(power).state < 4) { | |
// Finito | |
return true; | |
} else { | |
// Running | |
return false; | |
} | |
switch: | |
- !include common/switch/restart.yaml | |
- platform: template | |
name: "${name} Relay" | |
optimistic: true | |
id: fakebutton | |
turn_on_action: | |
- switch.turn_on: relay | |
- light.turn_on: blue_led | |
turn_off_action: | |
- switch.turn_off: relay | |
- light.turn_off: blue_led | |
- platform: gpio | |
id: relay | |
pin: GPIO12 | |
restore_mode: ALWAYS_ON | |
output: | |
- platform: esp8266_pwm | |
id: pow_blue_led | |
pin: | |
number: GPIO13 | |
light: | |
- platform: monochromatic | |
name: "${name} Blue LED" | |
output: pow_blue_led | |
id: blue_led | |
sensor: | |
- !include common/sensor/wifi-signal.yaml | |
- !include common/sensor/uptime.yaml | |
# Power sensor | |
- platform: cse7766 | |
# Current sensor | |
current: | |
name: ${name} current | |
unit_of_measurement: A | |
accuracy_decimals: 3 | |
# Voltage sensor | |
voltage: | |
name: ${name} voltage | |
unit_of_measurement: V | |
accuracy_decimals: 1 | |
# Power sensor | |
power: | |
id: power | |
name: ${name} power | |
unit_of_measurement: W | |
accuracy_decimals: 0 | |
on_value_range: | |
- above: 4.0 | |
then: | |
- light.turn_on: blue_led | |
- below: 3.0 | |
then: | |
- light.turn_off: blue_led |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment