Using Alarm for At Home Presence

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by dtuohy, Feb 19, 2012.

  1. dtuohy

    dtuohy

    Joined:
    Feb 19, 2012
    Messages:
    3
    Likes Received:
    0
    Location:
    Sydney
    Not an experienced installer, so appreciate the consideration :)
    Programming some logic using PAC to turn on some usual lights when HOME (stairs, garden etc). And when NOT HOME, to turn on some 'look lived in' lights.
    I am using the alarm panel interface to indicate if someone is home or not (alarm activated, deactivated etc). The simple scenario is easy and have programmed as such. But I tried to add some logic such that if the alarm was deactivated during a NOT HOME situation, or alternatively turning alarm on during the HOME time. My code works 95% correct but find one or two scenarios when unexpected happens. I also feel my approach is not optimal of trying to toggle the HOME - NOT HOME situation. I was hoping someone may have some pointers on structure etc or have done this before.
     
    dtuohy, Feb 19, 2012
    #1
  2. dtuohy

    Newman

    Joined:
    Aug 3, 2004
    Messages:
    2,203
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    The information you've provided is a little brief. Some information about how the systems change from being HOME and NOT HOME and the various alarm states (alarm activated, deactivated etc) would be helpful. For example, is the HOME / NOT HOME mode set by a switch by the front door or is it set by the alarm system? What are the different methods that can be used to change the state of the security system? How many different states does your alarm system have?

    Once you have all this information, I'd draw up a table of all possible state combinations and what you wish to have occur on each transition.

    Often these sorts of problems are more about understanding the logical states and transitions required than the technical ability to implement them. :)
     
    Newman, Feb 20, 2012
    #2
  3. dtuohy

    dtuohy

    Joined:
    Feb 19, 2012
    Messages:
    3
    Likes Received:
    0
    Location:
    Sydney
    Thanks Newman
    I am using PICED v4.10..
    The alarm (NESS 16X) activate/deactivate is simply toggled by wireless fobs. They are the only states I am concerned for this purpose and i just use the GetLightingState on the group address for alarm.

    So my basic logic goes along the lines of:

    once time = sunset then set stair lights ON;
    Delay a random time over 15 min;
    if alarm status is ON then set Security Lights ON (lived in look);
    if alarm status is OFF then set At Home Lights ON;
    WaitUntil 10:00pm;
    if alarm status is ON then set hallway then bedroom lights ON (using a random timer etc);
    Delay a random time over 15 min;
    if alarm status is ON then turn all lights OFF.
    (if the alarm status is OFF then I don't do anything assuming person will turn all off when they desire)

    All the above is simple and works fine as you would expect.
    The problem(s) looking for a simple solution:
    1. If I come home after sunset and before 10pm and deactivate the alarm, I want the Security Lights off and the At Home Lights on;
    2. If I leave the house and activate the alarm after sunset and before 10pm, I want the At Home Lights off and the Security Lights on;
    3. What to do if I come home, or leave home during the 15 minute random timer activities?
    Does this explain?
     
    dtuohy, Feb 20, 2012
    #3
  4. dtuohy

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    In a separate module have some code which does this:

    Code:
    once alarm status is OFF then
    begin
      if time is between sunset and 10PM then 
      begin
        set Security Lights OFF;
        set At Home Lights ON;
      end;
    end;
    In the same module as the one above have some code which does this:

    Code:
    once alarm status is ON then
    begin
      if time is between sunset and 10PM then 
      begin
        set Security Lights ON;
        set At Home Lights OFF;
      end;
    end;
    Store the random value used for the timer in a variable called RandomDelay (for example), then change the above code to :

    Code:
    if time is between sunset and 10PM + RandomDelay then ...
     
    Darren, Feb 21, 2012
    #4
  5. dtuohy

    dtuohy

    Joined:
    Feb 19, 2012
    Messages:
    3
    Likes Received:
    0
    Location:
    Sydney
    Darren, thanks for the response. However, I don't believe you have captured the requirement! (sorry)
    The use of the once operation means that something only occurs on a change of state of the alarm. So in your code, how do the lights turn off when there has been no change of alarm state? Also, what happens if the alarm has been OFF for 24 hours and hence no change of state, then the At Home Lights won't come on!
    Therefore the alarm state cannot be using as the trigger...the time of day must be! Sunset and 10PM occur every day, the alarm state cannot be relied upon as it can change (or not change) at any time.

    Perhaps you may understand my original problem :)
     
    dtuohy, Feb 21, 2012
    #5
  6. dtuohy

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    I was proposing using my code in addition to what you already have. Together they should solve the problem, although it is not 100% clear what your requirements are.
     
    Darren, Feb 21, 2012
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.