Virtual Keypad
Create Virtual Keypads to help manage HSM and Mode changes from any dashboard.
There are now 2 options for the Virtual Keypad. The full version which is explained in this first post, and a Virtual Basic Keypad which is outlined in post 2.
The Virtual Basic Keypad operates more similar to a hardware keypad, and only interacts with HSM. There are limited options, but this only uses 1 device and no children devices. Since this doesnt have children devices, the Virtual Basic Keypad does not offer triggers for RM or other apps.
If you want the Virtual Keypad to control Modes, HSM, and custom triggers, use the full version outlined in this 1st post below:
Components:
Apps: Virtual Keypad Manager and Virtual Keypad Child
Drivers: Virtual Keypad, Virtual Keypad Button Child, Virtual Keypad Input Display Child
Use:
Use the App/child app to create however many custom keypads you need. Each keypad can have its own codes and command button options which control who can access and what Modes or HSM options they can change.
Add Virtual Keypads dashboards to any/multiple existing dashboards using an included iFrame function built into the main Keypad Device.
Options:
Delay: Set a time delay for specific commands. ie: 30 second delay before executing Mode-Away after successful code authorization
Exclude commands from requiring a code: ie: HSM-Arm doesnt need a code entered before it will execute
Mode Options:
Change modes directly, or just issue the switch trigger so RM or another automation can manage your modes
Set a default mode that will be switched to first, before executing specific other modes. ie: before Away is set, switch to Disarmed then wait for the delay to execute Away mode.
HSM Options:
Change HSM directly or just issue the switch trigger so RM or another automation can manage your HSM state
HSM Cancel Alerts Option:
When enabled, any disarm commands (mode name has disarm in it,hsm disarm, or custom-disarm) are issued, it will also run HSM cancelAlerts
Notify on bad code entries
set device(s) you want to be notified on if bad code entries are used
set how many failed attempts between notifications
Installation:
Available in HPM (Hubitat Package Manager)
Manual installation by grabbing the above listed files from my github here (install all apps and drivers with title Virtual Keypad):
Add the custom app "Virtual Keypad Manager", and create a new Keypad Child. The Child app has basic settings for how you want this Virtual Keypad to operate. Codes are managed directly in the Keypad Device, or by using Lock Code Manager.
After the Keypad Child is saved, it will automatically create the Keypad device and all child devices.
The command buttons (HSM and Mode) all operate as a push button when used on a dashboard, but they also act as a trigger for custom external functions. They all have a switch capability that will turn on (and auto off) when any of the command buttons are used.
Creating the Keypad Dashboard
Create a new dashboard for each custom Virtual Keypad. You can manually build each keypad dashboard, or use the below template json and css as a baseline to get setup quickly.
For manually creating the dashboard, you will want to add the following Keypad child devices to the dashboard:
10 "number" buttons, with the "button number" set to the value of that button.. ie button 5 should have "button number" 5 set, etc.
1 (InputDisplay) set to use attribute: InputDisplay
1 (Clear) button, I set this to use the refresh icon
1 (Panic) Button, I set this to 'he-siren_and_alarm' icon
how ever many HSM or Mode command buttons you want
The Custom-Arm, Custom-Disarm, and Custom-ReArm are custom command buttons you can use to trigger RM or other automations for those functions. They do not change HSM or Modes unless you set something up that is triggered by their switch value. The Custom-ReArm command, when used, will first trigger the Custom-Disarm.on() switch and then trigger Custom-Arm.on() switch.
Remember
- buttons are used to submit the entered code and try to execute that function, but switches are used to trigger outside events/automations
If you use the below JSON and CSS, you will need to edit all the buttons to reference the correct device in your system.
Keypad dashboard JSON
{
"localization": "English",
"roundedCorners": 30,
"dateFormat": "MM/DD/YYYY",
"hideLabels": true,
"customColors": ,
"colWidth": "",
"cloudRefresh": 5,
"hsmPin": "",
"hide3dot": false,
"clockMode": true,
"gridGap": 8,
"tiles": [
{
"rowSpan": 1,
"template": "buttons",
"col": 2,
"colSpan": 1,
"id": 0,
"row": 5,
"device": "478",
"templateExtra": "0"
},
{
"rowSpan": 1,
"template": "buttons",
"col": 1,
"colSpan": 1,
"id": 1,
"row": 2,
"device": "478",
"templateExtra": "1"
},
{
"rowSpan": 1,
"template": "buttons",
"col": 2,
"colSpan": 1,
"id": 2,
"row": 2,
"device": "478",
"templateExtra": "2"
},
{
"rowSpan": 1,
"template": "buttons",
"col": 3,
"colSpan": 1,
"id": 3,
"row": 2,
"device": "478",
"templateExtra": "3"
},
{
"rowSpan": 1,
"template": "buttons",
"col": 1,
"colSpan": 1,
"id": 4,
"row": 3,
"device": "478",
"templateExtra": "4"
},
{
"rowSpan": 1,
"template": "buttons",
"col": 2,
"colSpan": 1,
"id": 5,
"row": 3,
"device": "478",
"templateExtra": "5"
},
{
"rowSpan": 1,
"template": "buttons",
"col": 3,
"colSpan": 1,
"id": 6,
"row": 3,
"device": "478",
"templateExtra": "6"
},
{
"rowSpan": 1,
"template": "buttons",
"col": 1,
"colSpan": 1,
"id": 7,
"row": 4,
"device": "478",
"templateExtra": "7"
},
{
"rowSpan": 1,
"template": "buttons",
"col": 2,
"colSpan": 1,
"id": 8,
"row": 4,
"device": "478",
"templateExtra": "8"
},
{
"rowSpan": 1,
"template": "buttons",
"col": 3,
"colSpan": 1,
"id": 9,
"row": 4,
"device": "478",
"templateExtra": "9"
},
{
"rowSpan": 1,
"template": "buttons",
"col": 1,
"colSpan": 1,
"id": 10,
"row": 5,
"device": "474",
"templateExtra": null,
"customIcon": "refresh"
},
{
"rowSpan": 1,
"template": "attribute",
"col": 1,
"colSpan": 3,
"id": 11,
"row": 1,
"device": "479",
"templateExtra": "InputDisplay"
},
{
"rowSpan": 1,
"template": "buttons",
"col": 4,
"colSpan": 2,
"id": 12,
"row": 1,
"device": "461",
"templateExtra": "1"
},
{
"rowSpan": 1,
"template": "buttons",
"col": 4,
"colSpan": 2,
"id": 13,
"row": 2,
"device": "464",
"templateExtra": "1"
},
{
"rowSpan": 1,
"template": "buttons",
"col": 4,
"colSpan": 2,
"id": 14,
"row": 3,
"device": "476",
"templateExtra": "1"
},
{
"rowSpan": 1,
"template": "buttons",
"col": 4,
"colSpan": 2,
"id": 15,
"row": 4,
"device": "475",
"templateExtra": "1"
},
{
"rowSpan": 1,
"template": "buttons",
"col": 4,
"colSpan": 2,
"id": 16,
"row": 5,
"device": "477",
"templateExtra": "1"
},
{
"rowSpan": 1,
"template": "buttons",
"col": 3,
"colSpan": 1,
"id": 17,
"row": 5,
"device": "528",
"templateExtra": "1",
"customIcon": "he-siren_and_alarm"
}
],
"goBack": true,
"modePin": "",
"bgColor": "Black",
"lanRefresh": 2,
"iconSize": 42,
"cols": 5,
"rowHeight": "",
"hideEvents": true,
"tempScale": "F",
"noColors": false,
"readOnly": null,
"rows": 5,
"hideIconText": true,
"name": "kptemplate",
"fontSize": 12
}
Keypad dashboard CSS
.header.flex {
padding:0 !important;
}
.wrapper {
overflow: hidden;
padding-right: 15px;
}
.dashBack.flex, .dashName.flex {
display:none;
}
.he-tap:before {
content: none;
}
.tile.button .tile-title, .tile.attribute .tile-title {
visibility: hidden;
display: none;
}
.tile.button .tile-contents, .tile.attribute .tile-contents {
height: calc(100%);
}
.tile.attribute .tile-primary, .tile.button .tile-primary {
padding:0;
}
#tile-1 .tile-primary :before {
content: "1";
}
#tile-2 .tile-primary :before {
content: "2";
}
#tile-3 .tile-primary :before {
content: "3";
}
#tile-4 .tile-primary :before {
content: "4";
}
#tile-5 .tile-primary :before {
content: "5";
}
#tile-6 .tile-primary :before {
content: "6";
}
#tile-7 .tile-primary :before {
content: "7";
}
#tile-8 .tile-primary :before {
content: "8";
}
#tile-9 .tile-primary :before {
content: "9";
}
#tile-0 .tile-primary :before {
content: "0";
}
#tile-10 .tile-primary :before {
#content: "Clear";
}
#tile-14 .tile-primary :before {
content: "Re-Arm";
}
#tile-15 .tile-primary :before {
content: "Arm";
}
#tile-16 .tile-primary :before {
content: "Disarm";
}
#tile-13 .tile-primary :before {
content: "Away";
}
#tile-12 .tile-primary :before {
content: "Party";
}
*refresh the dashboard after saving the JSON and custom CSS
These JSON and CSS files are available in my github if you are getting save errors copying from this forum:
Adding the Keypad dashboard to other Dashboards
Once you have the custom Keypad dashboard setup, use the main Keypad device to add this keypad dashboard to other dashboards. Get the direct link to the keypad dashboard, and add it to the iFrame preferences in the main Keypad device.
Add your main Keypad device to your other dashboard and specify attribute: Keypad
you will want to apply this custom CSS to any dashboard you add the Keypad iFrame to help format it better:
dashboard with iFrame CSS
/* keypad iframe specific - #tile-25 is the Keypad device attribute: Keypad */
#tile-25 .tile-title {
display:none;
}
#tile-25 .tile-contents {
padding: 0;
height:100%;
}
#tile-25 .tile-primary {
padding: 0;
}
Setting up the Panic Alarm using HSM
(instructions borrowed/edited from arnb's nyckelharpa app documentation)
A custom HSM Rule is required to force an HSM response to a Panic key press, enabling an instant Panic response even when the system is disarmed
- Click on Apps-->then click Hubitat Safety Monitor
- Click on Custom
- Click Create New Monitoring Rule --> Name this Custom Monitoring Rule-- enter Panic -->
- Rule settings What kind of device do you want to use: select "Tamper Sensor"
Select Tamper Sensors: check the Keypad (Panic) device when using HE drivers , click Update
What do you want to monitor?: Set Tamper Detected
For how long? (minutes): must be empty or 0
Set Alerts for Text, Audio, Siren and Lights
Click the "Arm This Rule" button
Click Done - Important: verify the Panic rule is "Armed" or it will not work
- Do a Panic test: Press the Virtual Keypad's Panic button and then a 2nd time within 5 seconds
- The Panic Alert may be stopped using any disarm command on the Virtual Keypad, if the option is selected to issue cancelAlert on any disarm which is enabled by default; or the "Cancel Alerts" button from HE App HSM options
Changelog:
Virtual Keypad
V1.0.22: 2021-12-05
- added new preference to modify modal css
V1.0.21: 2021-11-04
- fixed security issue found by @arnb and @scubamikejax904, and added an option to enable or disable.. enabled by default
V1.0.20: 2021-07-29
- added option to attempt auto centering of keypad when overlay iframe/button is used on dashboard
V1.0.19: 2021-07-12
- updated autoclose function to reset when manually closed. This will prevent the overlay from closing itself if you open it, then close it, and immediately open the keypad again.
V1.0.18: 2021-07-02
- added new Button Attribute to keypad device. This will allow you launch a modal overlay with the keypad on a dashbaord, instead of having it visible all the time. There are new preferences for the button in the keypad device.
V1.0.17: 2021-03-10
- removed the SecurityKeypad capability as this was causing issues when present with the LockCodes capability and is not needed for the functionality of this addon
- FIXED code entry/update/delete from the keypad device. You do not need to use the "Lock Code Manager" addon.
V1.0.16: 2021-02-16
- added support options to child app for getting a summary of versions and keypad settings to help troubleshoot issues
V1.0.15: 2021-02-15
- bugfix - proper handling of cancel countdown and update display
- added option in app to specify which delayed commands get the chime during the countdown
- added option to test chime from child device page with 'on' or 'push' commands
V1.0.14: 2021-02-15
- bugfix - forced setting a standard InputDisplayDefaultText if value is null which was causing issues with users upgrading as it wasnt getting set by default for some reason.
V1.0.13: 2021-02-15
- bugfix - clear the bad code immediately after receiving the 'Input Denied' so you could start entering a new code without appending to the old bad code before the 5 second timeout to clear the 'Input Denied' message.
V1.0.12: 2021-02-14
- added preference to customize inputDisplay default text
- bugfix - input display did not give feedback for bad code input or properly clear bad codes.
V1.0.11: 2021-02-13
- bugfix - timer errors out when delay chime is not configured.
V1.0.10: 2021-02-10
- Added option to cancel count down timer by entering an approved code and pressing any command button (not number, clear, or panic buttons) to cancel the timer.
- Added optional child Chime device, which is a switch trigger (turns on) for a RM/etc rule to send chime/sound/tone/beep/etc to your chosen speakers. Seconds between chime triggers are configurable in the app
V1.0.9: 2020-11-24
- Added user defined optional command list that will cancel HSM alerts when triggered.
V1.0.8: 2020-09-16
- Added user defined Custom-Commands into the app settings. These will create custom buttons to trigger outside RM/etc automations based on their switch value.
V1.0.7: 2020-10-09
- Added ability to choose which HSM/Mode/Custom buttons get child devices created, and will remove child devices that are no longer specified in the app. (you will want to open the app, and configure each keypad again after this update)
- Moved the iFrame preference setting into the main Keypad device. We no longer need the iFrame child device, or iFrame child driver. This will need to be updated if you use this option after updating.
V1.0.6: 2020-10-05
- lastCodeName attribute added
- details for triggering RM on this attribute is in this thread in post 15.
V1.0.5: 2020-10-05
- minor bump to add versions to all app/driver files
V1.0.4: 2020-10-03
- added capability securityKeypad for integration into HSM and other apps that require this capability
V1.0.3: 2020-10-02
- lastCodeName event added to successful code input
- Updated keypad dashboard JSON and instructions in this post
V1.0.2: 2020-10-01
- Added Panic button, updated keypad dashboard JSON in this post to include it
- updated instructions in this post to reflect new options and changes
V1.0.1: 2020-10-01
- updated to allow immediate code entry after bad code input without waiting for input timeout
V1.0.0: 2020-09-28
- Initial Release