![]() ![]() ItRnKfqWKnHFGmShPaQ7MDkxCzAJBgNVBAYTAk5MMRQwEgYDVQQKDAtQaGlsaXBz HQ4EFgQUZ2ONTFrDT6o8ItRnKfqWKnHFGmQwdAYDVR0jBG0wa4AUZ2ONTFrDT6o8 JOKkTqOBuTCBtjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNV OTELMAkGA1UEBhMCTkwxFDASBgNVBAoMC1BoaWxpcHMgSHVlMRQwEgYDVQQDDAtyī290LWJyaWRnZTAiGA8yMDE3MDEwMTAwMDAwMFoYDzIwMzgwMTE5MDMxNDA3WjA5 MIICMjCCAdigAwIBAgIUO7FSLbaxikuXAljzVaurLXWmFw4wCgYIKoZIzj0EAwIw Define the folder you want to contain your automation script and add a file named: huebridge_cacert.pem with the following content. Luckily, creating this certificate sounds harder than it actually is. The client has to validate the Hue Bridge certificate against the Signify private CA Certificate for Hue Bridges. If you make calls over HTTPS you will need to use a certificate. For my example, I will use lights the two Hue light bars with the following ids (‘18233658-5cdb-42d1-9b08-588210dsadsaj2’ and ‘18233658-dajji-dsadi-9b08-dsajdsaiuidsa’). All these lights will have the same name corresponding to them as you will see in the Hue app. This will give you a JSON response with all the lights in your system. Call the following URL in postman and add this header: “hue-application-key: j5hvYCkJPN8a87daQ6a0mmxBcG6ozeLp3zXU5lgc “ Postman request Now, all we need to do is create a request to fetch all the lights with our username as a header and find the lights we want to use. Later on, we will use this certificate but during the testing phase with Postman, you will need to make you disable ‘SSL certificate verification’ in File – Settings menu. One part is that v2 of the API only allows calls over HTTPS. Find the lights to automateĪs stated in the introduction, Signify upgraded its security quite a bit. Write this one down as well, we will use it in the next stage. There you go! You now have your authenticated username. "username": "j5hvYCkJPN8a87daQ6a0mmxBcG6ozeLp3zXU5lgc", You should now get a successful response like below: [ ![]() ![]() Now go and press the link button on your bridge and then press the POST button again. Send a post request to the URL the following message body . Now we need to send an authentication request to authenticate ourselves. The easiest way to do this is with Postman. To get this we need to do a couple of calls. Get an authenticated usernameĪs with any other protected system nowadays, the Hue system requires a user to authenticate him or herself. Save this response as we will need it in other steps. The response will look somewhat like this: [ The link will show you a small JSON response with the internal IP address of your bridge. But as we only need the ID and IP of our bridge for now we can also go to this link. The bridge will be the receiver of all our web requests. In the previous version, only the IP address was needed, but for v2 of the Hue API, we need a secure connection that requires the ID. But before we can try anything with our Philips Hue lights we first need to find the ID and IP address of our bridge. Find your bridge ID and IP addressįortunately, the Hue system comes with an API that can be controlled easily through web requests. Toggle Philips Hue Depending on Your PC State 1. IMPORTANT! before following this guide, check if your bridge is at least at version 1948086000.Īutomating is easy, you just need to know which steps to take. I will use two Philips Hue play bars for this tutorial. In this story, I will again explain the basics of programming Hue Lights but this time with cURL and make it runnable for every OS. In my previous story, I explained the basics of programming Hue Lights with PowerShell and Windows task scheduler. But for me, this also meant I had to update my script and while I’m at it why not improve my own script? So let’s start to toggle Philips Hue depending on your PC State. The improved version includes better security and is clearer overall. Since then Signify decided to clean up their API and create an improved version. Why v2 you might ask? Well, quite some time ago I wrote a guide on how to toggle Philips Hue depending on your PC state for the first version of the Hue API. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |