We have moved at community.getvera.com

Author Topic: NEWBIE HELP - SCENE PROGRAMMING  (Read 3089 times)

Offline dshenson

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
NEWBIE HELP - SCENE PROGRAMMING
« on: October 03, 2011, 05:02:59 am »
I have been trying to use some of the code written in these forums to set up a notification when my basement refrigerator has been left open for more than 10 minutes.  I've tried every configuration I can think of and cannot for the life of me gotten it to work.

I have a Hawking Door Sensor (made by Evergreen) - as device 57
I have created a Scene with a timer that runs every minute
I have a command that is programed to just turn on a light where I am programming this so I can test the sensor.
Ultimately I would like the time period to be 15 minutes so I am not getting an alert every time someone hovers over the fridge.

I have used the following Luup code:

local deviceNo = 57
local period = 2
local SS_SID = "urn:micasaverde-com:serviceID:SecuritySensor1"
local armed = luup.variable_get(SS_SID, "Armed", deviceNo) or "0"
if armed == "1" then
    local tripped = luup.variable_get(SS_SID, "Tripped", deviceNo) or "0"
    if tripped == "0" then
        luup.variable_set(SS_SID, "TripPeriod", "0", deviceNo)
    else
        local tripPeriod = luup.variable_get(SS_SID, "TripPeriod", deviceNo) or 0
        tripPeriod = tonumber(tripPeriod)
        tripPeriod = tripPeriod + 1
        luup.variable_set(SS_SID, "TripPeriod", tripPeriod, deviceNo)
        if tripPeriod == period then
            return true
        end
    end
end
return false



PLEASE PLEASE PLEASE HELP ME FROM GOING INSANE.

Thanks,
David

Offline Ap15e

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1998
  • Karma: +12/-0
Re: NEWBIE HELP - SCENE PROGRAMMING
« Reply #1 on: October 03, 2011, 05:32:19 am »
Case matters:

urn:micasaverde-com:serviceId:SecuritySensor1

Offline dshenson

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: NEWBIE HELP - SCENE PROGRAMMING
« Reply #2 on: October 03, 2011, 10:23:06 am »
Thanks for the quick response.  It still did not work.  Any newbie friendly help is appreciated.

Offline JOD

  • Hero Member
  • *****
  • Posts: 1973
  • Karma: +4/-0
Re: NEWBIE HELP - SCENE PROGRAMMING
« Reply #3 on: October 03, 2011, 01:00:29 pm »
Double check your scene setup.
Pressing "Run" turns the light On?
The sensor is Armed? The code requires the sensor be in the "Armed" state before it will trigger.

JOD.
I'm sorry, my responses are limited. You must ask the right questions.

Offline dshenson

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: NEWBIE HELP - SCENE PROGRAMMING
« Reply #4 on: October 04, 2011, 12:57:58 am »
OK.  Now have it so that when I push the Scene Button the light turns on.  However, the sensor does not seem to trigger the scene.

Thanks to anyone who can help me.

Offline JOD

  • Hero Member
  • *****
  • Posts: 1973
  • Karma: +4/-0
Re: NEWBIE HELP - SCENE PROGRAMMING
« Reply #5 on: October 04, 2011, 10:07:12 am »
Do you see the sensor trip on the Dashboard? Check the batteries if not..

The only other thing I can suggest is check the device ID you are using for the sensor and make sure your not using the node ID.

JOD.
I'm sorry, my responses are limited. You must ask the right questions.

Offline dshenson

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: NEWBIE HELP - SCENE PROGRAMMING
« Reply #6 on: October 05, 2011, 02:47:49 am »
Thanks for the input.  I've got the lump code working.
I want to get an SMS on my phone when the scene runs.
How do I do that.

dshenson

Offline Ap15e

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1998
  • Karma: +12/-0
Re: NEWBIE HELP - SCENE PROGRAMMING
« Reply #7 on: October 05, 2011, 04:10:07 am »
You could install SND and use an Email to SMS gateway.

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3260
  • Karma: +192/-9
Re: NEWBIE HELP - SCENE PROGRAMMING
« Reply #8 on: October 05, 2011, 07:05:11 am »
I've got the lump code working.

Great.  What did you need to fix to get it to work?  You can help someone who searches and finds this topic in the future.

Offline dshenson

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: NEWBIE HELP - SCENE PROGRAMMING
« Reply #9 on: October 05, 2011, 11:32:59 am »
Here is the code that I have that works.  I still need to figure out how to get an alert to send me a text.  I'm going to try the SEND but need to figure out how to do that.


local deviceNo = 57
local period = 10
local SS_SID = "urn:micasaverde-com:serviceId:SecuritySensor1"
local armed = luup.variable_get(SS_SID, "Armed", deviceNo) or "0"
if armed == "1" then
    local tripped = luup.variable_get(SS_SID, "Tripped", deviceNo) or "0"
    if tripped == "0" then
        luup.variable_set(SS_SID, "TripPeriod", "0", deviceNo)
    else
        local tripPeriod = luup.variable_get(SS_SID, "TripPeriod", deviceNo) or 0
        tripPeriod = tonumber(tripPeriod)
        tripPeriod = tripPeriod + 1
        luup.variable_set(SS_SID, "TripPeriod", tripPeriod, deviceNo)
        if tripPeriod == period then
            return true
        end
    end
end
return false