my.Elk 2.3

electron

Administrator
Staff member
filename : my.elk.txt
version : 2.3
description : Monitor & control the Elk M1 Gold & M1 EZ8 alarm panel
author : Dan (electron)
email : dan at marstracker dot org

changelog:
  • version 2.3 (05032006): added a large documentation section, made some changes to the logging routine, implemented minor fixes.
  • version 2.2 (05012006): added support for arming and disarming the system, see command list below for more info, also added support for reading data from thermostats, added the thermostat_update command, and also cleaned up some code. See the my.elk.ini template above to learn how to map your thermostats.
  • version 2.1 (01042006): added delay to the sync command, in case the serial port isnt responding instantly. Also added support for syncronizing the control outputs. Changed some logic in the zones & outputs syncronizing, so it will only force a virtual device update if the status of the zone or output is not the same. my.Elk can now detect when ElkRP is connected to the M1.
  • version 2.0 (12202005): BETA status removed
  • version 2.0 (09292005): *** BETA *** added support for auto syncing: bAutoSync my.Elk can now process ASCII strings sent directly by the elk, using th RAW:COMMAND syntax. See below for more information.
  • version 1.9 (09282005): added the zs command to request zone status updates, internal changes, added support for a complete zone update, which is triggered when issuing the zs command (useful to keep Homeseer in sync with the M1 after a PC reboot
  • version 1.8 (08282005): switched to an INI file, trigger Homeseer events when a keypad button has been pressed
  • version 1.7 (08232005): added the bAutoOpen variable, new keypad_temp function to request a keypad temp reading, and added support for keypad temperature monitoring. Events can be triggered based on temperature by using the "Device Value Change" trigger.
  • version 1.6 (08222005): bug fixes
  • version 1.5 (08112005): added support for monitoring of zones, tasks, voltages and outputs
  • version 1.2 (08102005): added voltage_request
  • version 1.1 (08092005): added user definable settings
  • version 1.0 (08082005): added thermostat_set, customvalue_write, keypad_press, plc_raw, speak_phrase and speak_word
  • version 0.9 (08072005): first release
commands (descriptions & examples are given in the actual code):
  • arm
  • disarm
  • thermostat_update
  • zs
  • display_message
  • plc_on
  • plc_off
  • plc_toggle
  • plc_raw
  • output_on
  • output_off
  • output_toggle
  • speak_phrase
  • speak_word
  • keypad_press
  • customvalue_write
  • thermostat_set
  • keypad_temp
RAW command supported (example included):
  • speak (raw:speak:this is the phrase to speak)
  • event (raw:event:turn bedroom lights on)
  • device (raw:device:A2:eek:n)
Download:
 
It is meant to run with Homeseer for now, but it is pretty easy to port the code to something which would work with HAL, Girder, and any other scriptable packages. VBS files can be run from the command line as well, the only reason this script requires Homeseer is for the serial port interaction.
 
I posted the latest version, 1.5. It now supports monitoring as well. While the script isn't finished yet, I would definitely appreciate some input (no pun intended), so I can eliminate any potential bugs I might have missed.
 
OK, what am I doing wrong. Per the instructions, I tried putting my.elk.txt("OpenSerialPort","") in both the startup script and in an event. Both give me errors. It started with Cannot use parenthesis when calling a sub. If I remove the parens in the event, then I get error 0 in line 0.
 
I'm obviously not the guru on this script, but I did get it working by setting up an event like this....

link to first screenshot

And it seems to be working. Well, at least I can see zones changing status in HomeSeer.

I do have a stupid question though.....I can't seem to get events to fire based on zone status changes. I add the device - say "Security Motion Den" which is hooked to a motion in the den. I can see it change status from "Normal: Short" to "Violated: Open" however I can't seem to figure out what to trigger on to get reliable operation. As I was typing this, my wife walked into the Den and the event triggered, however that is the only time it has worked.....

link to second screenshot

Any ideas?
 
Sorry, I forgot to follow up on this, based upon a chat E and I had... the problem is that the script file was in Unix mode (LF only) and needed to be saved in DOS mode (CR/LF). I used conTEXT as a script editor and it allowed me to change the format.

I do notice that all the HS log entires seem to be "off", there are no "on"s.

To get events to trigger, I had to use a type of "device status change" and a status of "set off" or "set any status".
 
Yeah Wayne, I do see the same thing. When I am monitor "Set to off" my event fires with either opening or closing of a sensor.....
 
First off, good job. I'm liking the script better than the plugin already!

I thought I'd provide a 208 position array for folks to make life a bit easier. I use 200+ position outputs for stuff so needed this.

array("","","","","","","","","","","","","""","","","","","","","","","","","","","","","","","","","","",
"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","
","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","
","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","
","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
,"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","")


208 "", there...

Which makes me wonder. I use a couple of Elk outputs to let HS know the armed status of the Elk. Do you have a better way?

Thanks, contrary to your comments in the past, this script rocks.
 
I still have to add support for monitoring the 'armed status', and support for arming the panel (so you wouldn't have to use outputs). It's something I didn't do on purpose (security reasons) since I wanted to test the script first.
 
posted 1.7

the bAutoOpen variable (when set to TRUE) will force the script to automatically try to open the COM port when sending a command. This is useful if you don't want to automatically open the COM port at startup, and you aren't interested in processing incoming data (if you are, you would have to open the port during startup anyways). I added this to make debugging a little easier.

keypad temperature readings are now supported as well, you can tell the script to check the temperature by using the keypad_temp command, but the M1 should automatically send out temperature changes anyways (if configured correctly). It puts the value in the homeseer device string, but it also sets it as a device value, so you can trigger events, without any scripting, based on this temperature value (i.e: if x19 is greater than 70, ...).
 
Hi Electron, thanks for the cool script.

I have a question. Want to confirm this as a HS 2 bug and not my stupidity before I submit it to HS.

I want to add the my.elk script to startup and shutdown. Added the following to startup.txt

hs.run (my.elk.txt("OpenSerialPort",""))
and got
Running script, script run or compile error in file: startup.txt424:Object required: 'my' in line 21 More info: Object required: 'my'

Also tried

hs.run "my.elk.txt("OpenSerialPort","")"
and got
Running script, script run or compile error in file: startup.txt1025:Expected end of statement in line 21 More info: Expected end of statement

So am I doing it wrong, or is it a bug with having 2 "."'s in a filename that is screwing things up?

Thanks!
 
Back
Top