Control Shelly TRV window via switch

I have created RESTFul switch using the article below:
https://www.thesmarthomehookup.com/use-the-rest-component-to-add-a-shelly-switch-to-home-assistant/

The switch :

- platform: rest
  name: “Office TRV Door”
  scan_interval: 60
  resource: http://192.168.1.54/window
  body_on: '{"state": "open"}'
  body_off: '{"state": "close"}'
  is_on_template: "{{ value_json.window_open == true}}"
  headers:
    content-type: application/x-www-form-urlencoded

Unfortunately it doesn’t work.
Simple “http://192.168.1.54/window?state=open” in URL in web browser works flawless
Any ideas why the switch doesn’t work?

For anyone trying to achieve the same thing, I got it working using a command_line switch:

switch:
  - platform: command_line
    switches:
      living_room_trv_window_switch:
        command_on: "/usr/bin/curl -X GET http://192.168.178.49/window?state=open"
        command_off: "/usr/bin/curl -X GET http://192.168.178.49/window?state=close"
        command_state: "/usr/bin/curl -X GET http://192.168.178.49/window"
        value_template: "{{ value_json.thermostats[0].window_open }}"
        friendly_name: Living Room Thermostat Open Window Mode
1 Like