Philips Hue Authentication - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Philips Hue Authentication (/showthread.php?tid=589) |
Philips Hue Authentication - George - 04.02.2017 Hello, I try to get Hue to work with LM. The log mentions : * string: [{"error":{"type":1,"address":"/lights","description":"unauthorized user"}}] How, when and where should the bridge be authenticated please ? Thanks, Koen RE: Philips Hue Authentication - Erwin van der Zwart - 04.02.2017 Hi Koen, Philips have changed the API due homekit support. Use this to control your HUE devices with latest HUE FW update : First run bridgeSetup() once to receive the user (see log after running) and enter where now "xxxxxxxxxxxxxxxxxx' is filled in. Code: require('json') Sample to set RGB value from color picker object event based script: Code: value = event.getvalue() Good luck (: BR, Erwin RE: Philips Hue Authentication - George - 05.02.2017 Dear Sir, Dear Erwin, Thanks for the help. Could you please elaborate a bit more please ? I'm going to subscribe for the Homelynk training in the Netherlands, but I want to get this right. I would add the code to 'common functions', and then create a resident script that calls the function to authenticate. Is this the right way to do it please ? We use the Hue for only one purpose : night lights for the children. As such, I would like to call a saved scene for a room. Is this possible please ? Thanks, George RE: Philips Hue Authentication - Erwin van der Zwart - 05.02.2017 Hi Koen, No its not a good idea to put the functions into common functions. Common functions are used when most of you scripts need the functions. Every script is connected to the common functions and loads that content. If you put all your functions into common functions it will rapidly reduce your sytem performance. That is why we have user liberies. When you put your functions in there you have to request in each script you make to include the content of that user libery by the command: require('youruserlibname') So what you should do is create a user lib called hue (disable automatic load checkbox) , paste the functions from the first code block in my post above. Change only the IP to your HUE bridge IP and save. Create a event based script connected to the RGB object that needs to trigger the action, start the script with requesting the just created user libary with: require('user.hue') and past my code from the second code block in my post above under the require command line. To create the user where now xxxxxxx is filled in, you must temperary put the command bridgeSetup() under the require ('user.hue') line, save , enable the script and change the color once. Your HUE does not respond yet but now the user is created and you can find it in the log tab. Paste this user into the hue userlib, remove the bridgeSetup() command from your event based script, save all changed scripts. Now you can control your HUE from the RGB object. I will see you at the homeLYnk training in the Netherlands as i'm your trainer (: BR, Erwin |