Files
hassos_config/esphome/watervalve.yaml

67 lines
1.7 KiB
YAML

substitutions:
device_name: "watervalve"
friendly_name: "WaterValve Garage"
comment: "ESP8266, tuya-hack"
location: "Garage"
api_password: !secret watervalve_api
ota_password: !secret ota_password
wifi_ssid: !secret wifi_ssid
wifi_password: !secret wifi_password
gateway: !secret ip_gateway
subnet: !secret ip_subnet
ip: !secret watervalve_ip
pin_status: GPIO0
pin_motor: GPIO13
pin_button: GPIO12
packages:
board: !include boards/esp12f.yaml
connection: !include common/wifi.yaml
device_base: !include common/common.yaml
status: !include templates/status.yaml
logger: !include templates/logger.yaml
switch:
- platform: gpio
id: valveMotor
pin: ${pin_motor}
name: "Valve"
icon: mdi:pipe-valve
internal: true
binary_sensor:
- platform: gpio
name: "Button"
pin: ${pin_button}
on_click:
min_length: 50ms
max_length: 1000ms
then:
- sprinkler.start_full_cycle: tuin_sprinkler_ctrlr
on_double_click:
then:
- sprinkler.shutdown: tuin_sprinkler_ctrlr
sprinkler:
- id: tuin_sprinkler_ctrlr
multiplier_number: "Herhaling"
valves:
- valve_switch: "hoofd klep"
run_duration_number: "hoofd klep timer"
valve_switch_id: valveMotor
sensor:
- platform: template
name: "Resterende tijd"
lambda: |-
if (id(tuin_sprinkler_ctrlr).time_remaining_active_valve().has_value()) {
// the controller is running, print the number of seconds remaining
return id(tuin_sprinkler_ctrlr).time_remaining_active_valve().value();
} else {
// the controller is NOT running
return 0;
}
unit_of_measurement: s
accuracy_decimals: 0
device_class: "duration"
update_interval: 1s