Skip to content

Instantly share code, notes, and snippets.

@aureliosaraiva
Created May 9, 2020 17:48
Show Gist options
  • Save aureliosaraiva/0b6fe441f972fe42d799e6d050f182e8 to your computer and use it in GitHub Desktop.
Save aureliosaraiva/0b6fe441f972fe42d799e6d050f182e8 to your computer and use it in GitHub Desktop.
substitutions:
hostname: "Washing-Machine"
ssid_ap: "HA_POW_01"
versao: "1.0"
esphome:
name: washing_machine
platform: ESP8266
board: esp01_1m
board_flash_mode: dout
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_pass
ap:
ssid: "$ssid_ap"
password: !secret AP_mode_pass
captive_portal:
logger:
baud_rate: 0
# Enable Home Assistant API//
api:
ota:
password: !secret ota_pass
text_sensor:
- platform: version
name: "$hostname ESPHome Version $versao"
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "$hostname Button"
on_press:
- switch.toggle: fakebutton
- platform: template
name: "$hostname Running"
filters:
- delayed_off: 15s
lambda: |-
if (isnan(id(power_Wattage).state)) {
return {};
} else if (id(power_Wattage).state > 4) {
// Running
return true;
} else {
// Not running
return false;
}
switch:
- platform: template
name: "$hostname 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: GPIO15
inverted: True
light:
- platform: monochromatic
name: "$hostname Blue LED"
output: pow_blue_led
id: led
sensor:
- platform: hlw8012
sel_pin:
number: GPIO5
inverted: True
cf_pin: GPIO14
cf1_pin: GPIO13
# current_resistor: ${current_res}
# voltage_divider: ${voltage_div}
current:
name: "$hostname Amperage"
unit_of_measurement: A
voltage:
name: "$hostname Voltage"
unit_of_measurement: V
power:
name: "$hostname Wattage"
unit_of_measurement: W
id: "power_Wattage"
change_mode_every: 8
update_interval: 10s
- platform: uptime
name: $hostname Uptime Sensor
- platform: wifi_signal
name: "$hostname Sinal"
update_interval: 60s
- platform: template
name: "$hostname Total Yesterday Energy"
id: template_yesterday
accuracy_decimals: 3
unit_of_measurement: kWh
filters:
- multiply: 0.001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment