I see the status of my Schlage lock (469), i.e. locked or unlocked. I am trying to toggle the status from HSTouch. However, I only see the command lock and unlock but not toggle. How can I toggle the lock/unlock status of the lock?
Announcement
Collapse
No announcement yet.
Toggle Status of Schlage Lock
Collapse
X
-
Ok, I was looking into this again. It seems the only way to do this is with a script. It can be done directly in HStouch with a single script statement. In ActionsWhenPressed or ActionsWhenReleased create an action "HomeSeer: Run a HomeSeer script with values from elements(s)". For Script enter the string below. ScriptProcedure will be automatically set to "Main". Just ignore that. Replace [Insert Reference ID] with the reference ID of the lock which you can find under the advanced tab of the device.
hs.CAPIControlHandler(hs.CAPIGetSingleControl([Insert Reference ID], true, (hs.DeviceValue([Insert Reference ID again]) == 255) ? "Unlock" : "Lock", false, false));
For more control you can write an actual script that goes into the script folder. For the parameter pass it the reference ID of the device.
using System;
public void Main(string id)
{
string LogID = "Lock Control"; //This will be displayed in the log file under column "Type/Error".
int nLockStatus;
int nLockRef;
if ((nLockRef = Convert.ToInt32(id)) == 0)
{
hs.WriteLog(LogID, "Invalide input parameter " + id + "Please provide a single input parameter that is the device's reference ID which can be found under the Advanced tab of the device");
return;
}
nLockStatus = hs.DeviceValue(nLockRef);
if (nLockStatus == 255)
{
//Device was locked. Unlock it.
hs.CAPIControlHandler(hs.CAPIGetSingleControl(nLockRef, true, "Unlock", false, false));
}
else if(nLockStatus == 0)
{
//Device was unlocked. Lock it.
hs.CAPIControlHandler(hs.CAPIGetSingleControl(nLockRef, true, "Lock", false, false));
//hs.CAPIControlHandler(hs.CAPIGetSingleControl(hs.GetDeviceRe fByName("Downstairs Entrance Door Lock"), True, "Lock", False, False))
}
else
{
//Unknown status. Just try to lock it.
//Note for Schlage Camelot
// 1 = Unlocked with timeout
// 16 = Unlocked from inside handle
// 17 = Unlocked from inside handle with timeout
// 32 = Unlocked from outside handle
// 33 = Unlocked from outside handle with timeout
// 254 = Unknown status
hs.CAPIControlHandler(hs.CAPIGetSingleControl(nLockRef, true, "Lock", false, false));
}
}
-
Create 3 events. See the images below.
Then ins HSTouch designer add an image that shows the status of your lock.
Add an Action When Released that runs the Event "Toggle" that calls the other 2 events.
You can then click the lock image and the lock will toggle between Lock and Unlock.--
Jeff Farmer
HS 3, HSPhone
My HS3 Plugins: CFHSExtras, Random, Restart, Tracker, WeatherXML, PanaBluRay
Other Plugins In Use: APCUPSD, BLOnkyo, Device History, EasyTrigger, HSTouch Server, PHLocation2, Pushover, RFXCom, UltraGCIR3, UltraMon3, UltraPioneerAVR3, X10, Z-Wave
Hardware: GoControl Irrigation Controler, Schlage Lever Lock, Schlage Deadbolt, Way2Call Hi-Phone, RFXCom RFXrec433 Receiver, WGL 800, TI-103, Z-Net, Pioneer 1120, Pioneer 1021, Pioneer LX302, Panasonic BDT-110, Panasonic BDT-210 x2
- Likes 1
Comment
-
THANK YOU!!!
Genius! This worked perfectly, cant thank you enough as this is just what I needed. Hope to be able to return the favor somewhere somehow. The abilities of HS3 are vast...but difficult to uncover so users like you are truly the ones that extol the value of this system!
I am doing well on graphics and navigation, so if I can assist you in any way in this area, please let me know.
Regards,
John
Comment
-
I struggled with this as well and posted a reply to an older thread https://forums.homeseer.com/showthre...13#post1325113
While the aforementioned Events are an elegant solution, the conditional "Other Events are True" wasn't obvious to me, so I went with a vb script. Which was a great learning experience.
...
1) create 3 manually triggered events (Script, Front Door Lock, Front Door Unlock)
2) Lock and Unlock are simply setting node to lock or unlock
3) Script has the following code
This goes in the program files/homeseer/script folder
Code:''Lockscript.vb Sub Main(parms as Object) Dim devStatus = hs.DeviceValueByName("Vestibule Door Lock") Select Case devStatus Case 255 hs.TriggerEvent("Front Door Unlock") hs.Speak("Unlocking the Front Door") Case 0 hs.TriggerEvent("Front Door Lock") hs.Speak("Locking the Front Door") end Select end Sub
Finally,
4) Create a button in HSTouch Designer. I like to give it status tracking of the door lock. And Action when pressed is the Front Door Lock Script.
Comment
-
Originally posted by Tomadoggy View PostJust FYI...tried the "9000" for toggle on my Schlage and it does not work regardless of multiple changes in that setting...any other ideas?
Dec-09 10:51:18 AM Z-Wave Error Z-Wave Exception processing Z-Wave command type COMMAND_CLASS_DOOR_LOCK_V2. Error=Arithmetic operation resulted in an overflow.
Dec-09 10:51:18 AM Device Control Device: 1st Floor Main Door Lock to Toggle (9000) by/from: CAPI Control Handler
Comment
-
Originally posted by happnatious1 View PostDid you try adding 9000 to status. Thats what tells hstouch to add a toggle.
Comment
-
Originally posted by morrisdl View PostThank you Jeff for the events!
Which program did you use to create your floor plan? Looks great!
Sent from my iPad using TapatalkHS4 4.2.6.0 &HSTouch Designer 3.0.80
Plugin's:
BLBackup, BLOccupied, BLShutdown, EasyTrigger, Ecobee, Nest, AK Bond
EnvisaLink DSC, PHLocation, Pushover, SONOS, Blue Iris, UltraRachio3,
weatherXML, Jon00 Alexa Helper, Network Monitor, MyQ, Z-Wave
Comment
-
Originally posted by The Profit View PostWhich program did you use to create your floor plan? Looks great!
Sent from my iPad using Tapatalk
ThanksHS4 4.2.6.0 &HSTouch Designer 3.0.80
Plugin's:
BLBackup, BLOccupied, BLShutdown, EasyTrigger, Ecobee, Nest, AK Bond
EnvisaLink DSC, PHLocation, Pushover, SONOS, Blue Iris, UltraRachio3,
weatherXML, Jon00 Alexa Helper, Network Monitor, MyQ, Z-Wave
Comment
Comment