more G-Labs products

Author Topic: newbie: how to get the status of Security Alarm System switch: armed or not  (Read 813 times)

October 31, 2015, 09:20:22 AM
Read 813 times

teo1969

  • *
  • Information
  • Newbie
  • Posts: 4
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
« Last Edit: October 31, 2015, 12:57:14 PM by teo1969 »

October 31, 2015, 07:13:53 PM
Reply #1

nolio

  • *****
  • Information
  • Global Moderator
  • Posts: 544
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

October 31, 2015, 07:28:28 PM
Reply #2

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
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.

November 01, 2015, 01:03:58 AM
Reply #3

teo1969

  • *
  • Information
  • Newbie
  • Posts: 4

November 03, 2015, 08:47:18 PM
Reply #4

Bitcraze

  • ***
  • Information
  • Full Member
  • Posts: 73
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.