Files
Your Name 194723e228
Python application / build (push) Failing after 55s
updating configuration
2020-01-30 22:22:18 +03:00

100 lines
2.4 KiB
YAML

# ----------- User configutaion ------------------
substitutions:
devicename: watercontrol
upper_devicename: Watercontrol
water_open_pin: D5
water_close_pin: D3
ultrasonic_echo_pin: D6
ultrasonic_trig_pin: D7
# ----------- /User configutaion ------------------
# Need to turn off logging because senseair uses uart and have conflicts with logging
logger:
esphome:
name: $devicename
platform: ESP8266
board: d1_mini
libraries:
- "Bounce2"
includes:
- water_counters.h
wifi:
ssid: !secret wifi_24_name
password: !secret wifi_24_pass
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "$upper_devicename Fallback Hotspot"
password: !secret esphome_captive_pass
captive_portal:
# Enable Home Assistant API
api:
password: !secret esphome_pass
ota:
password: !secret esphome_pass
globals:
- id: water_state
type: bool
restore_value: yes
initial_value: 'true'
#------------------------------------------------------------------------------
sensor:
- platform: uptime
name: "$upper_devicename Uptime"
#------------------------------------------------------------------------------
- platform: custom
lambda: |-
auto my_sensor = new WaterCountersSensor();
App.register_component(my_sensor);
return {my_sensor->cold_sensor, my_sensor->hot_sensor};
sensors:
- name: "Counter Cold"
accuracy_decimals: 2
- name: "Counter Hot"
accuracy_decimals: 2
#------------------------------------------------------------------------------
- platform: ultrasonic
trigger_pin: $ultrasonic_trig_pin
echo_pin: $ultrasonic_echo_pin
name: "Toilet Distance"
update_interval: 5s
switch:
- platform: gpio
pin:
number: $water_open_pin
inverted: yes
id: water_open
interlock: [water_close]
- platform: gpio
pin:
number: $water_close_pin
inverted: yes
id: water_close
interlock: [water_open]
- platform: template
name: "Water valve"
icon: "mdi:cup-water"
lambda: |-
return id(water_state);
turn_on_action:
- switch.turn_on: water_open
- delay: 5s
- switch.turn_off: water_open
- lambda: 'id(water_state) = true;'
turn_off_action:
- switch.turn_on: water_close
- delay: 5s
- switch.turn_off: water_close
- lambda: 'id(water_state) = false;'