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