Add example for MQTT publish service

This commit is contained in:
Fabian Affolter 2017-05-30 10:32:19 +02:00
parent 243a1efa74
commit b2bff736fc
No known key found for this signature in database
GPG Key ID: DDF3D6F44AAB1336

View File

@ -413,7 +413,9 @@ Returns a list of states that have changed while the service was being executed.
] ]
``` ```
Sample `curl` command: Sample `curl` commands:
Turn the light on:
```bash ```bash
$ curl -X POST -H "x-ha-access: YOUR_PASSWORD" \ $ curl -X POST -H "x-ha-access: YOUR_PASSWORD" \
@ -422,6 +424,16 @@ $ curl -X POST -H "x-ha-access: YOUR_PASSWORD" \
http://localhost:8123/api/services/switch/turn_on http://localhost:8123/api/services/switch/turn_on
``` ```
Send a MQTT message:
```bash
$ curl -X POST \
-H "Content-Type: application/json" \
-H "x-ha-access:YOUR_PASSWORD" \
-d '{"payload": "OFF", "topic": "home/fridge", "retain": "True"}' \
http://localhost:8123/api/services/mqtt/publish
```
<p class='note'> <p class='note'>
The result will include any states that changed while the service was being executed, even if their change was the result of something else happening in the system. The result will include any states that changed while the service was being executed, even if their change was the result of something else happening in the system.
</p> </p>