Auto DDD
Auto DDD
Auto DDD
More
DIY 8 station irrigation based
Categories on ESPhome on KC868-A8
Blog relay board
Configuration
esphome:
name: $devicename
# platformio_options:
# build_flags:
# - -DCONFIG_ARDUINO_LOOP_STACK_SIZE=16384
# includes:
# - irrigation.h
esp32:
board: nodemcu-32s
framework:
type: arduino
#esp32:
# board: nodemcu-32s
# variant: esp32
# framework:
# type: arduino
# version: 2.0.4
# source: https://github.com/espressif/arduino-esp32.g
# platform_version: https://github.com/platformio/plat
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable logging
logger:
ota:
Hi bremby.
I don’t have any schematic as I just build up as I go.
The connections are this:
esphome:
name: $devicename
esp32:
board: nodemcu-32s
framework:
type: arduino
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable logging
logger:
ota:
switch (id(esp32_sprinkler_ctrlr).active_valve().
ESP Code
# Enable logging
logger:
logger:
#########################################################
##### I/O expander hub definition
#########################################################
mcp23017:
- id: 'mcp23017_hub'
address: 0x20
#nodemcu devkit v4.0
i2c:
sda: 21
scl: 22
scan: True
#########################################################
#########################################################
#########################################################
# Enable Home Assistant APIs
api:
reboot_timeout: 0s
services:
- service: set_multiplier
variables:
multiplier: float
then:
- sprinkler.set_multiplier:
id: esp32_sprinkler_ctrlr
multiplier: !lambda 'return multiplier;'
- service: start_full_cycle
then:
- sprinkler.start_full_cycle: esp32_sprinkler_ctr
- service: start_single_valve
variables:
valve: int
then:
- sprinkler.start_single_valve:
id: esp32_sprinkler_ctrlr
valve_number: !lambda 'return valve;'
- service: next_valve
then:
- sprinkler.next_valve: esp32_sprinkler_ctrlr
- service: previous_valve
then:
then:
- sprinkler.previous_valve: esp32_sprinkler_ctrlr
- service: shutdown
then:
- sprinkler.shutdown: esp32_sprinkler_ctrlr
- service: pause
then:
- sprinkler.pause: esp32_sprinkler_ctrlr
- service: resume
then:
- sprinkler.resume: esp32_sprinkler_ctrlr
- service: resume_or_full_cycle
then:
- sprinkler.resume_or_start_full_cycle:
- service: repeat_2
then:
- sprinkler.set_repeat:
id: esp32_sprinkler_ctrlr
repeat: 2 # would run three cycles
- service: repeat_3
then:
- sprinkler.set_repeat:
id: esp32_sprinkler_ctrlr
repeat: 3 # would run three cycles
UI
- theme: Backend-selected
title: Sprinkler
path: sprinkler
type: panel
badges: []
badges: []
cards:
- type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: entities
entities:
- entity: sensor.sprinklers_status
icon: mdi:list-status
secondary_info: none
- entity: timer.sprinklercountdown
name: Sprinkler Countdown
secondary_info: none
- entity: sensor.zone_active_sensor
icon: mdi:map-marker-path
secondary_info: none
- entity: sensor.zone_time_remaining_se
icon: mdi:history
secondary_info: none
state_color: true
- type: entities
entities:
- entity: number.run_duration_multiplie
icon: mdi:chart-multiline
secondary_info: none
- entity: number.sprinkler_repeat_cycle
icon: mdi:repeat
secondary_info: none
state_color: true
- type: horizontal-stack
cards:
- show_name: true
show_icon: true
type: button
entity: switch.zone_1
icon: mdi:sprinkler
show_state: false
hold_action:
action: none
- show_name: true
show_icon: true
type: button
entity: switch.zone_2
icon: mdi:sprinkler
show_state: false
hold_action:
action: none
- show_name: true
show_icon: true
type: button
entity: switch.zone_3
icon: mdi:sprinkler
show_state: false
hold_action:
action: none
- show_name: true
show_icon: true
type: button
entity: switch.zone_4
icon: mdi:sprinkler
show_state: false
hold_action:
action: none
- show_name: true
show_icon: true
type: button
entity: switch.zone_5
icon: mdi:sprinkler
show_state: false
hold_action:
action: none
- show_name: true
show_icon: true
type: button
entity: switch.zone_6
icon: mdi:sprinkler
show_state: false
hold_action:
action: none
- type: horizontal-stack
cards:
- show_name: false
show_icon: true
type: button
entity: switch.zone_1_enable
icon: mdi:toggle-switch-outline
show_state: false
hold_action:
action: none
- show_name: false
show_icon: true
show_icon: true
AUTOMATION
type: button
entity: switch.zone_2_enable
- id: '1665523175659'
icon: mdi:toggle-switch-outline
alias: Sprinkler Controller
show_state: false
description: ''
hold_action:
trigger:
action: none
- platform: state
- show_name: false
entity_id:
show_icon: true
- switch.sprinkler_controller_stop
type: button
to: 'on'
entity: switch.zone_3_enable
id: SprinklerStop
icon: mdi:toggle-switch-outline
from: 'off'
show_state: false
- platform: state
hold_action:
entity_id:
action: none
- switch.master_run_stop
- show_name: false
from: 'on'
show_icon: true
to: 'off'
type: button
id: EndCycle
entity: switch.zone_4_enable
- platform: state
icon: mdi:toggle-switch-outline
entity_id:
show_state: false
- switch.sprinkler_controller_resume
hold_action:
to: 'on'
action: none
id: SprinklerResume
- show_name: false
- platform: state
show_icon: true
entity_id:
type: button
- switch.sprinkler_controller_run
entity: switch.zone_5_enable
to: 'on'
icon: mdi:toggle-switch-outline
id: Sprinkler Controller Start
show_state: false
from: 'off'
hold_action:
- platform: state
action: none
entity_id:
- show_name: false
- switch.sprinkler_controller_pause
show_icon: true
id: Sprinkler Controller Pause
type: button
from: 'off'
entity: switch.zone_6_enable
to: 'on'
icon: mdi:toggle-switch-outline
condition: []
show_state: false
action:
hold_action:
- choose:
action: none
- conditions:
- type: horizontal-stack
- condition: trigger
cards:
id: SprinklerStop
- show_name: false
sequence:
show_icon: false
- delay:
type: button
hours: 0
entity: number.zone_1_duration
minutes: 0
icon: ''
seconds: 2
show_state: true
show_state: true
milliseconds: 0
hold_action:
- type: toggle
action: none
device_id: 2a2143a5268d8661b4ce50e2807dcd62
- show_name: false
entity_id: switch.sprinkler_controller_stop
show_icon: false
domain: switch
type: button
- service: timer.finish
entity: number.zone_2_duration
data: {}
icon: ''
target:
show_state: true
entity_id: timer.sprinklercountdown
hold_action:
- conditions:
action: none
- condition: trigger
- show_name: false
id: EndCycle
show_icon: false
- condition: and
type: button
conditions:
entity: number.zone_3_duration
- condition: not
icon: ''
conditions:
show_state: true
- condition: state
hold_action:
entity_id: sensor.sprinklers_status
action: none
state: Paused
- show_name: false
sequence:
show_icon: false
- type: toggle
type: button
device_id: 2a2143a5268d8661b4ce50e2807dcd62
entity: number.zone_4_duration
entity_id: switch.sprinkler_controller_stop
icon: ''
domain: switch
show_state: true
- conditions:
hold_action:
- condition: trigger
action: none
id: SprinklerResume
- show_name: false
sequence:
show_icon: false
- type: turn_off
type: button
device_id: 2a2143a5268d8661b4ce50e2807dcd62
entity: number.zone_5_duration
entity_id: switch.sprinkler_controller_pause
icon: ''
domain: switch
show_state: true
- type: turn_off
hold_action:
device_id: 2a2143a5268d8661b4ce50e2807dcd62
action: none
entity_id: switch.sprinkler_controller_resume
- show_name: false
domain: switch
show_icon: false
- service: timer.start
type: button
data: {}
entity: number.zone_6_duration
target:
icon: ''
entity_id: timer.sprinklercountdown
show_state: true
- conditions:
hold_action:
- condition: trigger
action: none
id: Sprinkler Controller Start
- square: false
sequence:
columns: 3
- service: timer.start
type: grid
data:
data:
cards:
duration: '{{ ( (states(''number.zone_1_durati
- show_name: true
(states(''number.zone_3_duration'')|int*60)+
show_icon: true
(states(''number.zone_5_duration'')|int*60)+
type: button
) | timestamp_custom("%H:%M:%S", 0) }}
tap_action:
target:
action: call-service
entity_id: timer.sprinklercountdown
service: esphome.sprinkler_previous_val
mr.sneezy Oct '22
binary_sensor:
- platform: gpio
id: button_1 #push button on front of controller encl
pin:
pcf8574: pcf8574_input_hub
# Use pin number 4 (starting at 0)
number: 4
# One of INPUT or OUTPUT
mode:
input: true
inverted: true
internal: true
on_click:
- min_length: 50ms
max_length: 350ms
then:
- sprinkler.resume_or_start_full_cycle:
- platform: gpio
- platform: gpio
id: button_2 #push button on front of controller encl
pin:
pcf8574: pcf8574_input_hub
# Use pin number 5 (starting at 0)
number: 5
# One of INPUT or OUTPUT
mode:
input: true
inverted: true
internal: true
on_click:
- min_length: 50ms
max_length: 350ms
then:
- sprinkler.next_valve: esp32_sprinkler_ctrlr
- platform: gpio
id: button_3 #push button on front of controller encl
pin:
pcf8574: pcf8574_input_hub
# Use pin number 6 (starting at 0)
number: 6
# One of INPUT or OUTPUT
mode:
input: true
inverted: true
internal: true
on_click:
- min_length: 50ms
max_length: 350ms
then:
- sprinkler.previous_valve: esp32_sprinkler_ctrlr
- platform: gpio
id: button_4 #push button on front of controller encl
pin:
pcf8574: pcf8574_input_hub
# Use pin number 7 (starting at 0)
number: 7
# One of INPUT or OUTPUT
mode:
input: true
inverted: true
internal: true
on_click:
- min_length: 50ms
max_length: 350ms
then:
- sprinkler.pause: esp32_sprinkler_ctrlr
- min_length: 500ms
max_length: 2000ms
then:
- sprinkler.shutdown: esp32_sprinkler_ctrlr
paused_valve()
lambda: |-
switch (id(esp32_sprinkler_ctrlr).active_valve().
case -1:
it.strftime(0, 0, "%a", id(homeassistant_time).
it.strftime(10, 0, "%d-%m-%Y", id(homeassistant
it.strftime(12, 1,"%H:%M:%S", id(homeassistant_
it.printf(0, 3, "Status: %s", id(esp32_sprinkle
if (id(esp32_sprinkler_ctrlr_status).state ==
it.printf(0, 2, "Zone %s", id(zone_active_senso
it.printf(10, 2, "T: %s", id(zone_time_remainin
}
break;
default:
it.printf(0, 0, "Zone %s:", id(zone_active_sens
it.printf(8, 0, "%s", id(zone_active_sensor).st
it.printf(0, 1, "Time Letf: %s", id(zone_time_r
break;
}
# Establish Substitutions
substitutions:
device_name: sprinkler
friendly_name: "Sprinkler"
device_platform: ESP32
device_board: esp32dev
device_ip: X.X.X.X
sensor_update_frequency: 1s
sprinkler_name: esp32_sprinkler_ctrlr
packages:
wifi: !include common/device_wifi.yaml
device_base: !include common/device_base_ESP32.yaml
home_assistant_api: !include common/device_api.yaml
sensor_wifi_ip_address: !include common/sensor_wifi_ip_
# Enable logging
logger:
#########################################################
##### I/O expander hub definition
#########################################################
mcp23017:
- id: 'mcp23017_hub'
address: 0x20
#nodemcu devkit v4.0
i2c:
sda: 21
scl: 22
scan: True
frequency: 200kHz
#########################################################
# 10x4 LCD config
display:
- platform: lcd_pcf8574
dimensions: 20x4
address: 0x27
update_interval: 1s
lambda: |-
switch (id(esp32_sprinkler_ctrlr).active_valve().
case -1:
it.strftime(0, 0, "%a", id(homeassistant_time).
it.strftime(10, 0, "%d-%m-%Y", id(homeassistant
it.strftime(12, 1,"%H:%M:%S", id(homeassistant_
it.printf(0, 3, "Status: %s", id(esp32_sprinkle
if (id(esp32_sprinkler_ctrlr_status).state
it.printf(0, 2, "Zone %s", id(zone_active_senso
it.printf(10, 2, "T: %s", id(zone_time_remainin
}
break;
default:
it.printf(0, 0, "Zone %s:", id(zone_active_sens
it.printf(8, 0, "%s", id(zone_active_sensor).st
it.printf(0, 1, "Time Letf: %s",
break;
}
output:
- platform: ledc
pin: GPIO14
id: sprinkler_backlight
light:
light:
- platform: monochromatic
output: sprinkler_backlight
name: "LCD Display Sprinkler Backlight"
id: light_backlight
restore_mode: ALWAYS_ON
#########################################################
#########################################################
# Enable Home Assistant APIs
api:
reboot_timeout: 0s
services:
- service: set_multiplier
variables:
multiplier: float
then:
- sprinkler.set_multiplier:
id: esp32_sprinkler_ctrlr
multiplier: !lambda 'return multiplier;'
- service: start_full_cycle
then:
- sprinkler.start_full_cycle: esp32_sprinkler_ctr
- service: start_single_valve
variables:
valve: int
then:
- sprinkler.start_single_valve:
id: esp32_sprinkler_ctrlr
valve_number: !lambda 'return valve;'
- service: next_valve