Syntax error on value_template

hello,

I have this switch

switch:
  - platform: command_line
    switches:
     arest_pin_four:
       command_on: "/usr/bin/curl -X GET http://192.168.1.201/control?cmd=gpio,12,1"
       command_off: "/usr/bin/curl -X GET http://192.168.1.201/control?cmd=gpio,12,0"
       command_state: "/usr/bin/curl -X GET http://192.168.1.201/control?cmd=status,gpio,12"
       value_template: ' {{ ('{"log":"","plugin":1,"pin":12,"mode":"output","state":"1"}'|from_json).state == "1" }} '

from the Template Developer Tool the value_template is resolved correctly into a TRUE, while I get a syntax error when I put the code into configuration.yaml. What am I doing wrong?

You’ve got single quotes both inside and outside the template.

any idea on how to fix it?

value_template: >
   {{ ('{"log":"","plugin":1,"pin":12,"mode":"output","state":"1"}'|from_json).state == "1" }}

thanks! :grinning: