HI,
I’m running the lasted esphome version [v2022.9.4 ], I don’t any error, I’m using nodemuc V4
# Modify only the following eight lines.
unit_id: A
devicename_unit_id: a
zone_1_name: Zone1
zone_2_name: Zone2
zone_3_name: Zone3
zone_4_name: Zone4
zone_5_name: Zone5
zone_6_name: Zone6
software_version: 2022 10 04 v25
sensor_update_frequency: 1s
# DO NOT CHANGE ANYTHING BELOW THIS LINE ###
zone_1_valve_id: valve_0
zone_2_valve_id: valve_1
zone_3_valve_id: valve_2
zone_4_valve_id: valve_3
zone_5_valve_id: valve_4
zone_6_valve_id: valve_5
#esphome_name: irrigation-valve-ctrl-unit-$devicename_unit_id
#esphome_platform: ESP8266
#esphome_board: d1_mini
#esphome_comment: Six Valve Irrigation Control - $unit_id
#esphome_project_name: Robert.Six Valve Irrigation Control - $unit_id
#esphome_project_version: Six Valve Irrigation Ctrl - Unit $unit_id, $software_version
devicename: irrigation_valve_controller_unit_$devicename_unit_id
#upper_devicename: Six Valve Irrigation Ctrl - $unit_id
uom: Min
#Define Project Deatils and ESP Board Type
esphome:
#name: $esphome_name
#platform: $esphome_platform
#board: $esphome_board
#comment: $esphome_comment
#project:
# name: $esphome_project_name
# version: $esphome_project_version
on_boot:
priority: -100
then:
# Set default state for Valve Status
- text_sensor.template.publish:
id: valve_status_$devicename_unit_id
state: "Idle"
# Set multiplier to 60, convert seconds to minutes
- sprinkler.set_multiplier:
id: $devicename
multiplier: 60
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_address.yaml
# Enable logging
logger:
# Sync time with Home Assistant.
time:
- platform: homeassistant
id: homeassistant_time
# Text sensors with general information.
text_sensor:
# Expose Time Remaining as a sensor.
- platform: template
id: time_remaining_$devicename_unit_id
name: "Time Remaining ($unit_id)"
update_interval: $sensor_update_frequency
icon: "mdi:timer-sand"
lambda: |-
int seconds = round(id($devicename).time_remaining().value_or(0));
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return {
((days ? String(days) + "d " : "") +
(hours ? String(hours) + "h " : "") +
(minutes ? String(minutes) + "m " : "") +
(String(seconds) + "s")
).c_str()};
# Expose Progress Percent as a sensor.
- platform: template
id: progress_percent_$devicename_unit_id
name: "Progress % ($unit_id)"
#optimistisc: true
update_interval: $sensor_update_frequency
icon: "mdi:progress-clock"
lambda: |-
int progress_percent = round(((id($devicename).valve_run_duration_adjusted(id($devicename).active_valve().value_or(0)) - id($devicename).time_remaining().value_or(0)) * 100 / id($devicename).valve_run_duration_adjusted(id($devicename).active_valve().value_or(0))));
std::string progress_percent_as_string = std::to_string(progress_percent);
return progress_percent_as_string;
# Expose Valve Status as a sensor.
- platform: template
id: valve_status_$devicename_unit_id
name: "Status ($unit_id)"
icon: "mdi:information-variant"
# Enable On-Board Status LED.
status_led:
pin:
# Pin D4
number: GPIO2
inverted: true
# Enable Home Assistant APIs
api:
# encryption:
# key: !secret api_encryption
# password: !secret api_password
number:
- platform: template
id: $zone_1_valve_id
name: $zone_1_name
min_value: 1
max_value: 60
step: 1
unit_of_measurement: $uom
icon: "mdi:timer-outline"
mode: box # Defines how the number should be displayed in the UI
lambda: "return id($devicename).valve_run_duration(0);"
set_action:
- sprinkler.set_valve_run_duration:
id: $devicename
valve_number: 0
run_duration: !lambda 'return x;'
- platform: template
id: $zone_2_valve_id
name: $zone_2_name
min_value: 1
max_value: 60
step: 1
unit_of_measurement: $uom
icon: "mdi:timer-outline"
mode: box # Defines how the number should be displayed in the UI
lambda: "return id($devicename).valve_run_duration(1);"
set_action:
- sprinkler.set_valve_run_duration:
id: $devicename
valve_number: 1
run_duration: !lambda 'return x;'
- platform: template
id: $zone_3_valve_id
name: $zone_3_name
min_value: .5
max_value: 60
step: 1
unit_of_measurement: $uom
icon: "mdi:timer-outline"
mode: box # Defines how the number should be displayed in the UI
lambda: "return id($devicename).valve_run_duration(2);"
set_action:
- sprinkler.set_valve_run_duration:
id: $devicename
valve_number: 2
run_duration: !lambda 'return x;'
- platform: template
id: $zone_4_valve_id
name: $zone_4_name
min_value: 1
max_value: 60
step: 1
unit_of_measurement: $uom
icon: "mdi:timer-outline"
mode: box # Defines how the number should be displayed in the UI
lambda: "return id($devicename).valve_run_duration(3);"
set_action:
- sprinkler.set_valve_run_duration:
id: $devicename
valve_number: 3
run_duration: !lambda 'return x;'
- platform: template
id: $zone_5_valve_id
name: $zone_5_name
min_value: 1
max_value: 60
step: 1
unit_of_measurement: $uom
icon: "mdi:timer-outline"
mode: box # Defines how the number should be displayed in the UI
lambda: "return id($devicename).valve_run_duration(4);"
set_action:
- sprinkler.set_valve_run_duration:
id: $devicename
valve_number: 4
run_duration: !lambda 'return x;'
- platform: template
id: $zone_6_valve_id
name: $zone_6_name
min_value: 1
max_value: 60
step: 1
unit_of_measurement: $uom
icon: "mdi:timer-outline"
mode: box # Defines how the number should be displayed in the UI
lambda: "return id($devicename).valve_run_duration(5);"
set_action:
- sprinkler.set_valve_run_duration:
id: $devicename
valve_number: 5
run_duration: !lambda 'return x;'
sprinkler:
- id: $devicename
main_switch:
name: "Start/Stop/Resume ($unit_id)"
id: main_switch
auto_advance_switch: "Auto Advance ($unit_id)"
valve_open_delay: 2s
valves:
- valve_switch: $zone_1_name
enable_switch: Enable $zone_1_name
run_duration: 20s
valve_switch_id: ${devicename}_1
- valve_switch: $zone_2_name
enable_switch: Enable $zone_2_name
run_duration: 20s
valve_switch_id: ${devicename}_2
- valve_switch: $zone_3_name
enable_switch: Enable $zone_3_name
run_duration: 20s
valve_switch_id: ${devicename}_3
- valve_switch: $zone_4_name
enable_switch: Enable $zone_4_name
run_duration: 20s
valve_switch_id: ${devicename}_4
- valve_switch: $zone_5_name
enable_switch: Enable $zone_5_name
run_duration: 20s
valve_switch_id: ${devicename}_5
- valve_switch: $zone_6_name
enable_switch: Enable $zone_6_name
run_duration: 20s
valve_switch_id: ${devicename}_6
button:
- platform: template
id: sprinkler_pause
name: "Pause ($unit_id)"
icon: "mdi:pause"
on_press:
then:
- text_sensor.template.publish:
id: valve_status_$devicename_unit_id
state: "Paused"
- sprinkler.pause: $devicename
switch:
# Hidden switches.
# Switches that control sprinkler valve relays
- platform: gpio
name: Relay Board Pin IN1
restore_mode: RESTORE_DEFAULT_OFF # Prevents GPIO pin from going high during boot
internal: true # Prevents GPIO switch NAME from showing up in Home Assistant
id: ${devicename}_1
on_turn_on:
- text_sensor.template.publish:
id: valve_status_$devicename_unit_id
state: "$zone_1_name Active"
on_turn_off:
- text_sensor.template.publish:
id: valve_status_$devicename_unit_id
state: "Idle"
pin:
# GPIO Pin 12
number: 21
inverted: true
- platform: gpio
name: Relay Board Pin IN2
restore_mode: RESTORE_DEFAULT_OFF # Prevents GPIO pin from going high during boot
internal: true # Prevents GPIO switch NAME from showing up in Home Assistant
id: ${devicename}_2
on_turn_on:
- text_sensor.template.publish:
id: valve_status_$devicename_unit_id
state: "$zone_2_name Active"
on_turn_off:
- text_sensor.template.publish:
id: valve_status_$devicename_unit_id
state: "Idle"
pin:
# GPIO Pin 13
number: 22
inverted: true
- platform: gpio
name: Relay Board Pin IN3
restore_mode: RESTORE_DEFAULT_OFF # Prevents GPIO pin from going high during boot
internal: true # Prevents GPIO switch NAME from showing up in Home Assistant
id: ${devicename}_3
on_turn_on:
- text_sensor.template.publish:
id: valve_status_$devicename_unit_id
state: "$zone_3_name Active"
on_turn_off:
- text_sensor.template.publish:
id: valve_status_$devicename_unit_id
state: "Idle"
pin:
# GPIO Pin 14
number: 23
inverted: true
- platform: gpio
name: Relay Board Pin IN4
restore_mode: RESTORE_DEFAULT_OFF # Prevents GPIO pin from going high during boot
internal: true # Prevents GPIO switch NAME from showing up in Home Assistant
id: ${devicename}_4
on_turn_on:
- text_sensor.template.publish:
id: valve_status_$devicename_unit_id
state: "$zone_4_name Active"
on_turn_off:
- text_sensor.template.publish:
id: valve_status_$devicename_unit_id
state: "Idle"
pin:
# GPIO Pin 4
number: 19
inverted: true
- platform: gpio
name: Relay Board Pin IN5
restore_mode: RESTORE_DEFAULT_OFF # Prevents GPIO pin from going high during boot
internal: true # Prevents GPIO switch NAME from showing up in Home Assistant
id: ${devicename}_5
on_turn_on:
- text_sensor.template.publish:
id: valve_status_$devicename_unit_id
state: "$zone_5_name Active"
on_turn_off:
- text_sensor.template.publish:
id: valve_status_$devicename_unit_id
state: "Idle"
pin:
# GPIO Pin 4
number: 18
inverted: true
- platform: gpio
name: Relay Board Pin IN6
restore_mode: RESTORE_DEFAULT_OFF # Prevents GPIO pin from going high during boot
internal: true # Prevents GPIO switch NAME from showing up in Home Assistant
id: ${devicename}_6
on_turn_on:
- text_sensor.template.publish:
id: valve_status_$devicename_unit_id
state: "$zone_6_name Active"
on_turn_off:
- text_sensor.template.publish:
id: valve_status_$devicename_unit_id
state: "Idle"
pin:
# GPIO Pin 4
number: 17
inverted: true