Hi guys, I need some help.
I’m trying to simplify the customization of a file which is full of curl commands addressed to a single ip. So, I was trying to use an input_text variable to change the ip address only one time in the case I had to change it.
This is the input_text:
input_text:
server_ip_address:
name: Server Ip Address
initial: http://192.168.1.180/
and this is an example of a virtual switch:
switch:
platform: command_line
switches:
server_switch:
command_on: "curl {{ states('input_text.server_ip_address')}}on_command"
command_off: "curl {{ states('input_text.server_ip_address')}}off_command"
friendly_name: Server Switch
If I copy my lines into the jinja the templates editor they got rendered correctly like this:
switch:
platform: command_line
switches:
server_switch:
command_on: "curl http://192.168.1.180/on_command"
command_off: "curl http://192.168.1.180/off_command"
friendly_name: Server Switch
but when i try to use them, they do not work. Should I change something in your opinion?
(the switch works fine without templating)
Thank you,
Max