Posts: 133
Threads: 25
Joined: Feb 2010
09-05-2014, 10:31 PM
(This post was last modified: 09-05-2014, 10:34 PM by avtexan.)
I am working on my alarm panel and I am really stuck. I am using the V2 driver. The basic setup I want is to hit the alarm source button at the bottom, select the mode on the left, and then enter a 4 digit code. I would like to not have to hit enter and have it complete after the 4th digit is in. This is the same procedure on the HAI keypad and I want to keep it consistent.
The source button and keypad are working fine. My issue is with sending the command to the driver.
The way I have it now GVar:ArmMode is created on preload. When the buttons on the left are selected they write to GVar:ArmMode the appropriate value (Away, Night, etc). This seems to be working OK.
When I hit enter (which as I said above I would like to eliminate) I am not getting any love. My thoughts were to look at GVar:ArmMode and if it is NOT Off then run the Arm if it is off run the disarm.
If Not GlobalVars::SetVariable
(Does this set the GVar? IF so how do I read it?)
P1=GVar:ArmMode
P2=Off
EntryFld::SendValue
P1=Alarm.InvokeCmd
P2=ArmArea : Area_1, %(GVar:ArmMode), \%(v)
Else
EntryFld::SendValue
P1=Alarm.InvokeCmd
P2=DisarmArea : Area_1, \%(v)
End
Thoughts?
Posts: 40,483
Threads: 491
Joined: Aug 2002
You are setting the variable, when you want to be comparing it to a particular value. What's going to happen there is that it's always going to set it to Off, and the return value will only be True if the value changed.
You want to do this, to compare the value in ArmMode, to Off. You could of course remove the Not and just flip the two blocks around the other way as well.
If Not System::Equals(%(GVar:ArmMode), Off)
Else
EndIf
Dean Roddey
Explorans limites defectum
Posts: 133
Threads: 25
Joined: Feb 2010
Dean Roddey Wrote:You are setting the variable, when you want to be comparing it to a particular value. What's going to happen there is that it's always going to set it to Off, and the return value will only be True if the value changed.
You want to do this, to compare the value in ArmMode, to Off. You could of course remove the Not and just flip the two blocks around the other way as well.
If Not System::Equals(%(GVar:ArmMode), Off)
Else
EndIf
Thanks Dean! I will try that this afternoon.
Does the InvokeCmd part look OK? I don't have multiple areas so is it ok to call out that directly or should I use a GVar or the all area ($all$)?
Any other sugestions?
Posts: 40,483
Threads: 491
Joined: Aug 2002
You could always move the security area name to a global that you set in the main template Preload. That's not uncommon to set overall stuff like there and just keep it around. That way, if you need to do something different in different rooms later, you can handle that fairly easily by just changing those things once and everything else will pick up the change.
The command looks reasonable to me.
Dean Roddey
Explorans limites defectum
Posts: 133
Threads: 25
Joined: Feb 2010
I updated the InvokeCmd (See below) and that part is now working fine. Thanks Dean!
I have a couple of remaining issues:
1) When I hit enter it runs fine and the alarm responds correctly with what I am asking it to do (Night off, etc) But after it runs the IV shuts down.
2) I was also getting an error looking for the widget named StatusText. This was a widget created when I ran the auto generation and I had removed it from my template. I added it back to get past the error but I can't find what is calling for it. Is there a trigger somewhere?
3) Is there a way to eliminate the need for the enter button and have it run the action below when the 4th passcode digit is entered?
If System::Equals
P1=%(GVar:ArmMode)
P2=Off
P3=Case
EntryFld::SendValue
P1=Alarm.InvokeCmd
P2=DisarmArea : %(GVar:ArmArea), \%(v)
Else
EntryFld::SendValue
P1=Alarm.InvokeCmd
P2=ArmArea : %(GVar:ArmArea), %(GVar:ArmMode), \%(v)
End
Posts: 40,483
Threads: 491
Joined: Aug 2002
On #1, can you separate that out into a standalone template that just references the Omni but still causes that problem? Make a copy of it and strip everything out but the stuff related to login and hopefully it'll still cause the issue, then you can send me that and I can look at it.
For #2 bring up the action trace and run whatever it is that causes the error, and you should see where it's happening. It'll be the last command in the window presumably since it'll error out there, and you can look before that and see what was going on.
For #3, You could do that. You'd have to modify the login popup to watch for the number of characters added to the entry field that holds the text. When a new character is added, check the size of the text, which you can get from the entry field, and compare it to 4. If equal, then do what is now currently be done by the entry field.
What CQC version are you on?
Dean Roddey
Explorans limites defectum
Posts: 133
Threads: 25
Joined: Feb 2010
I got all three of my issues squared away. Thanks Dean!
#1 & #2 were a hidden widget that I found looking through the Palette. I now know to look there first.
#3 is working great!
EntryFld::Append
P1=1
//
EntryFld::GetText
P1=GVar

assword
GlobalVars::GetLength
P1=GVar

assword
P2=GVar

asswordLength
//
If System::Equals
P1=%(GVar

asswordLength)
P2=4
P3=Case
If System::Equals
P1=%(GVar:ArmMode)
P2=Off
P3=Case
EntryFld::SendValue
P1=Alarm.InvokeCmd
P2=DisarmArea : %(GVar:ArmArea), \%(v)
Else
EntryFld::SendValue
P1=Alarm.InvokeCmd
P2=ArmArea : %(GVar:ArmArea), %(GVar:ArmMode), \%(v)
End
End