Those conditions are and-ed, so the id from above has to match the condition below. When the trigger above is ‘segudo’, then for that to trigger the entity has to be outside of the 1.9-2.1 range. Make sure that is the case.
Also I feel adding conditions to the default is weird. I usually code so that default has a way to handle everything else, and not condition it.
I’m thinking (without having the whole code base) that you are double checking things and some of the logic is broken.
If you want a better answer, edit that and put the whole automation in there.
I’m sorry, I did not understand you.
I manage to “force” a solution and now it is working. I use a “stop” action as default. So if the conditions are not met, it just stops.
the idea fo this automations is to have the variables in the UI, so its possible to modify it with helpers.
The three triggers are input_datetime for selecting 3 hours
The first “choose” is to select how many times a day irrigation starts. (1, 2 or 3 times a day)
The second is to select Monday to Sunday, based in sliders.
Do you think there is a prettier way to do this?
Any ideas are welcome.
If the goal is to have the first Choose act as conditional logic to determine whether the second Choose runs, you should be using the conditions block, not a Choose action.
alias: Riego Z1
description: ""
triggers:
- trigger: time
at: input_datetime.hora1_z1
id: 1
- trigger: time
at: input_datetime.hora2_z1
id: 2
- trigger: time
at: input_datetime.hora3_z1
id: 3
conditions:
- condition: template
value_template: |
{{ states('input_number.veces_z1') | int(0) >= trigger.id | int(0) }}
- alias: Prueba si el input_boolean para hoy tiene el estado "on"
condition: template
value_template: |
{% set dias_abbrev = ['lun', 'mar', 'mie', 'jue', 'vie', 'sab', 'dom']%}
{% set ent = 'input_boolean.'~ dias_abbrev[now().weekday()] ~'_z1' %}
{{ is_state(ent, 'on') }}
actions:
- action: switch.turn_on
metadata: {}
data: {}
target:
entity_id: switch.z1
- delay: 00:{{ states('input_number.duracion_z1') | int }}:00
- action: switch.turn_off
metadata: {}
data: {}
target:
entity_id: switch.z1
mode: restart
I’ve made a couple changes in my earlier post because I think there was a flaw in the logic of the conditions you originally had, but I may be misunderstanding the bigger picture… so check my reasoning before making any changes.
From what you have said:
The value of input_number.veces_z1 is the number of times the irrigation should be allowed to run.
Assuming that the datetime Helpers always occur following the sequence 1, 2, 3.
If input_number.veces_z1 has a state of “2.0”, then the condition group you had in your original config for the first run of the irrigation…
Hi!. I’m sorry for the late answer. I saw the first “mistake” in the logic, so I fixed it easily.
The template works great. That was my idea at the beginning, but I was not able to write the template… I’m more a “hardware guy” haha.
Thanks for the support!