I’m trying to figure out how to do a nested scene within Vera for a vacation home. What i really want the scene to do is the following:
IF it is winter time, tun on Thermostat to heat at 68 degress.
IF it is summer time turn Thermostat to cool at 72 degrees.
IF it is night, then turn on Exterior lights
I have a scene for #1 , #2 and also #3 (Scene #1 and #2 are currently manually triggered), i just would love to be able to call a single scene that does all of the above so whenever i am on my way to the house the settings are automatically set. Any idea how to do this? (my Luup programming is weak, but i am willing to learn).
THank you both for the quick reply. Really appreciate it. so, my luup code looks something like this:
– Scene #7 Turn OFF exterior lights
– Scene #6 Turn ON exterior lights
– Scene #4 Set thermostat to HEAT and 68 degrees
– Scene #5 Set thermostat to COOL and 72 degrees
function isWinter()
local tNow = os.date(“*t”)
local dayofyear = tNow.yday
return (dayofyear >= 325) or (dayofyear < 99) – November 21st to April 1st
end
local dID = 39 – Device ID of DayTime plugin
local dStatus = luup.variable_get(“urn:rts-services-com:serviceId:DayTime”,“Status”,dID)
– Day or night function - turn on lights if dStatus is not 1
if (dStatus == 1)
luup.call_action(“urn:micasaverde-com:serviceId=HomeAutomationGateway1”, “RunScene”,{SceneNum=7},0) --Turn on exterior lights
else
luup.call_action(“urn:micasaverde-com:serviceId=HomeAutomationGateway1”, “RunScene”,{SceneNum=6},0) --Turn off exterior lights
– winter function set thermostats
if isWinter()
luup.call_action(“urn:micasaverde-com:serviceId=HomeAutomationGateway1”, “RunScene”,{SceneNum=5},0) --Set winter thermostats 68 degress
else
luup.call_action(“urn:micasaverde-com:serviceId=HomeAutomationGateway1”, “RunScene”,{SceneNum=4},0) --Set summer thermostats 72 degrees
Good call, thank you!!! i was wondering why my tests were not working! so, how can i pass a variable from a function into another function? for example:
function callLuup(mySceneNumber)
luup.call_action(“urn:micasaverde-com:serviceId=HomeAutomationGateway1”, “RunScene”,{SceneNum=mySceneNumber},0)
end
An easier way might just be to create a virtual switch, and use it as the triggers for your scenes. Switch on, you are going to the vacation house, switch off, you are leaving so set things back to away mode.
[quote=“sebby, post:8, topic:189868”]Good call, thank you!!! i was wondering why my tests were not working! so, how can i pass a variable from a function into another function? for example:
function callLuup(mySceneNumber)
luup.call_action(“urn:micasaverde-com:serviceId=HomeAutomationGateway1”, “RunScene”,{SceneNum=mySceneNumber},0)
end[/quote]
Does it work for you? I tried something similar, but none of my three test scenes in the code do their job.
Anyone know if there is a way to trigger a scene when a vswitch is toggled? right now i have all this working with two scenes, but that seems to make more sense to me to have a single scene fired by the change of the switch (currently i have a scene for turning the switch on and one for turning it off). No big deal if it can’t happen, but I just like to keep all my logic in one place.