Closed jeroenterheerdt closed 9 months ago
doesn't look like we can ship blueprints in-box. Asked on Discord.
ship blueprints in-box:
- standard
- esphome irrigation controller
- irrigation unlimited
- simple scheduler
@
ship blueprints in-box:
- standard
- esphome irrigation controller
- irrigation unlimited
- simple scheduler
@gatonero can I ask you to add sample automations for each of these to the wiki (I believe you most of them already. I can supply the one using esphome as that is what I am using). Also, I would like to store the as blueprints I this repo so we can provide them as blueprints in our wiki and in the help page in the UI. That's the best we can do, apart from building automation in the integration itself, since we cannot ship blueprints with the integration itself.
Of course! :-)
Awesome, also I think we should figure out a way for people to irrigate every X days as part of the blueprint. Grass should not be watered every day. Ideally the blueprint should allow you to set that up as well as allowing you to configure if you want to reset the bucket every day or night nly when you have actually irrigated.
We can also consider adding a X days counter in the integration itself if that is easier but not sure if that makes sense
I have problems to format the delay. How to delay depending on sensor state in a blueprint
This is what I used to have, not necessary anymore because of esphome, but hey:
delay: "{{states("sensor.smart_irrigation_daily_adjusted_run_time")}}"
delay:
seconds: '{{states("sensor.duration")}}'
and
delay:
seconds: '{{states("duration")}}'
gives
Error: expected float for dictionary value @ data['seconds']
|float()
: {{states("sensor.duration")|float()}}
With: delay: '{{states("sensor.duration") | float()}}'
I get
Error: ValueError: Template error: float got invalid input 'unknown' when rendering template '{{states("sensor.duration") | float()}}' but no default was specified
also when using seconds.
Are you certain sensor.duration exists?
Thanks for the hint! I found the solution! :-)
It's: delay: '{{ states(my_duration) }}'
Here is the first blueprint:
blueprint:
name: Standard Irrigation
description: Standard irrigation for one zone
domain: automation
input:
irrigation_switch:
name: Irrigation Switch
description: Switch, tap or valve to turn on and off
selector:
entity:
filter:
- domain: switch
irrigation_zone:
name: Irrigation Zone
description: Zone to irrigate
selector:
entity:
filter:
- device_class: duration
variables:
irrigation_time: !input irrigation_zone
alias: Standard Irrigation
description: "Standard irrigation for one Zone"
trigger:
platform: event
event_type: smart_irrigation_start
condition:
- condition: numeric_state
entity_id: !input irrigation_zone
above: 0
action:
- service: switch.turn_on
data: {}
target:
entity_id: !input irrigation_switch
- delay: "{{ states(irrigation_time) }}"
- service: switch.turn_off
data: {}
target:
entity_id:
- !input irrigation_switch
- service: smart_irrigation.reset_bucket
data: {}
target:
entity_id: !input irrigation_zone
mode: single
Here is a script blueprint that can be called by Simple Scheduler.
blueprint:
name: Simple Scheduler Irrigation
description: Irrigation for one zone, called by Simple Scheduler
domain: script
input:
irrigation_switch:
name: Irrigation Switch
description: Switch, tap or valve to turn on and off
selector:
entity:
filter:
- domain: switch
irrigation_zone:
name: Irrigation Zone
description: Zone to irrigate
selector:
entity:
filter:
- device_class: duration
variables:
irrigation_time: !input irrigation_zone
alias: Standard Irrigation
description: "Standard irrigation for one Zone"
sequence:
- condition: numeric_state
entity_id: !input irrigation_zone
above: 0
- service: switch.turn_on
data: {}
target:
entity_id: !input irrigation_switch
- delay: "{{ states(irrigation_time) }}"
- service: switch.turn_off
data: {}
target:
entity_id:
- !input irrigation_switch
- service: smart_irrigation.reset_bucket
data: {}
target:
entity_id: !input irrigation_zone
mode: single
icon: mdi:sprinkler
so for esphome it's slightly different.
first off you have to make sure to expose the set_valve_runtime_duration
action as a service to HA. Here's part of my ESPHOME config that does that (I gave the service the same name):
`
services:
Now, in a automation you can just do:
service: esphome.sprinklercontroller_set_valve_run_duration data: duration: 1 valve: 0
where sprinklercontroller
is the name of my esphome device, so this will be different for everyone and set_valve_run_duration
is the name of the service as specified in the esphome config.
Now, the valves are 0-indexed, so the first one is index 0, the second index 1, and so on.
you can figure out how to put the dynamic duration from our integration into the duration
field.
Can you create a blueprint out of this? Happy to test it :)
Here are two blueprints for Irrigation unlimited. I adapted the automations from https://github.com/rgc99/irrigation_unlimited#92-hasmartirrigation . I didn't test it because I didn't install Irrigation unlimited. For me it's too pixilated.
blueprint:
name: Irrigation Unlimited adjust watering time
description: Adjust watering times based on smart irrigation calculations
domain: automation
input:
irrigation_zone:
name: Irrigation Zone
description: Zone to irrigate
selector:
entity:
filter:
- device_class: duration
time_on:
name: Time to turn on
selector:
time:
default: "23:30:00"
variables:
irrigation_time: !input irrigation_zone
alias: Smart Irrigation adjustment
trigger:
platform: time
at: !input time_on
condition:
- condition: "{{ states(irrigation_time) | float(-1) >= 0 }}"
action:
- service: irrigation_unlimited.adjust_time
data:
actual: "{{ timedelta(seconds=states(irrigation_time) | int(0)) }}"
mode: single
blueprint:
name: Irrigation Unlimited --> Smart Irrigation reset bucket
description: Irrigation Unlimited --> Smart Irrigation reset bucket
domain: automation
input:
irrigation_zone:
name: Irrigation Zone
description: Irrigation Zone
selector:
entity:
filter:
- device_class: duration
irrigation_unlimited_sensor:
name: Irrigation Unlimited sensor
description: Irrigation Unlimited sensors
selector:
entity:
filter:
- domain: binary_sensor
variables:
irrigation_time: !input irrigation_zone
alias: Smart Irrigation reset bucket
trigger:
platform: state
entity_id:
- !input irrigation_unlimited_sensor
from: on
to: off
condition:
- condition: numeric_state
entity_id: !input irrigation_zone
above: 0
action:
- service: smart_irrigation.reset_bucket
data: {}
target:
entity_id: !input irrigation_zone
mode: single
For ESPHome something like this?
blueprint:
name: ESPHome Irrigation
description: ESPHome Irrigation
domain: automation
input:
esphome_device:
name: ESPHome device
description: ESPHome device to turn on and off
selector:
entity:
# filter:
# - domain: ???
# - device_class: ???
irrigation_zone:
name: Irrigation Zone
description: Zone to irrigate
selector:
entity:
filter:
- device_class: duration
variables:
esphome_device: !input esphome_device
irrigation_time: !input irrigation_zone
alias: Irrigation with ESPHome device
description: "Irrigation with ESPHome device"
trigger:
platform: event
event_type: smart_irrigation_start
condition:
- condition: numeric_state
entity_id: !input irrigation_zone
above: 0
action:
- repeat:
for_each:
- esphome_device.valve
sequence:
- service: esphome.{{esphome_device}}_set_valve_run_duration
data:
duration: "{{states(irrigation_time)}"
target:
entity_id: esphome_device.valve
- service: smart_irrigation.reset_bucket
data: {}
target:
entity_id: !input irrigation_zone
mode: single
for esphome, these is what I tried to use with the blueprint, but it didn't work.
input: irrigation_zone: sensor.lawn_deck_zone_1 esphome_device: switch.sprinklercontroller_zone_1
I have a service: esphome.sprinklercontroller_set_valve_run_duration
Maybe allow the user to configure the service in the blueprint? Not sure...
Try this:
blueprint:
name: ESPHome Irrigation
description: ESPHome Irrigation
domain: automation
input:
esphome_device:
name: ESPHome device
description: ESPHome device to turn on and off
selector:
entity:
# filter:
# - domain: ???
# - device_class: ???
irrigation_zone:
name: Irrigation Zone
description: Zone to irrigate
selector:
entity:
filter:
- device_class: duration
service_call:
name: Service Call
description: ESPHome Service to call
selector:
action:
variables:
esphome_device: !input esphome_device
irrigation_time: !input irrigation_zone
service_call: !input service_call
alias: Irrigation with ESPHome device
description: "Irrigation with ESPHome device"
trigger:
platform: event
event_type: smart_irrigation_start
condition:
- condition: numeric_state
entity_id: !input irrigation_zone
above: 0
action:
- repeat:
for_each:
- esphome_device.valve
sequence:
- service: service_call
data:
duration: "{{states(irrigation_time)}"
target:
entity_id: esphome_device.valve
- service: smart_irrigation.reset_bucket
data: {}
target:
entity_id: !input irrigation_zone
mode: single
Awesome, also I think we should figure out a way for people to irrigate every X days as part of the blueprint. Grass should not be watered every day. Ideally the blueprint should allow you to set that up as well as allowing you to configure if you want to reset the bucket every day or night nly when you have actually irrigated.
I guess this is something for Irrigation unlimited people.
Awesome, also I think we should figure out a way for people to irrigate every X days as part of the blueprint. Grass should not be watered every day. Ideally the blueprint should allow you to set that up as well as allowing you to configure if you want to reset the bucket every day or night nly when you have actually irrigated.
I guess this is something for Irrigation unlimited people.
Yeah, maybe. I have solved this today with a counter that I increment every day.
Try this:
blueprint: name: ESPHome Irrigation description: ESPHome Irrigation domain: automation input: esphome_device: name: ESPHome device description: ESPHome device to turn on and off selector: entity: # filter: # - domain: ??? # - device_class: ??? irrigation_zone: name: Irrigation Zone description: Zone to irrigate selector: entity: filter: - device_class: duration service_call: name: Service Call description: ESPHome Service to call selector: action: variables: esphome_device: !input esphome_device irrigation_time: !input irrigation_zone service_call: !input service_call alias: Irrigation with ESPHome device description: "Irrigation with ESPHome device" trigger: platform: event event_type: smart_irrigation_start condition: - condition: numeric_state entity_id: !input irrigation_zone above: 0 action: - repeat: for_each: - esphome_device.valve sequence: - service: service_call data: duration: "{{states(irrigation_time)}" target: entity_id: esphome_device.valve - service: smart_irrigation.reset_bucket data: {} target: entity_id: !input irrigation_zone mode: single
not sure this works as expected :)
I have some ESP32 left over. I could install your code. Would bei better for me to test the blueprint.
I have some ESP32 left over. I could install your code. Would bei better for me to test the blueprint.
great! here's my ESPHOME code for the sprinkler controller. A large part of this is just to provide interesting statistics and not necessary (the total run time etc), but this is it.
esphome:
name: sprinklercontroller
friendly_name: sprinklercontroller
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret encryption_key
services:
- service: set_valve_run_duration
variables:
duration: int
valve: int
then:
- sprinkler.set_valve_run_duration:
id: sprinkler_controller
run_duration: !lambda 'return duration;'
valve_number: !lambda 'return valve;'
- service: set_multiplier
variables:
multiplier: float
then:
- sprinkler.set_multiplier:
id: sprinkler_controller
multiplier: !lambda 'return multiplier;'
- service: start_full_cycle
then:
- sprinkler.start_full_cycle: sprinkler_controller
- service: start_single_valve
variables:
valve: int
then:
- sprinkler.start_single_valve:
id: sprinkler_controller
valve_number: !lambda 'return valve;'
- service: next_valve
then:
- sprinkler.next_valve: sprinkler_controller
- service: previous_valve
then:
- sprinkler.previous_valve: sprinkler_controller
- service: shutdown
then:
- sprinkler.shutdown: sprinkler_controller
ota:
password: !secret OTA_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.X.X
gateway: !secret gateway
subnet: !secret subnet
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Sprinklercontroller"
password: !secret fallback_hotspot_password
captive_portal:
switch:
- platform: gpio
pin: 5
id: lawn_sprinkler_valve_sw1
- platform: gpio
pin: 4
id: lawn_sprinkler_valve_sw2
- platform: gpio
pin: 0
id: lawn_sprinkler_valve_sw3
- platform: gpio
pin: 14
id: lawn_sprinkler_valve_sw4
- platform: gpio
pin: 12
id: lawn_sprinkler_valve_sw5
- platform: gpio
pin: 13
id: lawn_sprinkler_valve_sw6
sprinkler:
- id: sprinkler_controller
main_switch: "Sprinklers"
auto_advance_switch: "Sprinklers Auto Advance"
valve_overlap: 5s #overlap to avoid banging. maybe use valve_open_delay instead?
multiplier_number: "Sprinklers Multiplier" #s
repeat_number: "Sprinklers Repeat" #s
valves:
- valve_switch: "Zone 1"
enable_switch: "Enable Zone 1"
run_duration_number: "Zone 1 Run Duration" #s
valve_switch_id: lawn_sprinkler_valve_sw1
- valve_switch: "Zone 2"
enable_switch: "Enable Zone 2"
run_duration_number: "Zone 2 Run Duration" #s
valve_switch_id: lawn_sprinkler_valve_sw2
- valve_switch: "Zone 3"
enable_switch: "Enable Zone 3"
run_duration_number: "Zone 3 Run Duration" #s
valve_switch_id: lawn_sprinkler_valve_sw3
- valve_switch: "Zone 4"
enable_switch: "Enable Zone 4"
run_duration_number: "Zone 4 Run Duration" #s
valve_switch_id: lawn_sprinkler_valve_sw4
- valve_switch: "Zone 5"
enable_switch: "Enable Zone 5"
run_duration_number: "Zone 5 Run Duration" #s
valve_switch_id: lawn_sprinkler_valve_sw5
- valve_switch: "Zone 6"
enable_switch: "Enable Zone 6"
run_duration_number: "Zone 6 Run Duration" #s
valve_switch_id: lawn_sprinkler_valve_sw6
sensor:
- platform: template
name: "Sprinkler Time Remaining Active Valve"
lambda: |-
if (id(sprinkler_controller).time_remaining_active_valve().has_value()) {
// the controller is running, print the number of seconds remaining
return id(sprinkler_controller).time_remaining_active_valve().value();
} else {
// the controller is NOT running
return 0;
}
update_interval: 5s
unit_of_measurement: "s"
- platform: template
name: "Sprinkler Time Remaining Current Operation"
lambda: |-
return id(sprinkler_controller).time_remaining_current_operation();
update_interval: 5s
unit_of_measurement: "s"
- platform: template
name: "Sprinkler Total Queue Time"
lambda: |-
return id(sprinkler_controller).total_queue_time();
update_interval: 5s
unit_of_measurement: "s"
- platform: template
name: "Sprinkler Total Cycle Time Enabled Incomplete Valves"
lambda: |-
return id(sprinkler_controller).total_cycle_time_enabled_incomplete_valves();
update_interval: 5s
unit_of_measurement: "s"
- platform: template
name: "Sprinkler Total Cycle Time Enabled Valves"
lambda: |-
return id(sprinkler_controller).total_cycle_time_enabled_valves();
update_interval: 5s
unit_of_measurement: "s"
- platform: template
name: "Sprinkler Total Cycle Time All Valves"
lambda: |-
return id(sprinkler_controller).total_cycle_time_all_valves();
update_interval: 5s
unit_of_measurement: "s"
Please test this blueprint. It's not the final version.
blueprint:
name: ESPHome Irrigation
description: ESPHome Irrigation
domain: automation
input:
esphome_device:
name: ESPHome device
description: ESPHome valve / zone to turn on and off
selector:
entity:
filter:
- domain: switch
irrigation_zone:
name: Irrigation Zone
description: Zone to irrigate
selector:
entity:
filter:
- device_class: duration
variables:
irrigation_time: !input irrigation_zone
esphome_device: !input esphome_device
esphome_replace: "{{ esphome_device | replace('.', '_') }}"
esphome_name: "{{ esphome_replace.split('_')[1] }}"
esphome_valve: "{{ esphome_replace.split('_')[4] }}"
alias: Irrigation with ESPHome device
description: "Irrigation with ESPHome device"
trigger:
platform: event
event_type: smart_irrigation_start
condition:
- condition: numeric_state
entity_id: !input irrigation_zone
above: 0
action:
- service: notify.persistent_notification
data:
message: |
"{{ esphome_name }}"
"{{ esphome_valve }}"
- service: esphome.{{esphome_name}}_set_valve_run_duration
data:
duration: "{{ states(irrigation_time) }}"
valve: "{{ esphome_valve }}"
mode: single
I would like to store the as blueprints I this repo so we can provide them as blueprints in our wiki and in the help page in the UI. That's the best we can do, apart from building automation in the integration itself, since we cannot ship blueprints with the integration itself.
Why not host them in a separate github repository and link to it in the README, Wiki and Blueprints Exchange. A repository would be nice to keep them up to date.
Why separate repo? What's the benefit of that than just storing them in this repo and link to it in the same places?
Ok, we can link to a sub directory?
for sure. I already created a subdir, feel free to make a PR to add the blueprints in there. The esphome one in there is an older one from this thread.
The blueprint for Irrigation unlimited will not work. Because of:
# -------------------------------------------------------------------
# Please see documentation regarding the adjust_time service call.
# Choose an option below. Comment out/delete as needed. This will NOT work as is.
# 1. Adjust a single zone. Change the zone as required
# entity_id: binary_sensor.irrigation_unlimited_c1_z1
# 2. Adjust a sequence. Change the sequence_id as required
# entity_id: binary_sensor.irrigation_unlimited_c1_m
# sequence_id: 1
# -------------------------------------------------------------------
Once I tried to install that. But I failed. I don't understand the concept. Somebody with some knowledge about it should test and correct it.
I will try to install it and see. Thanks for all your hard work!
The solution is so easy. I wonder I didn't saw it. I will make two files.
@jeroenterheerdt the blueprints are all done from my point of view. I can't test them all beside standard and simple scheduler. How to close this [REQ]?
So you're saying you tested standard and simple scheduler? Then I should test the ESPHOME one. That leaves the irrigation unlimited one to be tested still. I can try that as well unless we find someone who wants to do it :) maybe @Kolia56?
We should only call this complete after we tested them.
So you're saying you tested standard and simple scheduler? Then I should test the ESPHOME one. That leaves the irrigation unlimited one to be tested still. I can try that as well unless we find someone who wants to do it :) maybe @Kolia56?
We should only call this complete after we tested them.
Sorry guys, can't it, my system is in production, and I'm running out of time.
No worries, all good. Thanks for your help so far @Kolia56!
@gatonero is there a way for a blueprint to control multiple zones / valves? I have 6 zones and would like all of them to be one 'automation'.
Might be. I will have a look when I'm able to run a beta again.
two issues with the esphome blueprint:
it doesn't set the duration for the valve. Here's a trace:
Executed: September 2, 2023 at 11:13:26 AM Result: params: domain: esphome service: sprinklercontroller_set_valve_run_duration service_data: duration: 30 valve: '' target: {} running_script: false
What the service call requires is is the valve ID. Here's what works for me (of course sprinklercontrloller
is the name of my esphome device):
service: esphome.sprinklercontroller_set_valve_run_duration data: duration: 30 valve: 0
So we need to pass in the Valve ID (which starts with 0 and goes up from there) instead of the name when setting the run duration
it doesn't actually turn on the valve / perform the irrigation. I think we need to call the start single valve
service. Here's what works for me (of course sprinklercontrloller
is the name of my esphome device)
service: esphome.sprinklercontroller_start_single_valve data: valve: 0
again with valve ID.
So three steps:
Or... if we make it simpler, you can pass an optional parameter to start_single_valve
which is run duration, so then we don't need to do the set run duration
step separately. This being esphome, this of course depends on how people set up their services...
Here's my config that provides both services but start single valve
also accepts the run duration, so I think we can remove the separate step from the blueprint and just pass run duration in. Related question: how are we going to educate people about the esphome config that this blueprint expects?
Esphome config:
esphome:
name: sprinklercontroller
friendly_name: sprinklercontroller
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret encryption_key
services:
- service: set_valve_run_duration
variables:
duration: int
valve: int
then:
- sprinkler.set_valve_run_duration:
id: sprinkler_controller
run_duration: !lambda 'return duration;'
valve_number: !lambda 'return valve;'
- service: set_multiplier
variables:
multiplier: float
then:
- sprinkler.set_multiplier:
id: sprinkler_controller
multiplier: !lambda 'return multiplier;'
- service: start_full_cycle
then:
- sprinkler.start_full_cycle: sprinkler_controller
- service: start_single_valve
variables:
valve: int
duration: int
then:
- sprinkler.start_single_valve:
id: sprinkler_controller
valve_number: !lambda 'return valve;'
run_duration: !lambda 'return duration;' #optional
- service: next_valve
then:
- sprinkler.next_valve: sprinkler_controller
- service: previous_valve
then:
- sprinkler.previous_valve: sprinkler_controller
- service: shutdown
then:
- sprinkler.shutdown: sprinkler_controller
ota:
password: !secret OTA_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.1.224
gateway: !secret gateway
subnet: !secret subnet
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Sprinklercontroller"
password: !secret fallback_hotspot_password
captive_portal:
switch:
- platform: gpio
pin: 5
id: lawn_sprinkler_valve_sw1
- platform: gpio
pin: 4
id: lawn_sprinkler_valve_sw2
- platform: gpio
pin: 0
id: lawn_sprinkler_valve_sw3
- platform: gpio
pin: 14
id: lawn_sprinkler_valve_sw4
- platform: gpio
pin: 12
id: lawn_sprinkler_valve_sw5
- platform: gpio
pin: 13
id: lawn_sprinkler_valve_sw6
sprinkler:
- id: sprinkler_controller
main_switch: "Sprinklers"
auto_advance_switch: "Sprinklers Auto Advance"
valve_overlap: 5s #overlap to avoid banging. maybe use valve_open_delay instead?
multiplier_number: "Sprinklers Multiplier" #s
repeat_number: "Sprinklers Repeat" #s
valves:
- valve_switch: "Zone 1"
enable_switch: "Enable Zone 1"
run_duration_number: "Zone 1 Run Duration" #s
valve_switch_id: lawn_sprinkler_valve_sw1
- valve_switch: "Zone 2"
enable_switch: "Enable Zone 2"
run_duration_number: "Zone 2 Run Duration" #s
valve_switch_id: lawn_sprinkler_valve_sw2
- valve_switch: "Zone 3"
enable_switch: "Enable Zone 3"
run_duration_number: "Zone 3 Run Duration" #s
valve_switch_id: lawn_sprinkler_valve_sw3
- valve_switch: "Zone 4"
enable_switch: "Enable Zone 4"
run_duration_number: "Zone 4 Run Duration" #s
valve_switch_id: lawn_sprinkler_valve_sw4
- valve_switch: "Zone 5"
enable_switch: "Enable Zone 5"
run_duration_number: "Zone 5 Run Duration" #s
valve_switch_id: lawn_sprinkler_valve_sw5
- valve_switch: "Zone 6"
enable_switch: "Enable Zone 6"
run_duration_number: "Zone 6 Run Duration" #s
valve_switch_id: lawn_sprinkler_valve_sw6
sensor:
- platform: template
name: "Sprinkler Time Remaining Active Valve"
lambda: |-
if (id(sprinkler_controller).time_remaining_active_valve().has_value()) {
// the controller is running, print the number of seconds remaining
return id(sprinkler_controller).time_remaining_active_valve().value();
} else {
// the controller is NOT running
return 0;
}
update_interval: 5s
unit_of_measurement: "s"
- platform: template
name: "Sprinkler Time Remaining Current Operation"
lambda: |-
return id(sprinkler_controller).time_remaining_current_operation();
update_interval: 5s
unit_of_measurement: "s"
- platform: template
name: "Sprinkler Total Queue Time"
lambda: |-
return id(sprinkler_controller).total_queue_time();
update_interval: 5s
unit_of_measurement: "s"
- platform: template
name: "Sprinkler Total Cycle Time Enabled Incomplete Valves"
lambda: |-
return id(sprinkler_controller).total_cycle_time_enabled_incomplete_valves();
update_interval: 5s
unit_of_measurement: "s"
- platform: template
name: "Sprinkler Total Cycle Time Enabled Valves"
lambda: |-
return id(sprinkler_controller).total_cycle_time_enabled_valves();
update_interval: 5s
unit_of_measurement: "s"
- platform: template
name: "Sprinkler Total Cycle Time All Valves"
lambda: |-
return id(sprinkler_controller).total_cycle_time_all_valves();
update_interval: 5s
unit_of_measurement: "s"
with this I can call:
service: esphome.sprinklercontroller_start_single_valve
data:
valve: 0
duration: 30
to turn on valve ID 0 for 30 seconds in one service call.
Might be. I will have a look when I'm able to run a beta again.
still no luck? I pushed a new beta version, I am wondering if that magically shows up for you
by the way, I am not going to install irrigation unlimited. that is a very complicated solution to what should be a very simple problem. So I guess we just ship it without testing or we don't provide the blueprint
I'm getting very short in time. Wednesday I will leaf for vacations. and will return one week later. Today I lost the complete day because of the download beta issue.
So I will do all or as much I'm able to do you pointed out after my vacation.
For Irrigation Unlimited we shouldn't deliver it but maybe discuss it in the forum and deliver it when its running.
Hey, I just saw your debatte. I am building up my smart irrigation solution at the moment and do betatesting on HAsmartirrigation and using Irrigation Unlimited for my Zone management. If you like to i can test the Blueprint.
Hey, I just saw your debatte. I am building up my smart irrigation solution at the moment and do betatesting on HAsmartirrigation and using Irrigation Unlimited for my Zone management. If you like to i can test the Blueprint.
Yes please! Feel free to test and edit! Thanks!
@gatonero I have finalized my automation for esphome and Smart Irrigation. This is it:
alias: Smart Irrigation
trigger:
- platform: event
event_type: smart_irrigation_start_irrigation_all_zones
condition:
- condition: state
entity_id: input_boolean.irrigation_enabled
state: "on"
action:
- if:
- condition: template
value_template: >-
{{states('input_number.number_of_days_since_last_irrigation')<states('input_number.irrigate_every')}}
then:
- service: input_number.increment
data: {}
target:
entity_id: input_number.number_of_days_since_last_irrigation
else:
- repeat:
for_each:
- sensor: sensor.smart_irrigation_lawn_main_deck_sensors
vid: 0
zid: 1
- sensor: sensor.smart_irrigation_lawn_tree
vid: 1
zid: 2
- sensor: sensor.smart_irrigation_lawn_office
vid: 2
zid: 3
- sensor: sensor.smart_irrigation_herbs
vid: 3
zid: 4
- sensor: sensor.smart_irrigation_greenhouse
vid: 4
zid: 5
- sensor: sensor.smart_irrigation_side_house
vid: 5
zid: 6
sequence:
- if:
- condition: template
value_template: >-
{{state_attr(repeat.item.sensor,'State')=='disabled' or
states(repeat.item.sensor)|int()==0}}
then:
- service: switch.turn_off
target:
entity_id: >-
{{'switch.sprinklercontroller_enable_zone_'+repeat.item.zid|string()}}
data: {}
else:
- service: switch.turn_on
target:
entity_id: >-
{{'switch.sprinklercontroller_enable_zone_'+repeat.item.zid|string()}}
data: {}
- service: esphome.sprinklercontroller_set_valve_run_duration
data:
duration: "{{states(repeat.item.sensor)}}"
valve: "{{repeat.item.vid}}"
- service: esphome.sprinklercontroller_start_full_cycle
data: {}
- service: smart_irrigation.reset_all_buckets
data: {}
- service: input_number.set_value
data:
value: 0
target:
entity_id: input_number.number_of_days_since_last_irrigation
mode: single
As you can tell it's very custom to my install. My Esphome code is as in this reply: https://github.com/jeroenterheerdt/HAsmartirrigation/issues/170#issuecomment-1703907568 (ignore the rest of that reply).
what this automation does is:
number_of_days_since_last_irrigation
counter is small than the target. if so, only increment that counter.duration == 0
check is necessary because otherwise Esphome will ignore it and set the duration to what is configured in the Esphome config.zid
.vid
.The reason I changed to full_cycle is because of overlap time I can configure in esphome that reduce on/off 'clanking' on the pipes. We don't have that capability in Smart Irrigation. Now, this is all pretty complex and not sure how much of this can be represented in a blueprint, but that's where I am going to depend on you :)
Thanks a lot for this working automation. It helps me a lot. The problem is to get the pairs sensor, vid and zid together in a blueprint. Before Smart Irrigation I never fiddled with blueprints. So I will learn a lot.
For publishing v2.0 we shouldn't wait until all blueprints complete. They are a nice to have and don't interfere with the functionality of Smart Irrigation.
Hello,
So i tested the unlimited blueprints.
And im still in Debugging Mode. I already know what is not working but i dont understand HA Scripting to tell you how to fix it.
Lets start with the Single Zone Blueprint:
action:
- service: irrigation_unlimited.adjust_time
data:
actual: "{{ timedelta(seconds=states('duration') | int(0)) }}"
# 1. Adjust a single zone.
entity_id: !input unlimited_zone
mode: single
actual: "{{ timedelta(seconds=states('duration') | int(0)) }}"
should be the Time calculated for a Zone in HAsmartirrigation.
Something like valueof(smart_irrigation_smart_irrigation_zone_1) but i dont know how to do that, maybe you guys know. Otherwise the Blueprint is really great.
Going on testing the other ones. Maybe to give you the Idea, you set the Duration in Unlimited to zero, and then after the duration for the Zone is done in HAsmartit is taken over to Unlimited, If i then run it (manuelly or over the programm automaticly) i will reset the bucket over an automation.
Thanks a lot for this working automation. It helps me a lot. The problem is to get the pairs sensor, vid and zid together in a blueprint. Before Smart Irrigation I never fiddled with blueprints. So I will learn a lot.
For publishing v2.0 we shouldn't wait until all blueprints complete. They are a nice to have and don't interfere with the functionality of Smart Irrigation.
I agree it is nice to have. Maybe create a place for automations as well? Mine can go in there with some explanation? Yours? Anything that can help get started is worth it
Hello,
So i tested the unlimited blueprints.
And im still in Debugging Mode. I already know what is not working but i dont understand HA Scripting to tell you how to fix it.
Lets start with the Single Zone Blueprint:
action: - service: irrigation_unlimited.adjust_time data: actual: "{{ timedelta(seconds=states('duration') | int(0)) }}" # 1. Adjust a single zone. entity_id: !input unlimited_zone mode: single
actual: "{{ timedelta(seconds=states('duration') | int(0)) }}"
should be the Time calculated for a Zone in HAsmartirrigation.Something like valueof(smart_irrigation_smart_irrigation_zone_1) but i dont know how to do that, maybe you guys know. Otherwise the Blueprint is really great.
Going on testing the other ones. Maybe to give you the Idea, you set the Duration in Unlimited to zero, and then after the duration for the Zone is done in HAsmartit is taken over to Unlimited, If i then run it (manuelly or over the programm automaticly) i will reset the bucket over an automation.
Hey, doesn't states(sensor. smart_irrigation_zone_1)
work?
Not sure I understand your comment about unlimited, but it sounds interesting! Can you please explain?
I wrote this blueprint accordingly to https://github.com/rgc99/irrigation_unlimited#92-hasmartirrigation. The value for duration
is taken from the input which is sensor.smart_irrigation_[zone_name]
stored in duration
.
ship blueprints in-box: