Premise [download] A new Home Class called "Lock"

Motorola Premise

etc6849

Senior Member
index.php
File Name: A new Home Class called "Lock"
File Submitter: etc6849
File Submitted: 06 May 2011
File Updated: 15 May 2011
File Category: Premise
Author: etc6849
Contact: post issue in forum
Version: RC6

This is a Lock home object I've developed that includes a plug-in for the automation browser, offering full two-way status. It requires a code to engage the lock (if you don't want to use a code, set the UserCode under User1 to "" MaxCodeLength to 0). It supports as many users as you want and records the following to track users:
1. who operated the lock last via a property call "LastUserName"
2. the time each user last used the lock
3. each users access count (e.g. number of locks/unlocks)
4. and the action they last performed (e.g. lock or unlock).

I plan to use this home object along with an updated VRC0P module once z-wave lock support is added (later this month). Support will be included for minibrowser at a future date, for now only automation browser support is included. I'm working on a new version of miniBrowser that will work with this plug-in. This new version also includes support for many more home objects (up to 17 objects now and counting).

Instructions
1. You'll need to paste the two gif images called "Lock.gif" and "Unlock.gif" into ..Premise\SYS\web\Plugins\Images.
2. Then go to Modules, right click import and browser to the xdo file.
3. Right click under Home and navigate to "Lock" to add a home object of type lock.
4. Bind the lock object with a device object that has a boolean property that follows the naming convention discussed below.
5. By default one user is automatically created when the "Lock" is constructed under any Home object. However, you can change the number of users by increasing or decreasing "NumberOfUsers" property found under the home object of type "Lock." You would then navigate to the automatically generated children under the lock, changing their name and setting their usercode as you see fit.
6. To use the plug-in navigate to the lock using internet explorer, type the code, then click the lock or unlock buttons. Each time the lock and unlock buttons are clicked, all input codes are cleared (e.g. properties "keypadBuffer" and "InputCode").
7. If two-way feedback status is unreliable from your lock (or not offered at all), then set the property "ForceValue" to true. This will cause a state change to always be forced by the unlock and lock methods.

Naming Conventions
Since the Home class called "DoorSensor" gives a value of false for the property "DoorOpened" when a door is closed, I decided to follow a similar naming convention where "Unlocked" is given a value of false if the lock is in the safe position (e.g. locked). I may add an invert option later that will allow you to bind this with a device object that doesn't follow this convention, but I'm probably not going to until I find that such a module exists. The name "Lock" is used instead of "DoorLock" since the module could be used for any type of lock. After all, who knows how far this z-wave thing will go... Z-Wave enabled safes, tool boxes and liquor cabinets are next?

How to use the lock object in a ScriptMacro
Assuming you have created a home object called home.FrontDoorLock...

To unlock in a script:
Code:
home.FrontDoorLock.Unlock "1234"

Note, if you don't want to use a code, you can always setup a user with a code = "". Then you could call unlock like this:
Code:
home.FrontDoorLock.Unlock

Stuff is installed to these directories
sys://Schema/Modules/Locks
sys://Schema/Modules/Plugins/ControlsLibrary/Lock
sys://Schema/Modules/Plugins/Selectors/ClasslessSelector/Lock

Click here to download this file
 
Back
Top