Home-Assistant – Control Philips Hue HDMI Sync Box

My first tech blog on my new blog, yay! I’m starting with something that i’ve implemented myself very recently. I’ve had Philips Hue stuff in the entire house for years already and wanted to add some ambilight to my main television. After considering a TV upgrade i found the Philips Hue HDMI Sync Box, which adds ambilight to any TV that has HDMI input for the sources.

My home is controlled entirely by Home-Assistant and Node-Red to make everything automated and as easy as possible, so i wanted to add my ambilight setup, but found there was no native support for the Sync Box in the Home-Assistant Hue integration. After some more digging i found out that there is an official API for the Sync Box.
The result after a weekend of Postman, testing and implementing this is how it looks right now :

In Home-Assistant i’m able to select the input mode for the HDMI Sync Box and it also reflects the current state by polling the API and making sure the select-box is on the right value.
Next to that i’ve made two sensors that poll the Syncbox’s state from the API :

This combined makes it really easy to control the Syncbox from within Home-Assistant and Node-Red. Below you will find a guide to set it up.

Step 1 :

Make sure to register an app on the Syncbox API, this will get you a Bearer token that you need for all the requests.
Every step is described on Philips Hue Developer Portal, but this is it in a few simple steps.
Run this curl command to register yourself :

curl -k -d ‘{“appName”:”curl”, “instanceName”:”<Your App Name>”}’ -X POST https://<ip>/api/v1/registrations

If you run this command the first time it will give you “Invalid State” as response. Hold the button on the front of the Syncbox until it blinks green and rerun the above command within 5 seconds of that. Now it will return your new token. Please store this token somewhere safe.

Step 2 :

Now the fun part begins, as we will add some information to Home-Assistant. Below is my Gitlab Snippet with all the code you need.

You need to replace <IP> with the ip address of your Hue SyncBox and replace <TOKEN> with your own token that you’ve created in Step 1. The code creates 2 sensors (one template sensor), 5 rest_commands and 1 input_select (for front-end control of the syncbox).

Step 3 :

After saving the configuration on your Home-Assistant instance, restart Home-Assistant. After the restart you should have all the newly created entities ready. The sensor.syncbox and sensor.syncbox_mode should show the actual state of your Hue Syncbox.

In your frontend make sure to add the input_select.ambilight_mode to be able to control the syncbox.

Step 4 :

Finally, we will make sure Node-Red handles state changes in the frontend and in the Syncbox.
This looks like this in Node-Red :

Please fetch the JSON from my Gitlab snippet here and import it in Node-Red (Click the top right hamburger menu and click import).

Done!

You should be done and your Philips Hue HDMI Sync box should now fully work in Home-Assistant. If you want to debug some of the API calls i can highly recommend Postman.
Thanks so much for ste.luci for inspiring me on the Home-Assistant forums.

See you in the next blog!

Laat een reactie achter

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

*

code