my.Elk 2.3

I'm getting this error on statup:

Script error in file: my.elk.txt 13:Type mismatch: 'Cint' in line 853

My keypad temps and zones are all reporting properly though so not sure exactly what this error is. Just started playing with this (late tonight).
 
I am using this script with an Elk M1 Gold and did find one missing "feature" unless it is something I am doing wrong.

I use this script with HomeSeer 1.7 and I see the devices strings changing state properly (i.e. "Violated:Open", "Normal:Short", etc...) when they are opened or closed.

I want to use MainLobby to display a library button and have it turn red or green based on the status of a HomeSeer Elk Zone device (green = Normal or closed, red = Violated or open). The HomeSeer device values will be transfered to MainLobby via the MLHSPlugin.

When I set this all up the Elk's device "value" was not being transferred to MLServer/MainLobby and the library button was not changing color when the zone was open or closed.

After further investigation I found that this script is updating the HomeSeer device's "Device String" only and not the "Device Value". I can show this in the MLServer "variable listing" which shows the raw value for a HomeSeer device value and string. The string states showed up fine, the value did not change.

This represents a problem for anyone using the MLHSPlugin as this plugin will ONLY change a library button's color based on a HomeSeer device's VALUE. This VALUE can be a 0 or 1; or, for a dimmable device a 0 to 100.

I further proved this was a problem by "manually" turning a zone device "ON" or "OFF" by right clicking on the HomeSeer device and setting the "Device Command". When I did this the devices value transferred to MLServer correctly.

I then started to look at electron's excellent script and towards the end of that script saw that the devices were only being updated with the "hs.SetDeviceString" command.

Well, since electron already did all the hard work by looking for all the possible Elk device string values (with a Case Statement) I just added a command under each of those possible cases.

I added a variable "sValue" at the beginning of the last section.

When (I thought) the device string meant the zone was "violated" or "opened" I set the variable sValue to a 0.

When the device string meant the zone was "shorted" or "closed" I set the variable sValue to a 1.

I then added the following command after electron's "hs.SetDeviceString sDevice, sDesc" statement (where he sets the device string for a zone):
hs.SetDeviceValue sDevice, sValue

Now the devices values as well as their strings are updating correctly.

I tested this out with the Elk/HomeSeer/MainLobby setup and found the device's value updated properly along with its string. I only tested a few Elk device setup conditions including "Normally Closed", "EOL Supervised", and "Bypassed". I DID NOT test all of the combinations available (based on the zone's type).

I'm going to send electron the script so he can check it out for completeness (i.e. make sure I'm not doing anything stupid) but wanted to post this notice in case anyone else was using this script with the MLHSPlugin.

This is a great script and it's nice that he posted the source code so one can modify it based on their needs! This brings up some great possibilities. For instance to get a "custom" device string for the two device states, one would only have to add this value under the specific case statement that they wanted it to show up for (i.e. the condition of the device). Previously I had to do this via a modification/addition in the mlhsplugin.ini file. (You can also show the devices string with MainLobby, but to get a color change on a library button, the value is needed. Sometimes it's nice to have a library button change color and have a "text field" inside this button display the devices "string state").

So, again, great work on this script electron!!!

Well, since playing around with this I can really see a need for a HomeSeer device which represents the armed state of the Elk panel! I know this was mentioned before, just wanted to second (or third) this request!

Thanks again for the script and regards,

BSR ;)
 
I'm installing this script for the first time, and I am still a newbie with Homeseer (i'm using version 2.1)

I get the following error during start up:

3/17/2006 11:13:47 AM - Error - In OpenComPort, port already in use
3/17/2006 11:13:47 AM - my.elk:error - OpenSerialPort(): Error: Port in use

I tried disabling the Elk plug-in (thinking that it might be opening the port), and I rebooted the computer, but I still get the error.

Do you have any idea what may be wrong?

Thanks, Hemant
 
Probably something on your machine has the port that my.elk is trying to use. Have you configured the right serial port in my.elk? Try opening that port in HyperTerm.
 
I tried using hyperterm, and the port won't open with homeseer running. When I close homeseer, I can connect using hyperterminal.

I did configure the port in the my.elk.txt file.

And I deleted all files relating to elk-m1 plugin and acrf plugin (they were set to the same port previously).

still no luck
 
Can you switch to a different Com port on your computer just to try it out? Did you previously install Mark's Elk plugin?

Can you post your startup and shutdown files in HomeSeer here?
 
When I turn on debug,
I can tell that the script is opening the port properly, but it is still giving me an error:
In OpenComPort, port already in use

And the script won't function as it should
 
I had installed mark's plugin, but I think I have removed all signs of it.

heres a portion from my homeseer log (I don't see how to post a file on the board)



3/17/2006 1:18:47 PM - Info - Event Trigger "scriptmyelk"
3/17/2006 1:18:47 PM - Info - Running script in background: my.elk.txt("OpenSerialPort","")
3/17/2006 1:18:47 PM - my.elk:debug - OpenSerialPort(): COM4 has been opened
3/17/2006 1:18:47 PM - my.elk:debug - OpenSerialPort(): Synchronizing (bAutoSync=True)
3/17/2006 1:18:49 PM - my.elk:debug - SendToElk(): 04zsAF
3/17/2006 1:18:49 PM - my.elk:debug - SendToElk(): bAutoOpen = True, serial port will be opened if required
3/17/2006 1:18:49 PM - Error - In OpenComPort, port already in use
3/17/2006 1:18:49 PM - my.elk:error - OpenSerialPort(): Error: Port in use
3/17/2006 1:18:49 PM - my.elk:debug - SendToElk() execution time: 0 seconds
3/17/2006 1:18:51 PM - my.elk:debug - SendToElk(): 04csC6
3/17/2006 1:18:51 PM - my.elk:debug - SendToElk(): bAutoOpen = True, serial port will be opened if required
3/17/2006 1:18:51 PM - Error - In OpenComPort, port already in use
3/17/2006 1:18:51 PM - my.elk:error - OpenSerialPort(): Error: Port in use
3/17/2006 1:18:51 PM - my.elk:debug - SendToElk() execution time: 0 seconds
3/17/2006 1:18:51 PM - my.elk:debug - serial_processor(): D6CS00000..(truncated.)...000000000000000000000090 => LEN=D6 DATA=CS000(truncated)000000000000000000000000 CRC=90 MSG OK
3/17/2006 1:18:51 PM - my.elk:debug - outputstatus_processor(): received an update for all 208 outputs (00000000000000(truncated)00000000000000000000000000000000000000)
3/17/2006 1:18:51 PM - my.elk:debug - outputstatus_processor(): updating output 3 (x33)
3/17/2006 1:18:51 PM - my.elk:debug - serial_processor() execution time: 0 seconds
3/17/2006 1:19:02 PM - my.elk:debug - serial_processor(): 16XK4318136170306010006A => LEN=16 DATA=XK431813617030601000 CRC=6A MSG OK
3/17/2006 1:19:02 PM - my.elk:debug - serial_processor(): an unknown status update (XK) was received, update will be ignored
3/17/2006 1:19:02 PM - my.elk:debug - serial_processor() execution time: 0 seconds
 
The startup scripts hasn't changed from the original that came with homeseer. I had tried putting my.elk.txt in the start up, but pulled it out while trying to figure out why I was getting errors:
Startup:

sub main()
hs.WriteLog "Startup","Scripting is OK"

' if speaker client is not running, start it
if not hs.IsApplicationRunning("Speaker") then
hs.Launch("Speaker.exe")
end if

' speak
'hs.speak "Welcome to Home-Seer",TRUE

' add calls startup scripts and function calls here

end sub


Shutdown:
sub main()
' run any shutdown scripts here using hs.run "script name"
hs.RunEx "my.elk.txt","CloseSerialPort",""
end sub
 
hmmm, seems like something in HomeSeer is grabbing the serial port since you can connect with HyperTerminal when HomeSeer is shut down.

Can you switch serial ports?

The only other thing you might want to try is to manually close down that com port with a manual event which will run a script like:

hs.CloseComPort(1)

Then manually start the my.elk.txt with:

hs.RunEx "my.elk.txt","OpenSerialPort",""

Other than that I am not sure what to tell you.
 
I have my.elk working with HS 1.7 (see the status & keypad change), but I can't seem to get anything to show up in the log.

Any thoughts?

Also, is there anyway to get my.elk to update the last changed field for each zone?

Thanks,
lz
 
Back
Top