We have moved at community.getvera.com

Author Topic: 2 welcome home scenes: 1 to run at night and 1 to run during the day  (Read 1182 times)

Offline rgtwng

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
I have successfully created 2 scenes.

One is setup to turn on outside lights, inside lights, disarm alarm and unlock front door.  I added LUA code to only allow this to run at night:

Code: [Select]
if (luup.is_night()) then
     return true
  else
     return false
  end

The other is setup to disarm alarm and unlock front door

My plan is to use my phone and geofencing so that when I pull into the driveway, the appropriate scene will run (night or day).  I realize I can probably just have my phone fire off both scenes each time I pull in, but I would love to find a way to do this with 1 scene.

I installed PLEG, but have no idea how to use it.  I have spent considerable time searching around and haven't found anyone doing this exact same thing.

Any help?

Offline bobnatale

  • Newbie
  • *
  • Posts: 9
  • Karma: +0/-0
Re: 2 welcome home scenes: 1 to run at night and 1 to run during the day
« Reply #1 on: November 19, 2013, 02:10:09 pm »
It's like you are in my BRAIN!  This is exactly what I came here to look for lol.   Will be watching closely.  =)

andreimios

  • Guest
Re: 2 welcome home scenes: 1 to run at night and 1 to run during the day
« Reply #2 on: November 20, 2013, 05:15:58 am »
Hope this idea would help : create another scene with some LUA code :
Code: [Select]
if (luup.is_night()) then
    luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", {SceneNum = "your_night_scene_number"}, 0)
  else
     luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1", "RunScene", {SceneNum = "your_day_scene_number"}, 0)   
end


- Andrei -

Offline rgtwng

  • Jr. Member
  • **
  • Posts: 78
  • Karma: +0/-0
Re: 2 welcome home scenes: 1 to run at night and 1 to run during the day
« Reply #3 on: November 20, 2013, 06:10:04 pm »
Andrei,

Awesome.  I will give that a shot.

Thanks. 

Now I just need a reliable method of setting up the geofencing.  I was using trigger and it doesn't seem to be operating correctly.

Your code should get me off to the right start.

Offline duiffie

  • Full Member
  • ***
  • Posts: 126
  • Karma: +2/-0
Re: 2 welcome home scenes: 1 to run at night and 1 to run during the day
« Reply #4 on: November 21, 2013, 09:04:59 am »
Andrei,

Awesome.  I will give that a shot.

Thanks. 

Now I just need a reliable method of setting up the geofencing.  I was using trigger and it doesn't seem to be operating correctly.

Your code should get me off to the right start.

In case you have an iPhone, read this topic for the geofencing stuff
Vera2 (1.5.622)

Offline Aaron

  • Hero Member
  • *****
  • Posts: 1985
  • Karma: +61/-193
Re: 2 welcome home scenes: 1 to run at night and 1 to run during the day
« Reply #5 on: November 21, 2013, 09:38:46 am »
This is VERY easily to do.

Install 'PLEG' and 'Day or Night' apps.  I have many scenes that only run based on if it is Day/Night.

go look at this thread...

http://forum.micasaverde.com/index.php/topic,17669.0.html