PDA

View Full Version : Elk Plug-In Release



harleydude
January 16th, 2009, 05:49 PM
Enhancements described in this post http://www.promixis.com/forums/showthread.php?t=19121

Additional Enhancements:
Analog Zone Polling
Added support to add outputs above 64 from configuration screen

Changes/Fixes:
Changed zones reporting from Violated/Normal to Not-Ready/Ready in order to stay inline with other Security related devices handled by the Device Manager.
Fixed bug in Keypad/Zone Temperatures not showing as devices
Fixed bug with setting Dim level below 10%
Fixed issue with sending a on/off command to an output already in that state

ElkM1EZ8 Plug-In 1.0.4 (http://www.promixis.com/download.php?ID=1036)

dsmes
February 16th, 2009, 09:31 PM
Thanks Rick for the update to a great plugin!

Two questions. First, I've noticed the plugin isn't sent or doesn't otherwise know when counter change take place from within the Elk system. For example, if I set up an Elk rule to toggle an output and increment a counter every 10 seconds, I see the output toggle in Girder but not the counter changing. However, I can see the counter increment on the Elk keypad display if I send it there.

If I add THEN SEND THE FOLLOWING TEXT: "|%CTR4%|" THROUGH PORT 0 to the Elk rule, I see the following in the G5 Lua Console:

LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Output 24 Condition Off
LOG: ElkM1EZ8 : 5 - ElkM1EZ8Class:OnReceiveIncompleteData() 769
LOG: ElkM1EZ8 : 5 - ElkM1EZ8Class:OnError()
where 769 is the counter #4 value sent from Elk. Is this an Elk problem of not automatically sending out counter changes? If so, can you suggest how I can capture text message sent by the Elk control (as in the 769 above)? By the way, from Girder, I can change the counter value with the "Write Counter" action and see that it changes (in G5 and Elk) so that part works fine.

My second question is shorter. How do you read analog values from an Elk zone defined as an Analog Zone?

harleydude
February 16th, 2009, 11:43 PM
Thanks for the compliment. Sometimes I wonder if anyone is really using it, as I don't hear to many comments or questions.

Elk does not send the counter values when they change. I spoke to Elk about this, their explanation was that it could flood the serial/TCP port with counter messages if the values were changing to often. When sending text from the Elk be sure to include ^M^J at the end of the string.

For the analog zones, in the plug-in settings under Other Settings, change the value of Poll Analog Zones to something other than zero. I do not have any analog zones, so I could not test this in a real environment. Please provide me with some feedback on this.

dsmes
February 17th, 2009, 06:15 AM
Hi Rick, That's a lame excuse by Elk but at least there appears to be a work-around. I've added the ^M^J and now I see this error in the Girder Log display
Time Date Source Details Payloads
05:04:08:322 2/17/2009 ElkM1EZ8 Error in callback OnReceiveData. See Lua console for more details

ans this in the Lua Console
LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Output 24 Condition Off
Error in transport callback OnReceiveData
...Promixis\Girder5\luascript\Classes/ElkM1EZ8Class.lua:512: attempt to concatenate local `msgType' (a nil value)
C:\Program Files\Promixis\Girder5\luascript\Classes/ElkM1EZ8Class.lua:512 in function <C:\Program Files\Promixis\Girder5\luascript\Classes/ElkM1EZ8Class.lua:470>
(tail call): ?
[C]: in function `xpcall'
Locals
pfunc : function: 09085D68
pargs : table: 09085CB8
arg : table: 09085CB8
func : function: 07CB67D0
Upvalues
clearLines : function: 05999AA8
errorHandler : function: 05999B98
C:\Program Files\Promixis\Girder5\luascript\Classes/Transport/Core.lua:1073 in function <C:\Program Files\Promixis\Girder5\luascript\Classes/Transport/Core.lua:1071>
Locals
self : table: 0C4F24A0
Event : Data: 32 32 22 Code: RXCHAR
Upvalues
Statuses : table: 07BE3208
C:\Program Files\Promixis\Girder5\luascript\Classes/Transport/Core.lua:1144 in function <C:\Program Files\Promixis\Girder5\luascript\Classes/Transport/Core.lua:1141>
Locals
self : table: 0C4F24A0
Event : Data: 32 32 22 Code: RXCHAR
Upvalues
ResponseCodes : table: 07BE4A10
C:\Program Files\Promixis\Girder5\luascript\Classes/Transport/Core.lua:840 in function <C:\Program Files\Promixis\Girder5\luascript\Classes/Transport/Core.lua:815>
Locals
EventCode : 1
EventData : 22
Event : Data: 32 32 22 Code: RXCHAR
Upvalues
self : table: 0C4F24A0
C:\Program Files\Promixis\Girder5\luascript\Classes/Transport/Core.lua:536 in function <C:\Program Files\Promixis\Girder5\luascript\Classes/Transport/Core.lua:533>
The counter value here was 22 which seems to be the correct data.

Regarding the analog values, the up/down arrows for "Poll Analog Zones" are grayed out and I cannot change the value from zero. I'll try re-starting everything after work to see if that helps.

harleydude
February 17th, 2009, 10:12 PM
I have been able to reproduce this error. In my test case I was sending COUNTER||%CTR1%|^M^J and it works fine. When the Elk sends user defined text, the plugin fires a ElkText event with the text sent as a payload. This way you can send any combinations of text and then parse it in Girder.

I will look into this some more and see if I can make it more reliable.

dsmes
February 18th, 2009, 09:14 PM
Rick, I added the "Counter" text in front of the "||%CTR1%||^M^J", restarted Girder, and now it seems to work- I can see the counter value in Payload 1. Note that it's a bit fuzzy if there is one or two pipe symbols (|) surrounding the %CTR1% in Elk but I let Elk add the counter value when editing the text string in Elk. I'm not sure why the error disappeared but am glad you were able to reproduce it. Thanks for helping me move forward.

As for the analog value of a zone, after restarting Girder, I am still not able to change the polling interval value in the settings tab.

harleydude
February 19th, 2009, 09:11 AM
I added the | right after COUNTER as a delimiter to parse the actual counter value. When inserting the counter variable in the Elk text there is only one | on each side of the counter variable.

I have reproduced the analog polling field and will upload a new file later today.

harleydude
February 19th, 2009, 08:41 PM
Try the file below. Download to the Girder5\plugins\ui folder.

dsmes
February 19th, 2009, 09:24 PM
Rick, Worked Great!!! I can change the polling time and I now see the Lua variable ElkM1EZ8.ElkEventServer.Analogs[7].Value being populated with the voltage value. Thanks so much.

dsmes
April 11th, 2009, 03:38 PM
Rick, Spring is (almost) here and I need to get my watering system GUI going. The watering valves are now controlled by Elk output relays and I can control them from an Elk Automation Control Output Action in Girder. What is the equivalent Lua code to control an output?

My plan is to have NR send a Girder event with a payload where the payload consists of the output number I want to control and an On/Off command. I know how to receive this event and parse the payload in Girder, but then I'm stuck. Within Lua on the Girder side, how do I control an Elk output? An example would be greatly appreciated.
----- edit
In looking at the ElkM1EZ8Provider.Lua, it looks like I could specify an "On" time in the command- Instance:OutputOn (num, time). An example of how to have time in the output command would also be welcome.

harleydude
April 13th, 2009, 04:45 PM
Here is some code that will do what you need.


local path = 'ncc-1701\\ElkM1EZ8\\Output 100'
local device = DeviceManager:GetDeviceUsingPath (path)

if not device then
print ('No Device')
end
local time=5
device.TimedOn = time
local control = device:GetControl ('Mode')
control:SetValue ('On')


Setting time = 0 should leave it in the desired state until command is issued again.

dsmes
April 13th, 2009, 08:36 PM
Thanks Rick, that worked perfectly!!! I also figured out the units of time are in seconds, in case others are interested.

dsmes
April 28th, 2009, 08:17 PM
Hey Rick,
I'm not sure if you can help me or if this is a question for Rob, but is there a way to shut off logging of Condition changes? Both the Log Display and Interactive Lua Console get quite busy. e.g.from Interactive Lua Console-
LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Zone 36 Condition Ready
LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Zone 49 Condition Not Ready
LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Zone 49 Condition Ready
LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Zone 49 Condition Not Ready
LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Zone 36 Condition Not Ready
LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Zone 50 Condition Not Ready
LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Zone 49 Condition Ready
LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Zone 36 Condition Ready
LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Zone 36 Condition Not Ready
LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Zone 36 Condition Ready
LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Zone 36 Condition Not Ready
LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Zone 36 Condition Ready
LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Zone 50 Condition Ready
LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Zone 36 Condition Not Ready
LOG: Device Manager : 2 - Device Event: Condition emma\ElkM1EZ8\Zone 36 Condition Ready
I've looked through the many DM files and can't quite figure out which one has all these log/print commands. If you just point me to what line of what file to comment out, that would be great. TIA!

Rob H
April 28th, 2009, 09:02 PM
File|Settings then select Device Manager from the Automation group on the left and go to the Logging tab. You can change the console log level from there

dsmes
May 23rd, 2009, 12:48 PM
I've got timeline charts in NR that show the status & historical activity for my 64 Elk zones. In the NR Lua, I register the Elk zone changes to trigger a function to update the chart with the following:

for x=1, 64 do
NetRemote.RegisterVariableWatch([[computer\ElkM1EZ8\Zone ]]..x..[[\Condition]], Motion.SensorChange)
endThis is working great but now I'd like to move all the NR Lua code to Girder. The first problem I ran into is how to trigger an event to run the Motion.SensorChange function. You see, in the Log Display, a typical zone change looks like:
Time Date Source Details Payloads
10:56:40:204 5/23/2009 Device Manager ElkM1EZ8\Addition Motion:Condition=Not Ready
but to use this to trigger the function, I'd need to capture all 64 DM events. Is there an easier way?

The only thought I had was for the DM to report "ElkM1EZ8 Event" and to put "Addition Motion" in Payload 1 and "Condition=Not Ready" in Payload 2. Then, a single event could trigger my Motion.SensorChange function for all 64 zones and I could grab (or parse) the payloads to determine the zone and condition, which my function also needs. Is there a way to accomplish this within the existing plugin code framework?

Rob H
May 23rd, 2009, 05:34 PM
You can do this from a bit of Lua in Girder - see gir.AddEventHandler in the help, you can use a regular expression (unfortunately with a different syntax from Lua regular expressions though) to handle several events.

dsmes
May 24th, 2009, 12:18 PM
Thanks for the quick reply. It worked great once I figured out the Device Number for ElkM1EZ8 was 9999. Thanks again.

Haddock
March 22nd, 2010, 08:49 PM
For some reason, I don't seem to be getting any activity after starting discovery:

03/21/10 10:45:28 INFO Initialized
03/21/10 10:45:28 INFO STATUS: Ok Connecting
03/21/10 10:45:28 INFO Opening Connection 192.168.1.8 2601
03/21/10 10:45:28 INFO First Connected
03/21/10 10:45:28 INFO STATUS: Ok Connected
03/21/10 10:45:28 INFO Connected after 1 attempt
03/21/10 10:45:28 INFO STATUS: Ok Connection to panel established
03/21/10 10:45:29 INFO STATUS: Ok Starting Discovery

Any suggestions? All my zones are wireless, if that matters.

quixote
March 10th, 2011, 03:41 AM
I could use a little assistance in getting this to work on my system. On the Security page of the component manager I can find the configuration for my Elk after enabling the component. It says that the status is "OK (Connecting)", but none of the actions are populated by any devices in the drop-downs.
I am able to connect to my Elk panel through RP no problem.
TIA