Introduction
My personal expirience with the Hue Sync Box is pretty cool but it seems it is still not as stabile as it should be. For example if you’re switching between HDR and non HDR content it will become unstable after a while. You can see that because the video signal gets interrupted from time to time which is pretty anoying. The good news is that this can easily be resolved with a reboot but the bad news is that this isn’t supported by the official Hue app by Athom. But as the api of the box supports it, there are ways to still get the job done.
Requirements
Step 1 - Obtain the ip address of the Hue Sync Box
The easiest way is to go into the official Hue Sync app -> settings -> devices -> select your Sync Box and check for the IP-Address. Note: depending on your router settings this address might be dynamic. In that case you’ll need to adapt your flows when this happens or you need to auto-discover your box (out of scope for this tutorial).
Step 2 - Access token
To perform requests to the Sync Box we need to authorize the request which is done by providing an access token. To obtain this we of course using Homey!
-
Create a new flow called ‘register on Hue Sync Box’ with any trigger you like.
-
As action choose “Advanced Rest Client (ARC)” -> “Perform a Request” and use the following options:
- url: https://[your ip address from above]/api/v1/registrations, i.e “https://192.168.50.69/api/v1/registrations”
- http verb: post
- body type: json
- body:
{"appName":"ARC", "instanceName":"Homey"}
- header collection: none
- certificate: none
-
Create another flow card called ‘request performed’ and choose “Advanced Rest Client (ARC)” -> “Request completed” as trigger. As action choose “Simple Log” -> “Add something to the log” and set the “Response Body” token as text.
-
Now you’re ready to perform the actual registration!
- Trigger the first flow card and go the the app “Simple Log” configuration. You now should see something like {“code”:16,“message”:“Invalid State”}
- Now it gets tricky: trigger the flow and within 5 seconds, press the button on the Hue Sync Box until it flashes green. And withing 5 seconds, trigger the flow again.
- Back in the simple log you now should see something like {“registrationId”:"[some number]",“accessToken”:"[some cryptic text]"}
Step 3 - Create custom header collection
Go to the configuration of the “Advanced Rest Client” app -> headers and click “Add Collection”. Give it a name and description. In “New Header Name” put “Authorization” and in “New Header Value” put “Bearer [the cryptic token from above]”. Click “Add Header to Collection” and then “Save” to complete.
Step 4 - Create Reboot flow card
Create a new flow card with any trigger you wish and set “Advanced Rest Client (ARC)” -> “Perform a Request” as action card with the following options:
- url: https://[your ip address from above]/api/v1/registrations, i.e “https://192.168.50.69/api/v1/device”
- http verb: put
- body type: json
- body:
{"action":"doSoftwareRestart"}
- header collection: the one you’ve created in step 3
- certificate: none
Congratulations - you now should be able to reboot your Hue Sync Box!