Does this plugin with latest files from Vera work? I have installed openluup and bridged to my vera lite.
When i use the latest files which are working on my Vera lite i get a new device in openluup and same icon.
But the only thing i see is a on/off button which wont work also after setting the right ipadres from bridge.
So how to make connection to my bridge, or do i have to use other files specially made for openluup?
(in the forum i found some older thread/files from poster Cudanet but also no result)
Hi Egbert,
I’d attempt to use the files I posted as I’m still using that today. I’ve not had great success with the later MCV releases and I did just recently purchase bridge 2.0 (still sitting in the box) so It’s been on my list of things to do (test their latest and my working copy if you will). So in other words, if you have a newer bridge then there’s no guarantee that it works. If you have bridge 1.0 then it will definitely work.
[quote=“Egbert, post:1, topic:191658”]Does this plugin with latest files from Vera work? I have installed openluup and bridged to my vera lite.
When i use the latest files which are working on my Vera lite i get a new device in openluup and same icon.
But the only thing i see is a on/off button which wont work also after setting the right ipadres from bridge.
So how to make connection to my bridge, or do i have to use other files specially made for openluup?
(in the forum i found some older thread/files from poster Cudanet but also no result)[/quote]
Hello Cudanet,
Yes i use version 2 of the Hue bridge.
I just tried your files (philips_hue_package_r02) , then a device appears ; Philips hue by mios.
In the device there is an connectivity panel with the right ip adres.
The “pair with bridge” button is there but looks like nothing happens when pressed.
There is an error above this button : Linking ERROR occurred : invalid value, Vera1, for parameter, username.
And when i look at the variables tab at status there is displayed :
3/18/16 20:09:23.144 Linking ERROR occurred : invalid value, Vera1, for parameter, username Linking ERROR occurred : invalid value, Vera1, for parameter, username
03/18/16 20:04:45.003 Linking ERROR occurred : invalid value, Vera1, for parameter, username Linking ERROR occurred : invalid value, Vera1, for parameter, username
03/18/16 20:04:07.291 Linking ERROR occurred : invalid value, Vera1, for parameter, username Linking ERROR occurred : invalid value, Vera1, for parameter, username
03/18/16 20:03:26.060 Philips Hue bridge was detected. Please hit ‘Pair with the Bridge’ button! Linking ERROR occurred : invalid value, Vera1, for parameter, username
03/18/16 20:03:26.038 Philips Hue Bridge has been discovered! Philips Hue bridge was detected. Please hit ‘Pair with the Bridge’ button!
03/18/16 20:03:26.037 Philips Hue Bridge has been discovered!
03/18/16 20:03:24.909 Linking ERROR occurred : invalid value, Vera1, for parameter, username
So it does not work, and i think have to wait when you open your new bridge box.
Hmm, it appears the culprit is the username defined within the globals… Futzle actually (had to dig to find it) reported this, “The old username mechanism will cease to work in early 2016.” So that explains why that doesn’t work. SO, do you happen to know how to create a username ? If you feel adventurous, here’s a couple of steps we can try to see if we can make it work … If you’d rather wait I understand … I suspect mine continues to work as I refuse to upgrade my firmware (bridge 1.0).
[1] Open Philips API debugger by going to ‘http:///debug/clip.html’
[2] Within URL, provide the following message body:
{"devicetype": "my_hue_app#openLuup"}
[3] Press [POST] and grab the response body. This is the username parameter.
[{"success":{"username": "im_your_new_hue_username"}}]
[4] Open up the L_PhilipsHue2.lua file located at ‘/etc/cmh-ludl/’ and replace ’ g_username = “Vera” … luup.pk_accesspoint ’
local g_username = "im_your_new_hue_username"
[5] Save the file and reload luup.
L_PhilipsHue2.lua
-- Globals
local lug_device = nil
local g_appendPtr -- The pointer passed to luup.chdev.append
local g_taskHandle = -1
local g_lastTask = os.time() -- The time when the status message was last updated.
local g_ipAddress = ""
local g_UUID = nil
local g_hueURL = ""
local g_username = "Vera" .. luup.pk_accesspoint
local g_lastState = ""
local g_lamps = {
[quote=“Egbert, post:3, topic:191658”]Hello Cudanet,
Yes i use version 2 of the Hue bridge.
I just tried your files (philips_hue_package_r02) , then a device appears ; Philips hue by mios.
In the device there is an connectivity panel with the right ip adres.
The “pair with bridge” button is there but looks like nothing happens when pressed.
There is an error above this button : Linking ERROR occurred : invalid value, Vera1, for parameter, username.
And when i look at the variables tab at status there is displayed :
3/18/16 20:09:23.144 Linking ERROR occurred : invalid value, Vera1, for parameter, username Linking ERROR occurred : invalid value, Vera1, for parameter, username
03/18/16 20:04:45.003 Linking ERROR occurred : invalid value, Vera1, for parameter, username Linking ERROR occurred : invalid value, Vera1, for parameter, username
03/18/16 20:04:07.291 Linking ERROR occurred : invalid value, Vera1, for parameter, username Linking ERROR occurred : invalid value, Vera1, for parameter, username
03/18/16 20:03:26.060 Philips Hue bridge was detected. Please hit ‘Pair with the Bridge’ button! Linking ERROR occurred : invalid value, Vera1, for parameter, username
03/18/16 20:03:26.038 Philips Hue Bridge has been discovered! Philips Hue bridge was detected. Please hit ‘Pair with the Bridge’ button!
03/18/16 20:03:26.037 Philips Hue Bridge has been discovered!
03/18/16 20:03:24.909 Linking ERROR occurred : invalid value, Vera1, for parameter, username
So it does not work, and i think have to wait when you open your new bridge box. :)[/quote]
The responce body after step 2 is :
[
{
“error”: {
“type”: 1,
“address”: “/”,
“description”: “unauthorized user”
}
}
]
I dont know what it is but i think its not ok.
Actually I’m reading through their much changed API… With the debug tool still up, let’s try this…
Enter this URL in the CLIP API debugger '/api ’ (without the single quotes), then attempt steps 2 through 5…
Edit: If successful it’ll ask you to push the bridge button. Once pressed, go back and hit the POST button again…
[quote=“Egbert, post:5, topic:191658”]The responce body after step 2 is :
[
{
“error”: {
“type”: 1,
“address”: “/”,
“description”: “unauthorized user”
}
}
]
I dont know what it is but i think its not ok.[/quote]
Cudanet,
Im connected! as you wrote i got a key and edited that key in the lua file.
After reloading luup the icon went green and showed connected.
Now im gonna find out how to add some lights.
I have the new white led bulbs.
Well you just made my day as I can now comfortably move to bridge 2.0 … Thanks for testing that out … In my initial instructions once you add bulbs, they should show up within openLuup (system polls for new bulbs every x seconds). You may have to logically “touch” the bulbs once which involves just that. Simply turn the bulb on (dimmer from 0 to 100) and back off. That’s it. You’ll have to do this only once for each bulb you add…
[quote=“Egbert, post:7, topic:191658”]Cudanet,
Im connected! as you wrote i got a key and edited that key in the lua file.
After reloading luup the icon went green and showed connected.
Now im gonna find out how to add some lights.
I have the new white led bulbs.[/quote]
For now im connected succesfully to the bridge but the connected lights wont show up in openluup.
I already reloaded luup and restarted openluup and refreshed the browser.
So thats the next thing to look for.
On the bridge device, there should be a variable (DebugMode) - can you set that to 1 and reload luup. You’ll need to tail the logs to see if you can find details regarding ‘(Hue2 Plugin)::’. It’s my fault for jinxing this, I simply spoke too soon.
[quote=“Egbert, post:9, topic:191658”]For now im connected succesfully to the bridge but the connected lights wont show up in openluup.
I already reloaded luup and restarted openluup and refreshed the browser.
So thats the next thing to look for.[/quote]
Had a little time tonight so I pulled the latest MCV code. I made a few adjustments for nupnp and this is about as far as I got. There are no buttons being displayed (JS issue perhaps) and as such no way to pair this thing (yet).
2016-03-18 23:49:14.900 luup_log:32: (Hue2 Plugin)::(Startup) : Initiating
2016-03-18 23:49:14.912 luup.task:32: status=2 Hue2 Plugin : Starting up...
2016-03-18 23:49:14.912 luup.variable_set:32: 32.urn:micasaverde-com:serviceId:PhilipsHue1.Status was: Please press the link button on the Bridge and hit the Pair button again! now: #hooks:0
2016-03-18 23:49:14.912 luup_log:32: (Hue2 Plugin)::(getInfos) : Debug mode enabled.
2016-03-18 23:49:14.912 luup_log:32: (Hue2 Plugin)::(getInfos) : POLLING_RATE = 7
2016-03-18 23:49:14.914 luup_log:32: (Hue2 Plugin)::(GetSkinCRC32) : Failed to open ui_skin
2016-03-18 23:49:14.914 luup_log:32: (Hue2 Plugin)::(getInfos) : Failed Status Report disabled.
2016-03-18 23:49:14.914 luup_log:32: (Hue2 Plugin)::(findBridge) : Trying to get IP via NUPNP...
2016-03-18 23:49:15.696 luup_log:32: (Hue2 Plugin)::(findBridge) : bridges: Bridge 1,10.0.x.x,{removed};
2016-03-18 23:49:15.696 luup.variable_set:32: 32.urn:micasaverde-com:serviceId:PhilipsHue1.Bridges was: Bridge 1,10.0.x.xx,{removed}; now: Bridge 1,10.0.x.x,{removed}; #hooks:0
2016-03-18 23:49:15.696 luup_log:32: (Hue2 Plugin)::(findBridge) : Philips Hue Bridge found with IP address: 10.0.x.x
2016-03-18 23:49:15.696 luup.variable_set:32: 32.urn:micasaverde-com:serviceId:PhilipsHue1.UUID was: nil now: nil #hooks:0
2016-03-18 23:49:15.696 luup.attr_set:32: 32.ip = 10.0.x.x
2016-03-18 23:49:15.696 luup.variable_set:32: 32.urn:micasaverde-com:serviceId:PhilipsHue1.Status was: now: Philips Hue Bridge has been discovered! #hooks:0
2016-03-18 23:49:15.697 luup_log:32: (Hue2 Plugin)::(getInfos) : language file not found, using default values for tokens
2016-03-18 23:49:15.697 luup_log:32: (Hue2 Plugin)::(getInfos) : Philips Hue URL = http://10.0.x.x/api
2016-03-18 23:49:16.008 luup_log:32: (Hue2 Plugin)::(checkInitialStatus) : Unregistered user! Proceeding...
2016-03-18 23:49:16.008 luup_log:32: (Hue2 Plugin)::(bridgeConnect) : Linking with the Bridge device
2016-03-18 23:49:16.060 luup.variable_set:32: 32.urn:micasaverde-com:serviceId:PhilipsHue1.Status was: Philips Hue Bridge has been discovered! now: Please press the link button on the Bridge and hit the Pair button again! #hooks:0
2016-03-18 23:49:16.061 luup.variable_set:32: 32.urn:micasaverde-com:serviceId:PhilipsHue1.BridgeLink was: 0 now: 0 #hooks:0
2016-03-18 23:49:16.061 luup.task:32: status=1 Philips Hue : Please press the link button on the Bridge and hit the Pair button again!
2016-03-18 23:49:16.061 luup_log:32: (Hue2 Plugin)::(bridgeConnect) : Please press the link button on the Bridge and hit the Pair button again!
2016-03-18 23:49:16.061 luup_log:32: (Hue2 Plugin)::(Init) : Got language : en
2016-03-18 23:49:16.061 luup_log:32: (Hue2 Plugin)::(appendLamps) : Verifying...
2016-03-18 23:49:16.061 luup_log:32: (Hue2 Plugin)::(appendGroups) : Verifying...
2016-03-18 23:49:16.061 luup_log:32: (Hue2 Plugin)::(appendGroups) : No supported groups found!
2016-03-18 23:49:16.061 luup.chdev.sync:: syncing children
2016-03-18 23:49:16.061 luup_log:32: (Hue2 Plugin)::(Startup) : Startup successful!
2016-03-18 23:49:16.061 luup.task:32: status=1 Philips Hue : Startup ERROR : Connection with the Bridge could not be established!
So after manually building a user and reloading. I have devices (this is bridge 1.0), no icons but the variables seems good so far… I need sleep so I’ll work on this when I have more time… Just keeping you in the loop.
2016-03-19 00:19:29.492 luup_log:32: (Hue2 Plugin)::(pollHueDevice) : BRIDGE JSON = [{"lights":{"1":{"state": {"on":true,"bri":99,"hue":14910,"sat":144,"effect":"none","xy":[0.4596,0.4105],"ct":369,"alert":"none","colormode":"ct","reachable":true}, "type": "Extended color light", "name": "Office Lamp", "modelid": "LCT001", "manufacturername": "Philips","uniqueid":"00:17:88:01:00:b9:6f:0b-0b", "swversion": "66013452", "pointsymbol": { "1":"none", "2":"none", "3":"none", "4":"none", "5":"none", "6":"none", "7":"none", "8":"none" }},"2":{"state": {"on":false,"bri":8,"hue":14910,"sat":144,"effect":"none","xy":
Also tried with the MCV files ( latest working from my Vera lite) and edited the L_PhilipsHue2.lua file / put in my bridge key.
Then the Hue bridge icon appears colored red.
In the device there is an on/off button which wont work.
See attached pic
Yes, an important item needed is nixio (Lua). Was unsuccessful using Luarocks so had to fetch it and run a make. I have (I think) everything working except the icons. Won’t have a lot of time to work on that today.
Take the attached file (nixio.so), unzip and place it in /usr/local/lib/lua/5.1/ (this is from my Jessie Lite 8). Reload luup and let’s see where it takes you.
Edit: Forgot to mention that I noticed I had no groups. I had a debug message indicating no groups found but that’s not entirely true as I use them a lot… Another item I need to look into (perhaps a firmware/API issue).
[quote=“Egbert, post:12, topic:191658”]Also tried with the MCV files ( latest working from my Vera lite) and edited the L_PhilipsHue2.lua file / put in my bridge key.
Then the Hue bridge icon appears colored red.
In the device there is an on/off button which wont work.
See attached pic[/quote]
Here also Debian Jessie, but nothing changes when the nixio file is added.
I started playing with the Philips Hue 2 plugin…
And got it to work… well… with basic functionality…
There are several issues:
- The MCV plugin has major bugs… among others, the hue bridge username is not saved to the correct deviceId.
- AltUI does not support some of the UI7 interface functions (ie: showModalPopup, getChildDeviceId, etc)
- AltUI does not support the “AfterInit” tag used in the D_PhilipsHue2.json file
- AltUI does not support the “dynamic_icons” tag used in the bulb device json files.
- The luup.inet.wget function does not handle the https url correctly.
As a workaround, I modified the J_ALTUI_api.js file to add the missing api functions… Modified the D_PhilipsHue2.json file to add the “AfterInit” function as a tab… and fixed the luup.inet.wget issue by using the ssl.https request function.
The plugin now finds the bridge, allows for connection to the bridge using the UI… The plugin then creates the bulb devices… The device tiles do not have controls on then, but entering the setup page allows basic on/off/dim control…
I’ve attached a zip of the files I modified… The AltUI file is from the latest version (v1.20.1312) and the plugin file is from the latest version (0.96)…
5) The luup.inet.wget function does not handle the https url correctly.
I didn’t think the Vera implementation did, but if that’s not the case, I’ll change it. The challenge for openLuup has hardly ever been how to make something happen, but finding out WHAT to make happen.
Yes, The Vera implementation does handle https…
While your making changes… I’m working on the new UI7 dynamic icons feature… The dynamic icons are svg image definitions… The server.lua code does not serve the svg files with the correct mime type… Simple fix…
Add:
svg = "image/svg+xml",
to the mime variable…
Thanks 8-}
In what way, can I ask? Does this just mean retaining the https prefix in the http.request() call, or does it require a switch to https.request() ?
While your making changes... I'm working on the new UI7 dynamic icons feature... The dynamic icons are svg image definitions... The server.lua code does not serve the svg files with the correct mime type... Simple fix...
Easy indeed. It’s in the next update. Thanks.
I don’t know how MCV has coded the luup.inet.wget function… The underlying OpenWRT wget executable does not support https urls…
I would suggest that a call to luup.inet.wget with an https url should switch to an https.request, which is what I did go get the hue2 plugin running… just keep in mind - wget returns code,content while https.request returns content,code…
I’ve fixed the development branch version of server.lua to handle https in wget requests. Also added svg mime type.
Grateful for someone to test this? It’s seems to work ok (tried on GitHub access.)