Philips Hue Plugin

Show us exactly what you’ve typed. I bet you have insufficiently escaped your double quotes.

From the Just Add Backslashes Till It Works Department.[/quote]

AND THE WINNER IS!!!

os.execute(“curl -X PUT -d "{\"on\":false}" http://192.168.1.150/api/newdeveloper/groups/3/action”)

Thank you!!! We call all this “line noise”, and I really do appreciate you taking the time to learn the language!

I certainly hope it’s that simple; here is the code as I entered it into the LUUP area of the scene:

os.execute(“curl -X PUT -d “{"on":false}” http://192.168.1.150/api/newdeveloper/groups/3/action”)[/quote]

I am just checking on a feature that is present in this plugin. I notice on the “presets” device that there is an option to “Store brightness with presents”. If I check this, then go to the color tab and come back, it is unchecked. If i check it and click “Set X”, I don’t see any difference in the JSON string that is presented (it still only has Hue and Sat. or CT). So is this feature supposed to work and is it perhaps working and i don’t notice it (I have not done extensive testing).

Also, if it does work, if turning a preset on that was saved with a brightness of 10% and the light was off, would it turn on and stay on at 10%?

Edit: I just tested and it appears that it does not store the brightness. Another thing I noticed is that on my “group” devices, I can’t save presets at all.

Had the Hue plugin working just fine.

All of the sudden the app stops working and I start getting LUA startup failed message (coinceidentally the same day I added some nonhue cree connected bulbs to the hue hub).

I uploaded the I_PhilipsHue1.xml file from the github repos to the LUUP Files section under develop apps.

I no longer get the failed message but I cant get the hub to add the rest of the bulbs and I still get the the Device not ready message when I click establish link (and I still have the “Hue hub is up and linked” under status).

Any/all help is appreciated. Thanks

Hey thanks for the plugin and all the great work!!!

I’ve had a question almost since day one, I’ve searched for a solution on and off for a couple years now, figure its time I ask for some help.

I use a lot of colors on my hue along with brightness, and used to use them as a form of notification (someones at the door, go red for 5 secs) but with 2 small children around when I’m trying to get them to nap the preset color and/or brightness screws that vibe up.

I dont do much luup scripting but I do use it where i have to. I found some similar solutions for normal dimmers i can use with hue but haven’t found anything for colors. Like I said I use a wide variety and at random times.

Any luup examples? or PLEG? I have read almost all relevant posts… over the coarse of A WHILE. I apologize in advance if I overlooked a solution.

Thanks!

[quote=“new2me07, post:344, topic:173293”]Hey thanks for the plugin and all the great work!!!

I’ve had a question almost since day one, I’ve searched for a solution on and off for a couple years now, figure its time I ask for some help.

I use a lot of colors on my hue along with brightness, and used to use them as a form of notification (someones at the door, go red for 5 secs) but with 2 small children around when I’m trying to get them to nap the preset color and/or brightness screws that vibe up.

I dont do much luup scripting but I do use it where i have to. I found some similar solutions for normal dimmers i can use with hue but haven’t found anything for colors. Like I said I use a wide variety and at random times.

Any luup examples? or PLEG? I have read almost all relevant posts… over the coarse of A WHILE. I apologize in advance if I overlooked a solution.

Thanks![/quote]

You could look into a Virtual Switch. You could activate that when the kids would be napping. I have my Christmas Lights on a daily schedule, but that scene checks for the VS first. So for this time of year, they aren’t going off and on.

Thanks for the advice but I was looking for something automatic and flexible. I have an iPad on the wall for the babysitter and 5 brightness setting, 5 colors, and individual bulb on/off switches. I feel that if you press a button once you shouldn’t have to walk back over to do it again. Takes the awe factor away…

How is the Vera supposed to know when your kids are napping then? You could do it on a time schedule, but kids don’t always nap at the same time for the same amount of time.

Do you have some sort of Z-wave child sensor? Because I would be very interested in that! :wink:

Try Hue Tap…

you walk with one in your hands and trigger 3 scenes and the 4th is all off…

[quote=“Piwtorak, post:348, topic:173293”]Try Hue Tap…

you walk with one in your hands and trigger 3 scenes and the 4th is all off…[/quote]

My Minimotes win out over the Hue Tap… easier to fit in your pocket. But… you do have to charge 'em up every so often, where the Hue Tap is powered by your button presses (cool).

yes, for that reason I mention Hue Tap for some mobility applications…
you can trigger another scene in vera when you turn on a hue lamp…

even you have hue plugin installed…

I think my point may have been missed. I found code that allows a trigger to set a brightness then return it to whatever it was before… Off… 1% 3… 20… Whatever it was before the event or scene triggered a change.

I’m just seeking a way to do the exact same thing with colors so when someone pulls in my driveway, or my son gets out of bed in the middle of the night or the Cowboys score a touchdown… Blue/red/purple whatever gets changed for a few seconds and is changed back. I have a minimote, know about a tap, even have VC for voice commands in the bedroom but I bought a Vera for home automation not as simply a remote control interface.

I believe the value in the hue as a means of unobtrusive notifications and when paired to energy metering devices and pleg and a 100 others crazy sht can happen. I’m talking a guy out of universal remote brand controllers and I’m giving a little demo this weekend. Pretty cool when squeezebox will announce microwave is done and wmc pauses and light change a color to notify. Or maybe just a brightness.

You say what you’re NOT trying to do…

I took your first post to mean you want to suspend the alerting/notifications of your lights (hues). As in, when your kids are napping, do NOT alert if the Cowboys score, or someone pulls into your driveway?

Or was the napping kids thing an example of an alert you want? As in, flash blue for Cowboys, green for driveway, purple for child out of bed?

[quote=“new2me07, post:351, topic:173293”]I found code that allows a trigger to set a brightness then return it to whatever it was before… Off… 1% 3… 20… Whatever it was before the event or scene triggered a change.

I’m just seeking a way to do the exact same thing with colors…[/quote]

Can you link me to this code you’re talking about. I’d also like to set notifications around the house and then the light to come back to what it was before after a minute or so. Thanks.

Any ideas on where to start trying to troubleshoot the hue plugin??

I had it working for a week or two after my first setup but then I ramdomly got flagged for the LUA startup error and I havent been able to get everything back online since.

  • I have tried uploading the .xml file from the github repos
  • i have tried restarting/deleting/reinstalling a million different ways.
  • Someone else had mentioned using the mios store to download 1.3. I actually use a rebranded vera as part of a remote automation system so I cant find a way to login/link from that store. Can the file be posted here and then can I manually install?
  • Any/all advice/input on what I can try is appreciated.Thanks

local LIGHTS = { 23, 99 } – Device # of the lights. For a single light this looks like this: { 23 }
local LAMP_ON_LEVEL = “100” – %
local LAMP_OFF_LEVEL = “0” – %
local TURN_OFF_DELAY = 8 – Seconds


– Constants

local DIMMING_SID = “urn:upnp-org:serviceId:Dimming1”


– Functions

– Concatenates a table using kev-value pairs.
– e.g. { [“a”] = 68, [“b”] = 69} : a=68,b=69
– ‘sepp’ is the pairs separator
– ‘sepkv’ is the key-value separator
function table.serialize (t, sepp, sepkv)
local sepp = sepp or “,”
local sepkv = sepkv or “=”
local s = “”

for k, v in pairs(t) do
    if type(v) ~= "table" then
        s = s .. tostring(k) .. sepkv .. tostring(v) .. sepp
    end
end

return string.sub(s, 1, -(#sepp + 1))

end

– Splits a string using the given separator.
function string.split (s, sep)
local sep = sep or “,”
local t = {}

local pattern = string.format("([^%s]+)", sep)
s:gsub(pattern, function(w) t[#t + 1] = w end)

return t

end

function string.deserialize (s, sepp, sepkv)
local sepp = sepp or “,”
local sepkv = sepkv or “=”
local t = {}

local t1 = string.split(s, sepp)
for _, v in pairs(t1) do
    local t2 = string.split(v, sepkv)
    t[ t2[1] ] = t2[2]
end

return t

end

local function turnOnLights()
local previousLevels = {}
for _, light in pairs(LIGHTS) do
local previousLevel = luup.variable_get(DIMMING_SID, “LoadLevelStatus”, light) or “”
if previousLevel == “” then
previousLevel = LAMP_OFF_LEVEL
end
previousLevels[light] = previousLevel
luup.call_action(DIMMING_SID, “SetLoadLevelTarget”, { newLoadlevelTarget = LAMP_ON_LEVEL }, light)
end

-- Pass a parameter containing the timestamp and the levels to dim the lights to.
-- e.g. "1355230628|45,78"
luup.call_delay( "turnOffLights", TURN_OFF_DELAY, os.time() .."|".. table.serialize(previousLevels) )

end

function turnOffLights (param)
local timestamp = param:match(“^(%d+)|”)
if os.difftime( os.time(), timestamp ) < TURN_OFF_DELAY then
return
end

local previousLevels = param:match("|([%d,=]+)$"):deserialize()
for _, light in pairs(LIGHTS) do
    luup.call_action(DIMMING_SID, "SetLoadLevelTarget", { newLoadlevelTarget = previousLevels[tostring(light)] }, light)
end

end


– Main

turnOnLights()

thats for brightness

[quote=“dt3, post:354, topic:173293”]Any ideas on where to start trying to troubleshoot the hue plugin??

I had it working for a week or two after my first setup but then I ramdomly got flagged for the LUA startup error and I havent been able to get everything back online since.

  • I have tried uploading the .xml file from the github repos
  • i have tried restarting/deleting/reinstalling a million different ways.
  • Someone else had mentioned using the mios store to download 1.3. I actually use a rebranded vera as part of a remote automation system so I cant find a way to login/link from that store. Can the file be posted here and then can I manually install?
  • Any/all advice/input on what I can try is appreciated.Thanks[/quote]

Can you post the Lua log showing the startup error?

Apologies. I was making a stupid mistake and found my error. Got the app reloaded and I am loving it. Thanks!

I do have a couple of VRC (1-4) devices that I dont understand. Are those groups created by one of the other apps that I have used? What is the preferred method/app for combining multiple bulbs into one device/group?

OK, I’ve searched the forum but don’t see anybody else with my issue:

I have a new vera edge, I installed the Hue plugin but I cannot get Vera to recognize the Hue. I have uninstalled reinstalled pushed the hub button, put in the exact ip address of the Hue etc but all to no avail, I’m just about ready to call it a day. Has anybody else had this issue and if so how did you resolve it?

Thanks,

Daragh.

Are you seeing a message about hue startup lua failed??

Im far from an expert with this thing (posts above prove that) but I know many people have needed to install the file found on the github repository. I was having similar issues and then I installed the I_PhilipsHue1.xml (go into apps → develop apps–> Luup Files) a restart of the hue bridge and the zwave gateway later and I was in business. Wish you luck.

I just added some cree connected bulbs to my hue bridge. I restarted the vera (ui5) to get the new lights to show up, but now I get a lua startup error. I opened up the log viewer while it restarted and I saw this. Is this enough to troubleshoot?

06      02/28/15 23:59:42.023   Device_Variable::m_szValue_set device: 174 service: urn:intvelt-com:serviceId:HueController1 variable: LinkStatus was: Hue hub is up and linked now: Device IP is set #hooks: 0 upnp: 0 v:0x1328968/NONE duplicate:0 __LEAK__ this:-495616 start:3129344 to 0x1e48000 <0x2b5a3680>

06      02/28/15 23:59:42.584   Device_Variable::m_szValue_set device: 174 service: urn:intvelt-com:serviceId:HueController1 variable: LinkStatus was: Device IP is set now: Hue hub is up and linked #hooks: 0 upnp: 0 v:0x1328968/NONE duplicate:0 __LEAK__ this:77824 start:3207168 to 0x1e5b000 <0x2b5a3680>
01      02/28/15 23:59:42.596   LuaInterface::CallFunction_Startup-1 device 174 function startup failed [string "..."]:255: attempt to perform arithmetic on field 'bri' (a nil value) __LEAK__ this:4096 start:3211264 to 0x1e5c000 <0x2b5a3680>
01      02/28/15 23:59:42.596   LuImplementation::StartLua running startup code for 174 I_PhilipsHue1.xml failed <0x2b5a3680>

I actually turned the lights on and off again in the hue app, and now it has started up and works