I try to work with a value in a Response Variable, but I don’t get it to work.
I define a variable called status in an automation, send the command and this is the result as found under Traces > Changed variables:
status:
results:
- device_id: xxx
device_name: OpenWrt1
success: true
command: ubus call network.interface.wg_wan status
stdout:
- '{'
- "\t\"up\": false,"
- "\t\"pending\": false,"
- "\t\"available\": true,"
- "\t\"autostart\": false,"
- "\t\"dynamic\": false,"
- "\t\"proto\": \"wireguard\","
- "\t\"data\": {"
- "\t\t"
- "\t}"
- '}'
stderr: []
code: 0
I just need the boolean value of up checked, something like this:
{{ status['stdout']['\t\"up\'] == false }}
Then I would set a switch accordingly and/or send out a command to up the interface.
But I’m a bit confused how to handle all those \ and " in the response - obviously not like this - but I tried several variants but to no success. Can somebody point me in the right direction ![]()