more G-Labs products

Author Topic: delay for siren on alarm  (Read 2624 times)

April 01, 2015, 10:32:50 AM
Read 2624 times

igorrobertifoc

  • ***
  • Information
  • Full Member
  • Posts: 65
Hello.
I would like to add some time before the siren will be activated.
This is because maybe is my fault and I would like some time to turn off the alarm. The light will be turned on and off and the squeezebox will play alarm alarm... After 30 second will be nice that the siren will be turned on .
What do you think?

Thx

April 02, 2015, 04:36:29 PM
Reply #1

igorrobertifoc

  • ***
  • Information
  • Full Member
  • Posts: 65
What about this code?
Code: [Select]
if (Program.Parameter("HomeGenie.SecurityTriggered").Value == "1")
    {
       
      //
      var alarmstart = DateTime.Now;
      //
      // send email
      //
      var subject = "HomeGenie Security System Alarmed";
      var messagetext = "Security System Alarm triggered by " + Program.Parameter("HomeGenie.SecurityTriggerSource").Value;
      var recipients = Program.InputField("Email.Recipients").Value;
      if (recipients != "")
        {
          Program.RunAsyncTask(()=>{
      Net.SendMessage(recipients, subject, messagetext);
            });
        }
       
        var sirenstate = 0;
        while (Program.Parameter("HomeGenie.SecurityTriggered").Value == "1")
        {
       
          // flashing SecurityAlarm lights
            alarmModules.Toggle();
            Pause(1);
            alarmModules.Toggle();
            Pause(1);
          //
         
          var elapsed = new TimeSpan(DateTime.Now.Ticks - alarmstart.Ticks);
          if (sirenstate == 0 && Program.InputField("System.SirenStartTime").DecimalValue > 0 && elapsed.TotalSeconds > Program.InputField("System.SirenStartTime").DecimalValue)
            {
sirenModules.on();
              sirenstate = 1;
            }
         
          if (sirenstate == 1 && Program.InputField("System.SirenMaxTime").DecimalValue > 0 && elapsed.TotalSeconds > Program.InputField("System.SirenStartTime").DecimalValue + Program.InputField("System.SirenMaxTime").DecimalValue)
            {
sirenModules.Off();
              sirenstate = 2;
            }
        }
  //Pause(1);
        alarmModules.Off();
        sirenModules.Off();
    }
  Pause(1);

April 02, 2015, 04:54:04 PM
Reply #2

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
As long as you define elapsedTime and add the parameters to the widget, it might work.  I assume you will also be using the sirenstate variable somewhere else.

April 06, 2015, 02:53:41 PM
Reply #3

igorrobertifoc

  • ***
  • Information
  • Full Member
  • Posts: 65
Hello,
I used sirenstate variable for block after state 2.
Is it possibile to integrate on main HG for all?

Bye

April 06, 2015, 05:23:09 PM
Reply #4

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
If you are asking if the sirenstate parameter value can be accessed in other code, then yes.  You need to point to the value with something like:

Code: [Select]
Program.WithName("jkUtils - Solar Altitude").Parameter("jkUtils.SolarAltitude.Morning.Sunrise.Start").Value

April 06, 2015, 07:52:15 PM
Reply #5

igorrobertifoc

  • ***
  • Information
  • Full Member
  • Posts: 65
Thank you,
my question was to implement the code on the main installation in the next update..
I don't need to access from external app to the variable
Thx

April 06, 2015, 09:08:01 PM
Reply #6

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Ahhh, I see.  Well, that would be up to Gene.  It's already in the right location (Feature request).  I haven't tested the code, but if it's already working and would just be a copy paste for him, I'd give it a good shot of being included.

October 27, 2015, 02:13:51 PM
Reply #7

gbremmer

  • *
  • Information
  • Newbie
  • Posts: 23
Hi Gene,

Any news on this? I have implemented it as well.

October 27, 2015, 02:14:44 PM
Reply #8

gbremmer

  • *
  • Information
  • Newbie
  • Posts: 23
I can also add the translation for Dutch and German for the Alarm system.

October 27, 2015, 04:52:32 PM
Reply #9

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Just did that. It will be available with next release along with a bunch of other interesting stuff (before the end of this week).

g.

November 08, 2015, 10:48:01 PM
Reply #10

KaZe

  • ****
  • Information
  • Sr. Member
  • Posts: 219
Just did that. It will be available with next release along with a bunch of other interesting stuff (before the end of this week).

g.

Hi Gene!

Thanks for the delay option. I think you must use this parameter ("SirenStartTime") to e-mail send. Because, if I enter the house, and I turn off the security system a few seconds later,, the program send the e-mail to me, when I open the door. I think enough, the program will send a letter if an alarm siren has occurred.

November 08, 2015, 11:30:03 PM
Reply #11

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi Kaze,

can't you disarm before entering home?

g.

November 08, 2015, 11:35:36 PM
Reply #12

KaZe

  • ****
  • Information
  • Sr. Member
  • Posts: 219
No. I use my auto arm disarm program, which disarm it approx. 15 sec, if it see my phone in the private network. Or I disarm it from home controller (android tablet), when I enter the house.