So, just to clarify, your problem is now solved ?
You can set the ‘enabled’ attribute to either True or False as you wish ?
Yes, It’s solved.
The key was to compare with True/False with first capital letter and without quotes:
{{ state_attr('binary_sensor.irrigation_unlimited_c1_z1', 'enabled') == False }}
When I finish writing the script, I’ll post here for completion.
Thanks!
This is the final code:
In the configuration.yaml
:
irrigation_unlimited:
granularity: 10
controllers:
- name: 'Riego pueblo'
enabled: true
zones:
- name: 'Zona 1'
enabled: true
entity_id: 'switch.sonoff_1000caea2e_1'
schedules:
- name: 'Primavera'
time:
sun: 'sunrise'
after: '01:00'
duration: '00:05'
month: [mar, apr, may]
- name: 'Zona 2'
enabled: true
entity_id: 'switch.sonoff_1000caea2e_2'
schedules:
- name: 'Primavera'
time:
sun: 'sunrise'
after: '01:05'
duration: '00:05'
month: [mar, apr, may]
And the script:
alias: 'Pueblo:riego manual completo'
sequence:
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c1_z1',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c1_z1
time: >-
{{ ((states("input_number.temporizador_riego_manual_pueblo") |
float * 60.0) | int) | timestamp_custom("%H:%M", False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c1_z1
from: 'on'
to: 'off'
default: []
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c1_z2',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c1_z2
time: >-
{{ ((states("input_number.temporizador_riego_manual_pueblo") |
float * 60.0) | int) | timestamp_custom("%H:%M", False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c1_z2
from: 'on'
to: 'off'
default: []
I call the manual irrigation with a button in Lovelace:
- type: button
tap_action:
action: call-service
service: script.pueblo_riego_manual_completo
service_data: {}
target: {}
icon_height: 42px
icon: 'mdi:gesture-tap'
name: Riego manual
I’ve updated the script to be able to use the same button to start and cancel manual irrigation:
alias: 'Pueblo:riego manual completo'
sequence:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.irrigation_unlimited_c1_m
state: 'off'
sequence:
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c1_z1',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c1_z1
time: >-
{{
((states("input_number.temporizador_riego_manual_pueblo")
| float * 60.0) | int) | timestamp_custom("%H:%M",
False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c1_z1
from: 'on'
to: 'off'
default: []
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c1_z2',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c1_z2
time: >-
{{
((states("input_number.temporizador_riego_manual_pueblo")
| float * 60.0) | int) | timestamp_custom("%H:%M",
False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c1_z2
from: 'on'
to: 'off'
default: []
- conditions:
- condition: state
entity_id: binary_sensor.irrigation_unlimited_c1_m
state: 'on'
sequence:
- service: irrigation_unlimited.cancel
data:
entity_id: binary_sensor.irrigation_unlimited_c1_m
default: []
mode: restart
icon: 'mdi:sprinkler'
Hi miguelpucela,
irrigation_unlimited.cancel doesn’t work for me.
The service doesn’t even exist.
What does the +2: 00 mean?
The next problem is, input_number is set to 0 and irrigation starts anyway for 1 min.
And watering always starts a minute later after I hit the start button.
Is that normal?
I have not defined any Shedules, I just want to start the whole thing manually with a small delay of 3 seconds between the starts of the zones.
irrigation_unlimited:
controllers:
- name: "Schwiegereltern"
zones:
- name: "Einfahrt"
entity_id: "input_boolean.iu_zone_1"
- name: "Eingang"
entity_id: "input_boolean.iu_zone_2"
- name: "Streifen Hauswand"
entity_id: "input_boolean.iu_zone_3"
- name: "Streifen Nachbar"
entity_id: "input_boolean.iu_zone_4"
Hi miguelpucela,
I’ve got it now.
“irrigation_unlimited.cancel doesn’t work for me.”
You installed the beta.
I run the scheduler using the Scheduler add-on, it works really well.
The problem with the input_number still exists.
- And watering always starts a minute later after I hit the start button.
Is that normal? - How can i change the delay between zone starts?
1 minute is too long.
If the time is 0 seconds should the watering not start.
Yes, I’m using last beta version.
The problems you have may be related to granularity parameter in configuration. I have it set to 10 (seconds). The default value is 60, so the watering starts on the next minute. If you want to start in the momment you press the button, set it to 1.
I don’t know why you need a manual run of 0.0 minutes. I have a minimum time of 1, when defining the input_number
.
The +2:00 is your timezone (daily saving time in Europe).
Thanks, it worked really well.
I have 2 controllers, a total of 9 zones.
How can I implement this in the script?
Can I just copy the second controller below?
I have one more question …
How can I turn individual zones on and off?
Thanks.
For the second controller, the best solution is to replicate the script, as you only have 2.
For the individual zones, making 9 scripts is not the most elegant solution. It’s better to make it with templates.
Try this:
You need to define the next helpers:
-
input_text.zone
: the zone you’re dealing with. -
input_number.manual_irrigation_timer_controller1
,input_number.manual_irrigation_timer_controller2
: with these two input numbers you control the time of the zone belonging to the corresponding controller. In this way you can make parallel manual irrigations of two zones belonging to different controllers at the same time or even parallel manual irrigations of zones of the same controller by adjusting the corresponding input number after starting each manual irrigation. -
input_number.manual_irrigation_timer
: in the script this gets the value ofinput_number.manual_irrigation_timer_controller1
orinput_number.manual_irrigation_timer_controller2
.
This is the script you need:
alias: Individual zone manual irrigation
sequence:
- service: input_text.set_value
data_template:
value: '{{ zone }}'
target:
entity_id: input_text.zone
- service: input_number.set_value
data_template:
value: '{{ states("input_number.manual_irrigation_timer_" + controller) }}'
target:
entity_id: input_number.manual_irrigation_timer
- choose:
- conditions:
- condition: template
value_template: >-
{{ states("binary_sensor.irrigation_unlimited_" +
states("input_text.zona")) == 'off' }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: >-
{{ "binary_sensor.irrigation_unlimited_" +
states("input_text.zona") }}
time: >-
{{ ((states("input_number.manual_irrigation_timer") | float *
60.0) | int) | timestamp_custom("%H:%M", False) }}
- conditions:
- condition: template
value_template: >-
{{ states("binary_sensor.irrigation_unlimited_" +
states("input_text.zone")) == 'on' }}
sequence:
- service: irrigation_unlimited.cancel
data_template:
entity_id: >-
{{ "binary_sensor.irrigation_unlimited_" +
states("input_text.zone") }}
default: []
mode: parallel
icon: 'mdi:sprinkler'
max: 10
Finally, to make use of that script, in Lovelace you have to place the two sliders corresponding to each input_number
, and a button for each zone. In my case, for each zone I have a horizontal stack with two buttons, one to enable/disable zone and another one to toggle manual irrigation of zone. For instance, for z1_c1:
type: horizontal-stack
cards:
- type: button
tap_action:
action: call-service
service: irrigation_unlimited.toggle
service_data:
entity_id: binary_sensor.irrigation_unlimited_c1_z1
target: {}
name: Activar/Desactivar zona 1
icon_height: 40px
icon: 'mdi:toggle-switch'
show_state: false
- type: button
tap_action:
action: call-service
service: script.individual_zone_manual_irrigation
service_data:
zone: c1_z1
lugar: controller1
target: {}
icon_height: 40px
icon: 'mdi:gesture-tap'
name: Manual irrigation zone 1
entity: binary_sensor.irrigation_unlimited_c1_z1
Hope this works for you.
Hi,
i have a little problem with the script.
If the watering is running for both controllers one after the other, I can no longer stop it completely.
Either only the first controller stops and the second starts up. Or if I press it again the second one goes off and the first controller goes on.
When the cycle is running, I want both controllers to go off when I press it.
Is that possible?
Thank you.
alias: IU Start Bewässerung
sequence:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.irrigation_unlimited_c1_m
state: 'off'
sequence:
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c1_z1',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c1_z1
time: >-
{{ ((states("input_number.iu_zone_1_run_time") | float *
60.0) | int) | timestamp_custom("%H:%M", False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c1_z1
from: 'on'
to: 'off'
default: []
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c1_z2',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c1_z2
time: >-
{{ ((states("input_number.iu_zone_2_run_time") | float *
60.0) | int) | timestamp_custom("%H:%M", False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c1_z2
from: 'on'
to: 'off'
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c1_z3',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c1_z3
time: >-
{{ ((states("input_number.iu_zone_3_run_time") | float *
60.0) | int) | timestamp_custom("%H:%M", False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c1_z3
from: 'on'
to: 'off'
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c1_z4',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c1_z4
time: >-
{{ ((states("input_number.iu_zone_4_run_time") | float *
60.0) | int) | timestamp_custom("%H:%M", False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c1_z4
from: 'on'
to: 'off'
default: []
- conditions:
- condition: state
entity_id: binary_sensor.irrigation_unlimited_c1_m
state: 'on'
sequence:
- service: irrigation_unlimited.cancel
data:
entity_id: binary_sensor.irrigation_unlimited_c1_m
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.irrigation_unlimited_c2_m
state: 'off'
sequence:
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c2_z1',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c2_z1
time: >-
{{ ((states("input_number.iu_zone_5_run_time") | float *
60.0) | int) | timestamp_custom("%H:%M", False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c2_z1
from: 'on'
to: 'off'
default: []
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c2_z2',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c2_z2
time: >-
{{ ((states("input_number.iu_zone_6_run_time") | float *
60.0) | int) | timestamp_custom("%H:%M", False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c2_z2
from: 'on'
to: 'off'
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c2_z3',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c2_z3
time: >-
{{ ((states("input_number.iu_zone_7_run_time") | float *
60.0) | int) | timestamp_custom("%H:%M", False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c2_z3
from: 'on'
to: 'off'
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c2_z4',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c2_z4
time: >-
{{ ((states("input_number.iu_zone_8_run_time") | float *
60.0) | int) | timestamp_custom("%H:%M", False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c2_z4
from: 'on'
to: 'off'
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c2_z5',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c2_z5
time: >-
{{ ((states("input_number.iu_zone_9_run_time") | float *
60.0) | int) | timestamp_custom("%H:%M", False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c2_z5
from: 'on'
to: 'off'
default: []
- conditions:
- condition: state
entity_id: binary_sensor.irrigation_unlimited_c2_m
state: 'on'
sequence:
- service: irrigation_unlimited.cancel
data:
entity_id: binary_sensor.irrigation_unlimited_c2_m
default: []
mode: restart
icon: 'mdi:sprinkler'
You need to make two separate scripts, one for each controller. You’ll need then two buttons to call both scripts independently.
If you want to make a global sequence script, you’ll have to create a condition, to run it if both controllers are off (and then run the sequence of all the zone irrigations), a condition to check if the first controller is on (and then cancel it), and finally a condition to check if the second controller is on (and then cancel it).
The code for the first and
condition is:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.irrigation_unlimited_c1_m
state: 'off'
- condition: state
entity_id: binary_sensor.irrigation_unlimited_c2_m
state: 'off'
Hi,
where do I have to insert the code?
In the existing script?
I want to create a global sequence script.
Unfortunately I have no idea.
I thank you again
Try this:
alias: IU Start Bewässerung
sequence:
- choose:
- conditions:
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.irrigation_unlimited_c1_m
state: 'off'
- condition: state
entity_id: binary_sensor.irrigation_unlimited_c2_m
state: 'off'
sequence:
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c1_z1',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c1_z1
time: >-
{{
((states("input_number.iu_zone_1_run_time")
| float * 60.0) | int) | timestamp_custom("%H:%M",
False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c1_z1
from: 'on'
to: 'off'
default: []
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c1_z2',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c1_z2
time: >-
{{
((states("input_number.iu_zone_2_run_time")
| float * 60.0) | int) | timestamp_custom("%H:%M",
False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c1_z2
from: 'on'
to: 'off'
default: []
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c1_z3',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c1_z3
time: >-
{{
((states("input_number.iu_zone_3_run_time")
| float * 60.0) | int) | timestamp_custom("%H:%M",
False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c1_z3
from: 'on'
to: 'off'
default: []
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c1_z4',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c1_z4
time: >-
{{
((states("input_number.iu_zone_4_run_time")
| float * 60.0) | int) | timestamp_custom("%H:%M",
False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c1_z4
from: 'on'
to: 'off'
default: []
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c2_z1',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c2_z1
time: >-
{{
((states("input_number.iu_zone_5_run_time")
| float * 60.0) | int) | timestamp_custom("%H:%M",
False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c2_z1
from: 'on'
to: 'off'
default: []
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c2_z2',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c2_z2
time: >-
{{
((states("input_number.iu_zone_6_run_time")
| float * 60.0) | int) | timestamp_custom("%H:%M",
False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c2_z2
from: 'on'
to: 'off'
default: []
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c2_z3',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c2_z3
time: >-
{{
((states("input_number.iu_zone_7_run_time")
| float * 60.0) | int) | timestamp_custom("%H:%M",
False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c2_z3
from: 'on'
to: 'off'
default: []
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c2_z4',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c2_z4
time: >-
{{
((states("input_number.iu_zone_8_run_time")
| float * 60.0) | int) | timestamp_custom("%H:%M",
False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c2_z4
from: 'on'
to: 'off'
default: []
- choose:
- conditions:
- condition: template
value_template: >-
{{ state_attr('binary_sensor.irrigation_unlimited_c2_z5',
'enabled') == True }}
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c2_z5
time: >-
{{
((states("input_number.iu_zone_9_run_time")
| float * 60.0) | int) | timestamp_custom("%H:%M",
False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c2_z5
from: 'on'
to: 'off'
default: []
- conditions:
- condition: state
entity_id: binary_sensor.irrigation_unlimited_c1_m
state: 'on'
sequence:
- service: irrigation_unlimited.cancel
data:
entity_id: binary_sensor.irrigation_unlimited_c1_m
- conditions:
- condition: state
entity_id: binary_sensor.irrigation_unlimited_c2_m
state: 'on'
sequence:
- service: irrigation_unlimited.cancel
data:
entity_id: binary_sensor.irrigation_unlimited_c2_m
default: []
mode: restart
icon: 'mdi:sprinkler'
Everything works great.
Thanks again.
Thanx all,
Just started messing around with this integration in HA, having a little issue with the example card for the manual operation from the github readme.md . Overall the card it self works, it displays the basic card graphics, just no data is available for selection. Also pyscript seems to be working. I am getting the below errors in the HA log. Any one have any ideas?
Thanx
mikew
2021-06-13 22:04:08 ERROR (MainThread) [custom_components.pyscript.function] run_coro: got exception Traceback (most recent call last):
File "/config/custom_components/pyscript/eval.py", line 689, in call
raise TypeError(
TypeError: irrigation_unlimited_call_cancel() missing 1 required positional arguments
2021-06-13 22:07:09 ERROR (MainThread) [custom_components.pyscript.file.irrigation_unlimited_service_shim.irrigation_unlimited_call_manual_run] Exception in <file.irrigation_unlimited_service_shim.irrigation_unlimited_call_manual_run> line 108:
time = state.get(time_entity)
^
NameError: name 'input_datetime.irrigation_unlimited_time' is not defined
2021-06-13 22:07:52 ERROR (MainThread) [custom_components.pyscript.file.irrigation_unlimited_service_shim.irrigation_unlimited_list_config] Exception in <file.irrigation_unlimited_service_shim.irrigation_unlimited_list_config> line 39:
data = json.loads(irrigation_unlimited.coordinator.configuration)
^
AttributeError: 'StateVal' object has no attribute 'configuration'
2021-06-13 22:07:57 ERROR (MainThread) [custom_components.pyscript.file.irrigation_unlimited_service_shim.irrigation_unlimited_list_config] Exception in <file.irrigation_unlimited_service_shim.irrigation_unlimited_list_config> line 39:
data = json.loads(irrigation_unlimited.coordinator.configuration)
^
AttributeError: 'StateVal' object has no attribute 'configuration'
2021-06-13 22:20:08 ERROR (MainThread) [custom_components.pyscript.file.irrigation_unlimited_service_shim.irrigation_unlimited_list_config] Exception in <file.irrigation_unlimited_service_shim.irrigation_unlimited_list_config> line 39:
data = json.loads(irrigation_unlimited.coordinator.configuration)
^
AttributeError: 'StateVal' object has no attribute 'configuration'
2021-06-13 22:20:08 ERROR (MainThread) [custom_components.pyscript.file.irrigation_unlimited_service_shim.irrigation_unlimited_list_config] Exception in <file.irrigation_unlimited_service_shim.irrigation_unlimited_list_config> line 39:
data = json.loads(irrigation_unlimited.coordinator.configuration)
^
AttributeError: 'StateVal' object has no attribute 'configuration'
Please make sure you are using at least version 2021.6.3 of Irrigation Unlimited. Also there is a package irrigation_unlimited_controls.yaml
that needs to go into your config/packages
directory and the following in configuration.yaml
if you don’t already have it.
homeassistant:
packages: !include_dir_named packages
thanx that did it!
all good
mikew
Hello! Can anyone help me? I’m trying to make a manual irrigation, but when I click on the lovelace button the Zóna1 turns on for 1 sec, and turns off. Then after 1 sec. the Zóna2 turns on, and after 1sec turns off. and so it continues with Zóna3 and Zóna4. Please help me I’ve been looking for the bug for 3 days.
This is my configuration.yaml:
irrigation_unlimited:
granularity: 1
refresh_interval: 1
controllers:
name: Öntözésvezérlő
preamble: '00:00'
postamble: '00:00'
zones:
- name: 'Zóna1'
entity_id: 'switch.ontoz1'
- name: 'Zóna2'
entity_id: 'switch.ontoz12'
- name: 'Zóna3'
entity_id: 'switch.ontoz13'
- name: 'Zóna4'
entity_id: 'switch.ontoz14'
sequences:
- name: 'Öntözés'
delay: '00:00'
repeat: 1
schedules:
- name: 'Ontozes'
time: '21:46'
zones:
- zone_id: [1]
duration: "00:10"
- zone_id: [2]
duration: "00:10"
- zone_id: [3]
duration: "00:10"
- zone_id: [4]
duration: "00:10"
This is my script:
kezi_ontozes:
alias: Kézi öntözés
sequence:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.irrigation_unlimited_c1_m
state: 'off'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ state_attr(''binary_sensor.irrigation_unlimited_c1_z1'',
''enabled'') == True }} '
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c1_z1
time: '{{ ((states("input_number.Zóna1_run_time")
| float * 1.0) | int) | timestamp_custom("%H:%M", False) }}'
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c1_z1
from: 'on'
to: 'off'
default: []
- choose:
- conditions:
- condition: template
value_template: '{{ state_attr(''binary_sensor.irrigation_unlimited_c1_z2'',
''enabled'') == True }} '
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c1_z2
time: '{{ ((states("input_number.ontoz12_run_time")
| float * 1.0) | int) | timestamp_custom("%H:%M", False) }}'
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c1_z2
from: 'on'
to: 'off'
default: []
- choose:
- conditions:
- condition: template
value_template: '{{ state_attr(''binary_sensor.irrigation_unlimited_c1_z3'',
''enabled'') == True }} '
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c1_z3
time: >-
{{ ((states("input_number.Zóna3_run_time")
| float * 60.0) | int) | timestamp_custom("%H:%M", False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c1_z3
from: 'on'
to: 'off'
default: []
- choose:
- conditions:
- condition: template
value_template: '{{ state_attr(''binary_sensor.irrigation_unlimited_c1_z4'',
''enabled'') == True }} '
sequence:
- service: irrigation_unlimited.manual_run
data_template:
entity_id: binary_sensor.irrigation_unlimited_c1_z4
time: >-
{{ ((states("input_number.ontoz14_run_time")
| float * 60.0) | int) | timestamp_custom("%H:%M", False) }}
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.irrigation_unlimited_c1_z4
from: 'on'
to: 'off'
default: []
- conditions:
- condition: state
entity_id: binary_sensor.irrigation_unlimited_c1_m
state: 'on'
sequence:
- service: irrigation_unlimited.cancel
data:
entity_id: binary_sensor.irrigation_unlimited_c1_m
default: []
mode: restart
icon: mdi:sprinkler
And this is lovelace:
type: button
tap_action:
action: toggle
name: Kézi öntözés
show_state: true
entity: script.kezi_ontozes
Thanks for your help!
I recommend you to use the code suggested in the addon in the part manual-run-card:
I’m also having issues with manual irrigation.
Script works and scrapes the controller/line/sequence as you can see on the screenshot below:
But it behaves weirdly. If I select only one line from Controller/Zone dropdown and leave “none” for the Controller/Sequence dropdown it doesn’t start. If I just select Controller/Sequence it does work, but sometimes it lags a lot (clicking cancel stops after 10 sec or so etc.).
Nothing in the Hass log, no errors.
Any ideas where to start debugging this? My config is exactly the same as in your instructions.