Thanks for that, I was trying to make it work via the HA UI, I know most people prefer to do it yaml and it looks like I need to go the same way.
The automation and script UI needs some love to bring it up to speed. For example duplication of actions/coditions, re-arranging actions and duplication of entire automations/scripts.
Yeah, it’s pretty bad. I don’t think many people use it. Only beginners usually. I suggest learning yaml. You’ll have headaches at first, but once it clicks it becomes second nature.
So I couldn’t get your example to work so I read the docs and came up with the following which works great. Notice the delay between one Alexa TTS and the other so they don’t cut each other off:
'1533219231046':
alias: Plant Moisture
sequence:
- data:
message: The moisture is {{states.sensor.calatha_orbifolia_moisture.state}}
percent.
service: notify.downstairs_dot
- below: '15'
condition: numeric_state
entity_id: sensor.calatha_orbifolia_moisture
- delay: 00:00:2
- data:
message: You really should think about watering it.
service: notify.downstairs_dot
assuming your “current_position” returns something that can be converted to a number (no symbols such as %, etc) then this should work:
value_template: "{{ state_attr('cover.tapparella_studio', 'current_position') | int <= 25 }}"
and you don’t need to use “data_template:” in your action service call. “data:” will work since you aren’t aren’t actually using a template in that section.
So if the value_template for cover.tapparella_soggiorno evaluates to false, the script ends processing there and won’t continue to check the other conditions for cover.tapparella_studio and cover.tapparella_stanza_di_adele.
Based on your response, I’m going to assume you were not aware of how conditions work in a script. Therefore the answer to your original question is that there was nothing wrong with the condition’s template. The problem was the script never processed it because it halted execution at the previous condition (that had evaluated to false).
Scripts are a sequence of instructions. Script processing stops at the first condition that evaluates to false. Scripts do not have flow-control like ‘if this is true then do something else do other thing’.
Your script contains a long sequence of checking the position of several covers and moving them if required. I suggest you create separate automations to handle each cover. The script calls each automation. That’s what you’re already doing at the beginning of the script (calling other automations).
Alternately, you can create a python_script to replace parts of your script (perhaps just the parts handling the covers) or even the entire script. A python_script provides more flexibility and control than a script.