Author Topic: Lua Commands with the AltHue Plugin - Hue, Saturation, Effect etc.  (Read 424 times)

Offline Joe Daring

  • Sr. Newbie
  • *
  • Posts: 35
  • Karma: +2/-0
Hell? Fellow Vera Users...

Tryng to command my Hue Lights with Lua from the scene editor...

I searched for some examples on this Forum, but can find mostly stuff related to the old plugin, while I am using AltHUE...

I haven't been able to find a syntax that works for me...

I have tried:

luup.call_action("urn:upnp-org:serviceId:AltHue1", "SetHueAndSaturation", {Hue="64879";Saturation="253"}, 138)

luup.call_action("urn:upnp-org:serviceId:AltHue1", "SetHueAndSaturation", {Effect="colorloop"}, 138)

luup.call_action("urn:upnp-org:serviceId:AltHue1", "SetHueAndSaturation", {Hue="64879";Saturation="253";Effect="colorloop"}, 138)

These had "PlilipsHue1" originally in place of AltHue1...

None works...

How should I build the command?
Is there a list of the Commands accepted by AltHUE Plugin?
I was specifically trying to start Colorloop as an "Effect", as in the last command above...

Any Hint, please?
Thank you so much!
Joe

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 759
  • Karma: +115/-1
Re: Lua Commands with the AltHue Plugin - Hue, Saturation, Effect etc.
« Reply #1 on: August 01, 2018, 11:34:33 am »
luup.call_action("urn:upnp-org:serviceId:AltHue1", "SetHueAndSaturation", {Hue="64879";Saturation="253"}, 138)
luup.call_action("urn:upnp-org:serviceId:AltHue1", "SetHueAndSaturation", {Hue="64879";Saturation="253";Effect="colorloop"}, 138)

Well, for starters, the separators between array/table elements should be commas (",") not semicolons (";"). But I don't have any Hue lights to test with to guide you further.
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3090
  • Karma: +206/-8
Re: Lua Commands with the AltHue Plugin - Hue, Saturation, Effect etc.
« Reply #2 on: August 01, 2018, 02:03:04 pm »
SetHueAndSaturation Is not an action supported by the althue plugin as you can see in the service Sxxxx.xml file.
Instead Althue creates devices that are standard devices and each devices have their own actions using standard services ( SetColor etc )

On the other hand , you do have a up plan action called RunHueScene on the AltHue device and you need to pass the hue scene Id to it, you find data in the althue Hue Scenes tab.

If you run it with ALTUI it is very easy to see what action and parameters are needed for each actions.
Hope that helps


Offline Joe Daring

  • Sr. Newbie
  • *
  • Posts: 35
  • Karma: +2/-0
Re: Lua Commands with the AltHue Plugin - Hue, Saturation, Effect etc.
« Reply #3 on: August 02, 2018, 06:45:43 pm »
Oh! I see...
There should be no need to use LUA with ALTHUE because of the different philosophy with regards to the devices it creates...

And, yes, I have seen how to choose Brightness and Color (Hue + Saturation) when using an Hue lamp/bulb in scenes...

Fine...

BUT! The reason I was trying to do something with LUA is that I wanted to start Colorloop on some of the Lamps...

ColorLoop is an "Effect" (Actually the ONLY one so far, as it seems...) and not a real scene and, over this, it is something implemented directly in Firmware on each Lamp/Bulb, as I understand it...

As a consequence, in most applications, Colorloop is not listed in the Scene List and has no Scene ID, while some of them (Alexa, for instance...) are able to discover and use it...

In fact, I can initiate a Colorloop via Alexa's Voice command...

Any chance this could be added to AltHue?

Thank you very much
Joe

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3090
  • Karma: +206/-8
Re: Lua Commands with the AltHue Plugin - Hue, Saturation, Effect etc.
« Reply #4 on: August 03, 2018, 02:03:59 pm »
Can you send?me Hue data extract from settings tab and which light it is ?

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3090
  • Karma: +206/-8
Re: Lua Commands with the AltHue Plugin - Hue, Saturation, Effect etc.
« Reply #5 on: August 04, 2018, 10:18:39 am »
Oh! I see...
There should be no need to use LUA with ALTHUE because of the different philosophy with regards to the devices it creates...

And, yes, I have seen how to choose Brightness and Color (Hue + Saturation) when using an Hue lamp/bulb in scenes...

Fine...

BUT! The reason I was trying to do something with LUA is that I wanted to start Colorloop on some of the Lamps...

ColorLoop is an "Effect" (Actually the ONLY one so far, as it seems...) and not a real scene and, over this, it is something implemented directly in Firmware on each Lamp/Bulb, as I understand it...

As a consequence, in most applications, Colorloop is not listed in the Scene List and has no Scene ID, while some of them (Alexa, for instance...) are able to discover and use it...

In fact, I can initiate a Colorloop via Alexa's Voice command...

Any chance this could be added to AltHue?

Thank you very much
Joe

I have made v1.40 on https://github.com/amg0/ALTHue with a new UPNP action to contro this. it can also be triggered from the "Hue Device" tab of ALTHUE
not all lamp are compatible, Hue Device tab only proposes the button for the right lamps

Code: [Select]
UPNP action
SetEffect(childId,effect)
effect must be the string none or colorloop  ( like in Hue api )
childID must be the targeted VERA device ID.   

Offline Joe Daring

  • Sr. Newbie
  • *
  • Posts: 35
  • Karma: +2/-0
Re: Lua Commands with the AltHue Plugin - Hue, Saturation, Effect etc.
« Reply #6 on: August 05, 2018, 12:13:37 pm »
WoW!
Lightning fast, amg0... nice indeed and thanks...

Maybe I should have mentioned that there is also another flag, similar to the "effect=colorloop" one, and that is "Alert"

It is a separate command, not an alternative to ColorLoop...

Not that I'm trying to use it, but just for completeness' sake...

The choces for "alert" are: ?none?, ?select?, ?lselect? where "select" flashes a bulb once, "lselect" flashes a bulb for 30 seconds (about 15 Flashes...) or less if you set it back to "none".

But I'm telling you things you already know, for sure... forgive me...

Going to test 1.40... I guess it's not on the Mios Store yet... Should I just copy the files over? And which one I needs to upload? to just get the plugin updated?

Great Job, BTW, thanks amg0
Joe

Offline Joe Daring

  • Sr. Newbie
  • *
  • Posts: 35
  • Karma: +2/-0
Re: Lua Commands with the AltHue Plugin - Hue, Saturation, Effect etc.
« Reply #7 on: August 05, 2018, 12:19:26 pm »
Oh!
And thank you also RigPapa for your note about syntax...

Ciao
Joe

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3090
  • Karma: +206/-8
Re: Lua Commands with the AltHue Plugin - Hue, Saturation, Effect etc.
« Reply #8 on: August 05, 2018, 02:18:53 pm »
Just download the zip from github and upload all files to your vera using the ui7 file upload feature.
Regarding alert I ll look but I am not sure it is used frequently enoug to be fully worthwhile the effort.
Thx !

Offline Joe Daring

  • Sr. Newbie
  • *
  • Posts: 35
  • Karma: +2/-0
Re: Lua Commands with the AltHue Plugin - Hue, Saturation, Effect etc.
« Reply #9 on: August 06, 2018, 01:47:28 am »
No problems...
I understand... As I have said, I am not trying to use the alert function myself and I mentioned it just for completeness...

Thank you so much amg0

Joe

Offline fyford

  • Jr. Member
  • **
  • Posts: 71
  • Karma: +0/-1
Re: Lua Commands with the AltHue Plugin - Hue, Saturation, Effect etc.
« Reply #10 on: August 30, 2018, 03:20:22 am »
SetHueAndSaturation Is not an action supported by the althue plugin as you can see in the service Sxxxx.xml file.
Instead Althue creates devices that are standard devices and each devices have their own actions using standard services ( SetColor etc )


Can you please point me to some examples / documentation etc on these 'standard services (setcolor etc) you talk of. What do I enter for that? A hex code, a word 'blue' in inverted commas, brackets, curly brackets, what is the syntax?

Thanks

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3090
  • Karma: +206/-8
Re: Lua Commands with the AltHue Plugin - Hue, Saturation, Effect etc.
« Reply #11 on: August 30, 2018, 10:36:37 am »
SetHueAndSaturation Is not an action supported by the althue plugin as you can see in the service Sxxxx.xml file.
Instead Althue creates devices that are standard devices and each devices have their own actions using standard services ( SetColor etc )


Can you please point me to some examples / documentation etc on these 'standard services (setcolor etc) you talk of. What do I enter for that? A hex code, a word 'blue' in inverted commas, brackets, curly brackets, what is the syntax?

Thanks

you can refer to https://github.com/amg0/ALTHue/blob/master/S_ALTHUE.xml https://github.com/amg0/ALTHue/blob/master/I_ALTHUE.xml  for the action name and parameter and service name to use and https://github.com/amg0/ALTHue/blob/master/L_ALTHUE.lua and look at the Userxxx() functions.


the SetColor() expects a new color target which is a string made of a letter and then 0 to 255 and will produce the result based on the following rules
-- Warm White: Wx
-- Cool White: Dx
-- W0     <--> W255  =  D0     <--> D255
-- 2000K <--> 5500K = 5500K <--> 9000K

the setColorRGB() expects a RGB string , comma separated with red, green, blue values ( 0 to 255 )

the setEffect() expects 'none' to 'colorloop' ( only 2 effects supported in Hue ).

Offline fyford

  • Jr. Member
  • **
  • Posts: 71
  • Karma: +0/-1
Re: Lua Commands with the AltHue Plugin - Hue, Saturation, Effect etc.
« Reply #12 on: August 30, 2018, 06:06:02 pm »
Thanks!! that sorted me!