HomeGenie Forum

Development => Feature request => Topic started by: igorrobertifoc on April 01, 2015, 10:32:50 AM

Title: delay for siren on alarm
Post by: igorrobertifoc on April 01, 2015, 10:32:50 AM
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
Title: Re: delay for siren on alarm
Post by: igorrobertifoc on April 02, 2015, 04:36:29 PM
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);
Title: Re: delay for siren on alarm
Post by: bkenobi on April 02, 2015, 04:54:04 PM
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.
Title: Re: delay for siren on alarm
Post by: igorrobertifoc on April 06, 2015, 02:53:41 PM
Hello,
I used sirenstate variable for block after state 2.
Is it possibile to integrate on main HG for all?

Bye
Title: Re: delay for siren on alarm
Post by: bkenobi on April 06, 2015, 05:23:09 PM
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
Title: Re: delay for siren on alarm
Post by: igorrobertifoc on April 06, 2015, 07:52:15 PM
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
Title: Re: delay for siren on alarm
Post by: bkenobi on April 06, 2015, 09:08:01 PM
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.
Title: Re: delay for siren on alarm
Post by: gbremmer on October 27, 2015, 02:13:51 PM
Hi Gene,

Any news on this? I have implemented it as well.
Title: Re: delay for siren on alarm
Post by: gbremmer on October 27, 2015, 02:14:44 PM
I can also add the translation for Dutch and German for the Alarm system.
Title: Re: delay for siren on alarm
Post by: Gene on October 27, 2015, 04:52:32 PM
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.
Title: Re: delay for siren on alarm
Post by: KaZe on November 08, 2015, 10:48:01 PM
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.
Title: Re: delay for siren on alarm
Post by: Gene on November 08, 2015, 11:30:03 PM
Hi Kaze,

can't you disarm before entering home?

g.
Title: Re: delay for siren on alarm
Post by: KaZe on November 08, 2015, 11:35:36 PM
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.