HomeGenie Forum

General Category => Troubleshooting and Support => Topic started by: teo1969 on October 31, 2015, 09:20:22 AM

Title: newbie: how to get the status of Security Alarm System switch: armed or not
Post by: teo1969 on October 31, 2015, 09:20:22 AM
please, how can i read from program code (C#) the status of "Security alaram systsem switch: armed/disarmed"?. i need to report in a variable the status on/off or Armed/Disarmed of the Security alarm system switch.

Thx
Matteo
Title: Re: newbie: how to get the status of Security Alarm System switch: armed or not
Post by: nolio on October 31, 2015, 07:13:53 PM
Something like :
Code: [Select]
When.ModuleParameterChanged( (module, parameter) =>
{
    if (module.Is("Security Alarm System") && parameter.Is("Status.Level") && parameter.Value == "1")
    {
.....
    }
.....
}
1 : armed
0 : not
Title: Re: newbie: how to get the status of Security Alarm System switch: armed or not
Post by: Gene on October 31, 2015, 07:28:28 PM
Or if you just need reading the armed status you can use:

Code: [Select]
var securityAlarm = Modules.WithName("Security Alarm System").Get(); // or Modules.WithAddress("90").Get();
if (securityAlarm.Level > 0)
{
    // System is armed
}
else
{
   // System is disarmed
}

g.
Title: Re: newbie: how to get the status of Security Alarm System switch: armed or not
Post by: teo1969 on November 01, 2015, 01:03:58 AM
Perfect, thanks.
Title: Re: newbie: how to get the status of Security Alarm System switch: armed or not
Post by: Bitcraze on November 03, 2015, 08:47:18 PM
Hi, Gene

Another quick question regarding Alarm:

What type of text / commands can be entered into the "Program to run when armed" in the Alarm Options field?

I would like to receive some form of audio notification on my cellular (using your new HomeGenie Plus Android App - Super cool app!), when the Alarm is switched off, on or triggered.