Hello, I need some help on this one. My goal is to call this script, get a number back and then adjust the covers positions.
I started like this and it works as expected:
alias: Cover position
sequence:
- variables:
response:
position: 1
- stop: Returns variable successfully
response_variable: response
mode: single
icon: mdi:window-shutter-auto
Now I want to perform some checks and change the value based on conditions, a simple one:
alias: Cover position
sequence:
- variables:
response:
position: 1
- if:
- condition: template
value_template: "{{ 1 == 1}}"
then:
- variables:
response:
position: 50
- stop: Fails to return the updated variable
response_variable: response
- stop: Returns variable successfully
response_variable: response
And the response is empty:
When I remove the stop inside the If, the returned value will be 1 since the Stop is in another block and the variable value won’t be available.
When leaving only the stop inside the If it also returns empty.
By adding a step to send a notification, the updated variable appears correctly but the response remains empty:
alias: Cover position
sequence:
- variables:
response:
position: 1
- if:
- condition: template
value_template: "{{ 1 == 1}}"
then:
- variables:
response:
position: 50
- service: notify.persistent_notification
data:
message: "{{response.position}}"
- stop: Fails to return the updated variable
response_variable: response
So, is there any way to make this work? It seems that the stop fails to get the correct variable whenever I add any Choose or If even when it’s nested together or I’m missing something.
Thanks in advance