Restful switch error

Create a switch that consumes an api but when trying to associate this switch with a Picture Elements Card, only the ON works, but when you touch it again the Light does not turn off (or execute the body_off command)

Switch:

switch: 
  - platform: rest
    name: dormitorio
    resource: http://192.168.1.117:3000/assistant
    body_on: '{"command": "Encender Luz Dormitorio"}'
    body_off: '{"command": "Apagar Luz Dormitorio"}'
    headers:
      Content-Type: application/json


light:
  - platform: switch
    name: Luz Dormitorio
    entity_id: switch.dormitorio

Picture Elements Card


  - entity: light.luzdormitorio
    image: /local/lightoff.png
    state_filter:
      'off': /local/lightoff.png
      'on': /local/lighton.png
    state_image:
      'on': /local/lighton.png
    style:
      left: 20%
      padding: 10px
      top: 92%
      width: 7%
    tap_action:
      action: toggle
    type: image

If you manually turn it off from the command line with wget/curl does it work?

I don’t know how to do it, could you help me

curl http://192.168.1.117:3000/assistant --header "Content-Type: application/json" --request POST --data '{"command": "Apagar Luz Dormitorio"}'

should emulate turning it off. If it doesn’t work, test if

curl http://192.168.1.117:3000/assistant --header "Content-Type: application/json" --request POST --data '{"command": "Encender Luz Dormitorio"}'

works.

But how do I run that command?

With bash.