tombom
(tom)
January 22, 2024, 3:15pm
1
hi, i am struggling with the curl syntax. i have got it working for calling scripts. but now i am trying to call the webostv.button to control volume on the tv
service: webostv.button
data:
button: VOLUMEUP
entity_id: media_player.lg_oled_c9
but this:
curl -X POST -H "Authorization: Bearer XYZ -H "Content-Type: application/json" -d "{\"service\": \"webostv.button\", \"button: VOLUMEUP\", \"entity_id\": \"media_player.lg_oled_c9\"}" http://hassioIP:8123/api/services/button
only returns a 404
i guess there is jsut a slight(?) mistake in the syntax. maybe sb. could have a look. thank you!
Troon
(Troon)
January 22, 2024, 3:19pm
2
Missed a close-quote before second -H
.
I assume hassioIP
resolves or you’ve replaced the real IP address (pointless for private networks).
I think the URL should be this?
http://hassioIP:8123/api/services/webostv/button
…and I don’t believe you’ll then need the service
within your JSON.
1 Like
tombom
(tom)
January 22, 2024, 3:45pm
3
thanks for the reply!
yes the close-quote got lost editing out the token. Real IP address is being used and works with scripts.
i tried with the amended URL you suggested but now i get
{"message":"Data should be valid JSON."}
so we’re getting closer but as i said i think sth about the json syntax is wrong
thanks nevertheless
"{\"webostv.button\": \"button: VOLUMEUP\", \"entity_id\": \"media_player.lg_oled_c9\"}" http://hassioIP:8123/api/services/webostv/button
returns 400 bad request
"{\"webostv.button\", \"button: VOLUMEUP\", \"entity_id\": \"media_player.lg_oled_c9\"}" http://hassioIP:8123/api/services/webostv/button
retuirns invalid json
koying
(Chris B)
January 22, 2024, 3:54pm
4
Just button:
, so
"{\"button\": \"VOLUMEUP\", \"entity_id\": \"media_player.lg_oled_c9\"}" http://hassioIP:8123/api/services/webostv/button
1 Like
tombom
(tom)
January 23, 2024, 3:41pm
5
that solved it. thank you very much. what an awesome community this is