I’m trying to call a http_request.post within a script that should address a JSON key into the fabulous WLED API. Now with endless attempts I’m stuck, not knowing what to do next.
If I understand the WLED api well (described here), a post request in JSON shall look like, for example:
{"seg":[{"on":[[0,true]]}]}
This example should turn on the first segment (#0) in a LED strip.
When embedding this in the http_request it looks like:
# Setup HTTP request component
http_request:
# useragent: esphome/device
# timeout: 10s
script:
id: ondownup
then:
- http_request.post:
url: http://192.168.1.61/json
headers:
Content-Type: application/json
json:
key: {"seg":[{"on":[[0,true]]}]}
verify_ssl: false
I am obviously not a crack in this, but hope that someone can give me insight why this won’t go. ESPhome gives the message that this shall be a string (as in within quotes), however, that seems not to work.