Help with a CURL command for SAPHI Philips TV, please

This command works via command line to turn off Ambilight;

curl -X POST -d ‘{“values”:[{“value”:{“Nodeid”:100,“Controllable”:true,“Available”:true,“string_id”:“Ambilight Style”,“icon”:“null”,“data”:{“activenode_id”:110 }}}]}’ http://192.168.0.5:1925/6/menuitems/settings/update

In HASSIO I changed to ‘curl -X POST -d “{“values”:[{“value”:{“Nodeid”:100,“Controllable”:true,“Available”:true,“string_id”:“Ambilight Style”,“icon”:“null”,“data”:{“activenode_id”:110 }}}]}” http://192.168.0.5:1925/6/menuitems/settings/update

BUT, it doesn’t work and throws an error. Any help appreciated!

Please post the error :blush:

Whoops!

Here is the error, not very clear though;

Logger: homeassistant.components.command_line.switch
Source: components/command_line/switch.py:109
Integration: command_line (documentation, issues)
First occurred: 6:33:37 PM (2 occurrences)
Last logged: 6:33:40 PM

  • Command failed: ‘curl -X POST -d “{“values”:[{“value”:{“Nodeid”:100,“Controllable”:true,“Available”:true,“string_id”:“Ambilight Style”,“icon”:“null”,“data”:{“activenode_id”:120 }}}]}” http://192.168.0.5:1925/6/menuitems/settings/update’

If you press the button Full Home assistant Logs at the bottom, you can see more elaborate error messages. :blush:

Actually i think I can see what is wrong. You have to replace the first " with ’ and last " with ’ just af -d like this:

'{"values":[{"value":{"Nodeid":100,"Controllable":true,"Available":true,"string_id":"Ambilight Style","icon":"null","data":{"activenode_id":120}}}]}'

OK, I’ll give it a try. The error log entry is this;

2021-04-07 18:39:51 ERROR (SyncWorker_5) [homeassistant.components.command_line.switch] Command failed: ‘curl -X POST -d “{“values”:[{“value”:{“Nodeid”:100,“Controllable”:true,“Available”:true,“string_id”:“Ambilight Style”,“icon”:“null”,“data”:{“activenode_id”:120 }}}]}” http://192.168.0.5:1925/6/menuitems/settings/update’

No errors now but not working with this;

‘curl -X POST -d ‘{“values”:[{“value”:{“Nodeid”:100,“Controllable”:true,“Available”:true,“string_id”:“Ambilight Style”,“icon”:“null”,“data”:{“activenode_id”:110}}}]}’ http://192.168.0.5:1925/6/menuitems/settings/update’

Why do you want to use curl and command line? :smiley:

It is easier to just use the build in rest_command. Put this in you configuration.yaml

rest_command:
  ambilight_off:
    url: "http://192.168.0.5:1925/6/menuitems/settings/update’"
    method: post
    content_type: "application/json"
    payload: '{"values":[{"value":{"Nodeid":100,"Controllable":true,"Available":true,"string_id":"Ambilight Style","icon":"null","data":{"activenode_id":110}}}]}'

You can then access this service as any other service in HA. (Like lights.turn_off)

This is a much better way then using curl on HA OS (It’s name is not HASSIO any more).

I don’t know why I used it to be honest, I have other switches like that so copied them.

Anyway, your answer works. THANK YOU!

I’ve been trying to control the Ambilights on my TV for around a year now and your solution was the final piece of the jigsaw.

Absolutely brilliant, cheers!

Glad to here it works! And thanks for marking my answer as the solution! :smiley:

1 Like