I have the following script and I’m trying to access the response variable blind_status
in an if block which returns however it always comes back empty. But if I do a stop action outside the if block that seems to work ( it is disabled in the example below) How can I access the blind_status
in my if block?
alias: "[Switchbot] Get Blind Status"
sequence:
- service: script.response_variables_get_blind_device_id
data:
what: "{{what}}"
response_variable: blind
enabled: true
- service: rest_command.switchbot_blind_status
data:
device_id: "{{blind.blind_device_id}}"
response_variable: blind_status
enabled: true
- stop: ""
response_variable: blind_status
enabled: false
- if:
- condition: template
value_template: "{{ attribute == \"response\" }}"
then:
- stop: ""
response_variable: blind_status
- if:
- condition: template
value_template: "{{ attribute == \"battery\" }}"
then:
- variables:
content:
content: "{{blind_status.content.body.battery}}"
enabled: true
- stop: ""
response_variable: content
enabled: true
mode: single
fields:
what:
selector:
text: {}
name: What
required: true
description: >-
kitchen_stove_right, kitchen_stove_left, den_right, den_left,
family_room_right, family_room_left, master_bathroom_right,
master_bathroom_left
attribute:
selector:
select:
options:
- label: Battery
value: battery
- label: Slide Position
value: slidePosition
- label: Response
value: response
name: Attribute
required: true