Jump to content
C4 Forums | Control4

Working with Variable states based on Alarm settings


eggzlot

Recommended Posts

basic alarm has 3 states, disarm (no alarm), stay (alarmed with no motion sensors in my case), away (full alarm)

only 1 of these 3 can be the current state at a given time (duh!).  So i want to replicate that status in C4 using T/F variable logic.  I also do not want to create an endless loop and jam up my processor.

I have the Domo IT-100 driver.  What I am thinking would work:

When Partition 1 has been armed in Stay mode:

Variables Alarm stay = true
Variables Alarm away = false
Variables Alarm disarm = false

When Partition 1 has been armed in Away mode:

Variables Alarm stay = false
Variables Alarm away = True
Variables Alarm disarm = false

When Security Partition 1 has been disarmed

Variables Alarm stay = false
Variables Alarm away = false
Variables Alarm disarm = True

Would that accomplish it?  Do I need to add any stop commands or something else I am missing?

Link to comment
Share on other sites


12 minutes ago, sonic30101 said:

I would use a string variable named "alarm state" so it is 1 variable and the value can be anything then make conditionals for each of the 3 states you want to use

never used a string variable - will have to investigate.

this is what you are referring to?  https://www.control4.com/documentation/Composer_HE_User_Guide/Using_a_Custom_Variable_Agent_String.htm

thanks!

Link to comment
Share on other sites

I find it best to use a single variable for this - much easier to track what you are doing (providing you can remember what each value means :) )

I have a integer variable to hold alarm state - but I go to another degree.

I use variable 'Alarm_Status' with values from 0 to 7

I then have a macro which runs functions based on what the value of this variable is.

I then set the value of the variable from different points in the project.

ie: 

0 = nothing

1 = away pending (two min timer where house turns off and if dark, certain lights come on for 5 mins)

2 = press away on the alarm

3 = alarm is in armed state (send notification) (if garage door open send notification)

4 = motion sensed while armed (send notification if outdoor sensors motion)

5 = disarmed (send notification, change all LED from red to normal colours)

6 = alarm triggered (send notification)

7 = smoke alarm triggered (send notification)

 

 

Link to comment
Share on other sites

1 hour ago, Cyknight said:

Real question is WHY do you want to accomplish it? Those states are readily accessible in the driver already - you shouldn't need to 'write' it to anther variable.

I have some complex coding around security at my house.  I’ll try to explain...

If someone comes over and I am not home they put a code into my kwikset lock.  From there the door unlocks, alarm disarms and we get a text that XYZ person arrived.  Then when they leave, they press the lock button, door locks, alarm reverts back to where it was previously (Away, stay or doesn’t even go if it wasn’t on previously) and we get a text they left.  It worked very well for 3+ years.  I had some alarm work done, new zones added.  Got my zones updated and had an issue so the driver was reloaded and most of the programming had to be redone.  We did a lot of copy/paste work from previous projects known to be working, but something is up and I’m getting a bad variable loop that is locking up my system.  So i had 3 variable states, 1 per type (Away, disarm, stay).  So anywhere i can find those in the project I’ve disabled them.  I just tried to put 2 back in and poof, system got locked up again.  Rebooted, quickly removed them and now things are ok.

I am 100% open to a better way to achieve my goal.  I also have to add manual programming for the new zones if they get trigged in an alarm to send me a text.  Bruce’s idea above was interesting but I have 30+ zones.  Can I have a string of 30 variables?  

Link to comment
Share on other sites

2 hours ago, eggzlot said:

alarm reverts back to where it was previously

So simplified - when unlocked using user code - set a variable so that when locked again you can revert back to previous alarm state?

Unless I'm missing something (edit variable names etc as needed):


 

WHEN door is unlocked using [code/user]
IF Panel current state is Disarmed
	Set variable to 1
IF Panel current state is Armed to stay
	Set variable to 2
IF Panel current state is Armed to Stay
	Set variable to 3
Disarm panel
Send email xxxxx
WHEN door is locked using lock button
IF variable = 1
IF variable = 2
	Arm to stay
IF variable = 3 
	Arm to Away
IF variable is GREATER THEN 0 
	Send email yyyyyy
Set variable to 0

That would be all the programming needed to achieve it?

Link to comment
Share on other sites

8 hours ago, Cyknight said:

So simplified - when unlocked using user code - set a variable so that when locked again you can revert back to previous alarm state?

Unless I'm missing something (edit variable names etc as needed):


 


WHEN door is unlocked using [code/user]
IF Panel current state is Disarmed
	Set variable to 1
IF Panel current state is Armed to stay
	Set variable to 2
IF Panel current state is Armed to Stay
	Set variable to 3
Disarm panel
Send email xxxxx

WHEN door is locked using lock button
IF variable = 1
IF variable = 2
	Arm to stay
IF variable = 3 
	Arm to Away
IF variable is GREATER THEN 0 
	Send email yyyyyy
Set variable to 0

That would be all the programming needed to achieve it?

i think i did the same thing last night, was going to report back this morning.

I created a T/F variable (just more comfortable with those) called Guest Alarm Away and Guest Alarm Stay.  

When door is unlocked with user code...
IF SEcurity System > AWAY_STATE is True
    variable > guest alarm away = true
    disarm security
IF Security System > HOME_STATE is True
    variable > guest alarm stay = true
    disarm security
Email Notification send command
Variables > user door lock code = True

When I lock:
IF Variable Guest Away is True
    execute arm on alarm
    variables > guest alarm away = false
IF Variable Guest Stay is True
    execute arm on alarm
    variables > guest alarm stay = false
Email notification send command
Variables > user door lock code = False

I tested this out and it seemed to work just fine for both Stay and Away.  Now I have 9 user codes and 3 door locks, so I have a lot of coding to do to keep replicating it.

Slightly hijacking my own thread, but is there a better way to know what zone on the alarm is open when the alarm is going off?  Or just list each one as a conditional IF OPEN (when the alarm goes off) and send text messages?

Link to comment
Share on other sites

7 hours ago, eggzlot said:

 

Slightly hijacking my own thread, but is there a better way to know what zone on the alarm is open when the alarm is going off?  Or just list each one as a conditional IF OPEN (when the alarm goes off) and send text messages?

Depends on the driver but you could see if you can send trouble text variables extracted directly from the driver (agent supports this)

Link to comment
Share on other sites

2 hours ago, Cyknight said:

Depends on the driver but you could see if you can send trouble text variables extracted directly from the driver (agent supports this)

Tnx 

i have the Domo driver and some free time this weekend.  I’ll see what I can piece together 

Link to comment
Share on other sites

14 hours ago, South Africa C4 user said:

I also have the Domosapiens driver and that is what I do.

Does trouble event data give you a zone name?  In my variables that is just giving me a zone number.  And i did a broadcast and other variables can read the zone.  But those variables aren’t as useful.  

Link to comment
Share on other sites

1 hour ago, eggzlot said:

Does trouble event data give you a zone name?  In my variables that is just giving me a zone number.  And i did a broadcast and other variables can read the zone.  But those variables aren’t as useful.  

It should return whatever is programmed on the security panel - if nothing has been named on there, it would for sure only give you zone number feedback

Link to comment
Share on other sites

14 hours ago, Cyknight said:

It should return whatever is programmed on the security panel - if nothing has been named on there, it would for sure only give you zone number feedback

I am looking at the C4 interface now and all of my zones have a label.  My thought was I did the broadcast recently so maybe it was something my alarm guy tripped on purpose while resetting up the system and that was the last thing he tested and I did the broadcast after the fact.  So ok I'd accept that except I know for a fact my alarm guy finished on Friday and my GC tripped my alarm on Saturday and not because of that water sensor.  Would trouble event data be the last zone tripped because if so, it should be the front door because that is what my GC tripped.  I got a call from central monitoring station, etc.  So I know the dates/timelines, etc.  I can see zone names in last zone not ready, lcd display text and last zone restored.  The issue with the LCD Display text variable is when I tested it, the characters on the LCD scroll, so the first line is press < > to scroll to see open zones, then it refreshes and shows the open zone,  but the c4 variable only pulls in the first line which isn't too helpful.  Last restored would no tmake sense - last zone not ready to me sounds like prior to me setting the alarm, not while its in alarm state.

Link to comment
Share on other sites

1 hour ago, Cyknight said:

Again, that's in a large part going to depend on what the driver (and the panel I suppose) expose as available information.

I got DSC 1864 and the latest version of the driver from Domosapiens.

I may just do the manual programming "IF Zone is open" send text because its taking more time to figure out the variable programming and I could probably just knock off all the zone open/text send manually quicker!

Link to comment
Share on other sites

4 hours ago, eggzlot said:

I got DSC 1864 and the latest version of the driver from Domosapiens.

I may just do the manual programming "IF Zone is open" send text because its taking more time to figure out the variable programming and I could probably just knock off all the zone open/text send manually quicker!

I had my driver installed 10 years ago - and am pretty sure I have never changed it - I have a DSC with the IT100 module.

Never bothered trying to get additional info from the alarm panel.

I set a string variable to the name of the area/zone every time a sensor has motion detected.

I then include that variable as output in notifications. (ie: "*** Alarm Triggered *** Motion sensed in <Zone>")

works a treat, and (so far) never found a need to have the panel provide me further detail.

Link to comment
Share on other sites

On 1/30/2019 at 11:08 PM, eggzlot said:

Does trouble event data give you a zone name?  In my variables that is just giving me a zone number.  And i did a broadcast and other variables can read the zone.  But those variables aren’t as useful.  

Trouble Event Data does not do what you are looking for with this driver... Last Zone NotReady Name will give you the correct zone name 999 times out of 1000. 

Link to comment
Share on other sites

9 hours ago, South Africa C4 user said:

Trouble Event Data does not do what you are looking for with this driver... Last Zone NotReady Name will give you the correct zone name 999 times out of 1000. 

I hope my alarm doesn’t go off 1000 times to test your theory!

i certainly tried that zone.  I’ll have to reset.  Could be I was testing the zone I entered the house so was not getting refreshed enough?  I just know someone tripped front door but maybe I’m wrong and he tripped my basement door.  I’ll work on it today 

Link to comment
Share on other sites

On 2/1/2019 at 11:03 PM, South Africa C4 user said:

Trouble Event Data does not do what you are looking for with this driver... Last Zone NotReady Name will give you the correct zone name 999 times out of 1000. 

I did trouble event data, let a window open and did the "execute" command in Composer HE mimicking my alarm.  i got the right zone.  hopefully I do not have to use this in the real world but just in case we'll see how it goes.  Thanks!

Link to comment
Share on other sites

  • 3 months later...
On 1/29/2019 at 12:01 AM, Cyknight said:

So simplified - when unlocked using user code - set a variable so that when locked again you can revert back to previous alarm state?

Unless I'm missing something (edit variable names etc as needed):


 


WHEN door is unlocked using [code/user]
IF Panel current state is Disarmed
	Set variable to 1
IF Panel current state is Armed to stay
	Set variable to 2
IF Panel current state is Armed to Stay
	Set variable to 3
Disarm panel
Send email xxxxx

WHEN door is locked using lock button
IF variable = 1
IF variable = 2
	Arm to stay
IF variable = 3 
	Arm to Away
IF variable is GREATER THEN 0 
	Send email yyyyyy
Set variable to 0

That would be all the programming needed to achieve it?

Questions about this as I'm trying to implement a similar idea. What if someone else comes home before the person in question leaves and presses the lock button. I can see this happening where person in question leaves but doesn't press the door lock button so when someone else leaves hours later and presses the manual lock button then the alarm will try to arm the previous state as recorded in the sample program. OR if the second person comes home and person in question leaves and presses door lock,  then person inside could be stuck with alarm  arming away.

What if the second person inside leaves ( after the person in question and lock button not pressed) and arms the alarm to away but when person in question left the alarm was in stay mode. According to the programing the alarm will try to arm itself in stay mode, but the countdown for away mode would be running. 

I know I'm over thinking but I'm trying to cover all possibilities 

Link to comment
Share on other sites

On 2/1/2019 at 11:03 PM, South Africa C4 user said:

Trouble Event Data does not do what you are looking for with this driver... Last Zone NotReady Name will give you the correct zone name 999 times out of 1000. 

What if there are multiple zones not ready? Ie more than one window open?

Link to comment
Share on other sites

4 hours ago, ERDrPC said:

What if there are multiple zones not ready? Ie more than one window open?

I use zone groups to monitor this sort of thing and LEDs to give feedback (green - ready to arm, blue - zone open that may stop arming, red - armed, orange - failed to arm in last 15 minutes).  I also check various zone groups before arming and give feedback.

Useful zone groups that I have created include:

1. All windows.

2. All external points (doors and windows).

3. All zones that get armed (stay and away separately).

4. All zones from point 2 except the door that I am exiting through.

I tend to use changes to group 2 and 4 to change LEDs on arming buttons in our bedroom and next to various exit doors.

 

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.