The Vera Community forums have moved!

Advanced => Programming => Scene Scripting => Topic started by: rgtwng on November 19, 2013, 12:52:32 pm

Title: 2 welcome home scenes: 1 to run at night and 1 to run during the day
Post by: rgtwng on November 19, 2013, 12:52:32 pm
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?
Title: Re: 2 welcome home scenes: 1 to run at night and 1 to run during the day
Post by: bobnatale 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.  =)
Title: Re: 2 welcome home scenes: 1 to run at night and 1 to run during the day
Post by: andreimios 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 -
Title: Re: 2 welcome home scenes: 1 to run at night and 1 to run during the day
Post by: rgtwng 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.
Title: Re: 2 welcome home scenes: 1 to run at night and 1 to run during the day
Post by: duiffie 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 (http://forum.micasaverde.com/index.php/topic,16907.0.html) for the geofencing stuff
Title: Re: 2 welcome home scenes: 1 to run at night and 1 to run during the day
Post by: Aaron 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