Author Topic: Philips Hue Time of Day Scene with Virtual Switch  (Read 174 times)

Offline richardjgreen

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
Philips Hue Time of Day Scene with Virtual Switch
« on: August 10, 2017, 08:16:33 am »
Hi all,

I was hoping somebody could point me in the direction of some Luup examples that might help me out? I have a virtual switch which currently fires a Philips Hue Scene in Vera. I would like to alter the Virtual Switch to instead, call some Luup code.

If the time is between 1 a.m. and 5 a.m. I would like to trigger a night light scene. If the time is anything outside of 1 a.m. to 5 a.m. I would like to fire a different scene for normal lighting.

Any thoughts most welcome.

Offline jswim788

  • Hero Member
  • *****
  • Posts: 538
  • Karma: +29/-2
Re: Philips Hue Time of Day Scene with Virtual Switch
« Reply #1 on: August 10, 2017, 09:35:59 am »
You can make your scene conditional based on the time.  Rex gives a good example in this post:

http://forum.micasaverde.com/index.php/topic,18679.msg141962.html#msg141962

Also, you can do this with PLEG.  Either can work - pick what works best for you.

Offline richardjgreen

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
Re: Philips Hue Time of Day Scene with Virtual Switch
« Reply #2 on: August 10, 2017, 10:56:13 am »
Thank jswim788. I have used one of Rex's examples for another scene I have. The part I am confused by most is the urn for Hue. I know that the basis should be luup.call_action("urn:urn:micasaverde-com:serviceId:PhilipsHue1","RunHueScene").

What I am unsure of is what the remainder should be. Excuse the ignorance, but would I be able to determine the parameters to build the call action from reading the device file? I haven't had to call a device explicitly like this before.

Offline jswim788

  • Hero Member
  • *****
  • Posts: 538
  • Karma: +29/-2
Re: Philips Hue Time of Day Scene with Virtual Switch
« Reply #3 on: August 10, 2017, 01:23:17 pm »
What I am unsure of is what the remainder should be. Excuse the ignorance, but would I be able to determine the parameters to build the call action from reading the device file? I haven't had to call a device explicitly like this before.
Sorry, I'm not familiar with this plugin.  I think you are correct that you could look in the implementation file to find the actions but you made need to peruse the other files to see what the parameters do.

But why do you need to do this?  Can't you set this up directly in the scene itself?  You only need the lua in the scene for the condition.  You can use the regular actions in the scene for what you want to do.  (Admittedly there are times when I call conditional actions in my scene lua to save myself from having multiple scenes, but I don't have to do that.)