Need help. How to set up - Command line switch with Curl to post json to MQTT Notification


I would like to use the curl command in command line switch. However, since the curl command contains both " and ', it didn’t seem to work.

Can you suggest how to set this in command line switch?

By the way, when I use curl command in RPI3, it’s working fine.

curl command:
curl -X POST -H “x-ha-access: MY_PASSWORD” -H “Content-Type: application/json” -d ‘{“payload”: “ZERO”, “topic”: “MQTT_TOPIC”}’ https://MY_IP_ADDRESS/api/services/mqtt/publish

command_on: “curl command”
command_off: “curl command”
friendly_name: Rolled Blind Zero

You can escape the double quotes. Here is one that works for me (it’s not a post, but it gets the idea across)

command_on: “/usr/bin/curl -s --connect-timeout 5 \“\””