[RELEASE] Virtual Keypad

I have a virtual keypad set up and it works fairly well except I can't figure out how to integrate using security codes (for example - to disarm) the keypad works to disarm if i list button HSM-disarm under the device as not requiring a code, but as soon as I remove that entry, when I try to disarm then the entryDisplay says the command is "input denied" and nothing happens.
Can anyone help me with the steps to allow code entry on the virtual keypad to authorize disarming?

Did you setup key codes directly in the keypad device? If the command is not specified in the 'does not require code' setting, you need to enter a code first, then press the command. When you press the command button, it will check your input code against any you saved in the keypad device.

Edit. You can also use the 'lock code manager' app to manage users/pins for the keypad

1 Like

Hi, Thanks for your reply. I am brand new as you can see from how many posts I've made! Love your virtual keypad. It was just what I was looking for as I wanted to "repurpose" an old android phone as a keypad near my front door. I had to do some reading (the main thing was figuring out the quirks of Hubitat device and app config set-up in a browser) and then was able to get the Lock Code Manager to work with your virtual driver.

I like that HSM codes are set up to require a code by default and that you've made a way to skip that in the config.
I wish there were a way to require code access to other buttons like my garage door opener. I may be able to do something programatically to use the keypad to set a virtual switch prior to allowing the garage door button to activate another rule, or something.

Fun stuff!

Sean

Welcome to the community, I'm sure this will all make more sense after you have played with it for a bit. This app/driver is definitely not the easiest to setup, so I know it can seem frustrating to get it to do what you want if you have little experience with the rest of Hubitat, but its easy to learn with enough motivation and help from the community.

For other commands you want to have keycode protected, use the app to create custom commands.
for example, for your garage door:
Create custom command in app: GarageDoor
after saving the app, it will create a new child device for your keypad: Custom-GarageDoor

By default, this button will require code input before pressing like the hsm commands. When it executes after a successful code entry it will turn its switch value on, then off (momentary on switch).

Using Rule Machine, you can use the Custom-GarageDoor child device switch as a trigger (when switch turns on) to run a rule to open/close your garage door.

Let me know if you need any more help getting the custom commands setup. They can allow you to add pretty much any functionality that can be triggered by a switch to the keypad, including alexa/google home routines by exposing the custom child switch to those services.

I am getting errors when trying to set any command on the virtual keypad like Exit delay, Entry delay, code, etc.

Example error:
groovy.lang.MissingMethodException: No signature of method: user_driver_mbarone_Virtual_Keypad_1560.setExitDelay() is applicable for argument types: (java.math.BigDecimal) values: [60] (setExitDelay)

Any ideas?

If you are talking about the input options directly on the keypad device, then some of those do not work. They are included by default with the keypad capability, and have not been utilized for this implementation.

On the keypad device, the only inputs you can set are:
Set Code Length
Set Code
Delete Code

If you get errors with any of these 3 commands, post the error and what input you tried to set.. like setting '20' for set code length gave an error (and paste the error here)

All other configuration is handled by the child app that creates the keypad device.

Any entry/exit delay for hsm specifically, can be set in the hsm app configuration. There is a delay function for the keypad that can be set in the child app.

Let me know if additional clarification/support is needed.

Thanks for the replay that helps a lot!

"Set code Length" works but "Set Code" does not work and attached a picture of my input and error.

set_code

2020-12-12 11:33:19.137 am errorjava.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer on line 613 (setCode)

hmm.. thats interesting.. the input fields are in a different order in your screenshot compared to my install:

image

The function that sets the code needs those parameters in a specific order (code position, pin code, name), like seen in my screenshot, which would be reasonable that you are getting the error because its expecting an integer and its getting a string.

Which version of the virtual keypad are you using.. the "virtual keypad" (with the app to manage settings) or the "virtual basic keypad"? was this installed from HPM or installed manually?

I wonder if trying to use the Lock Code Manager app to set/manage the pins would work as that should format the data correctly for the function to handle. (at least this could be used until the root issue is resolved).

edit.. what HE version are you on? im still running 2.2.3.148, so I cannot comment on 2.2.4.xx yet as far as if something changed with the built in Lock Codes capability

edit2.. here is the hubitat documentation for the Lock Codes capability, which shows how it looks on my end, and how it was implemented in the driver:

Hubitat Documentation

link: Driver Capability List - Hubitat Documentation

LockCodes

Device Selector

capability.lockCodes

Driver Definition

capability "LockCodes"

Attributes

codeChanged - ENUM ["added", "changed", "deleted", "failed"]

codeLength - NUMBER

lockCodes - JSON_OBJECT

maxCodes - NUMBER

Commands

deleteCode(codeposition)

codeposition required (NUMBER) - Code position number to delete

getCodes()

setCode(codeposition, pincode, name)

codeposition required (NUMBER) - Code position number

pincode required (STRING) - Numeric PIN code

name optional (STRING) - Name for this lock code

setCodeLength(pincodelength)

pincodelength required (NUMBER) - Maximum pin code lentgh for this lock

Using lock manager does work as a workaround for this issue.

I also rolled back to 2.2.3.142 and the issue was resolved and then rolled forward to 2.2.4.xxx and it broke again. So this issue does look related to the 2.2.4.xxx firmware.

Thanks for all your help!

I have been able to get Virtual Keypad to work except saving lock codes. When I try to set the code with the following entries, I get "java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer on line 613 (setCode)"

Screenshot 2021-01-18 144932

When I try to use all integers (since for some reason the name field appears to be causing an error) I get: "changeIsValid:false, codeNumber 1 is larger than maxCodes of 20".

Screenshot 2021-01-18 145207

I have no idea what I am doing wrong. The Lock Manager does lot show any codes, but it does detect the Virtual Keypad. I don't think any codes are saved even though I have tried it 100 times.

Thanks in advance for any help.

@mkhuffman2000, yes, I just upgraded to 2.2.4.158 from 2.2.3.148 and the built in command for Set Code has the inputs in the wrong order from what the function is expecting. This is a non-documented change (see my post above with a link to the hubitat docs) so I assume this should be fixed in an upcoming Hubitat update.

Until this is resolved (either Hubitat update fix, or they update the docs to represent the new change and I will update my function code) you can use "Lock Code Manager".

Its pretty straight forward to use "Lock Code Manager", in the app:
create a new user which will bring you to this screen, enter the details and click "Add this lock code"

This successfully worked for me just now.

Thanks @mbarone! I have no idea why Lock Code Manager didn't work when I tried it the first time, but I just duplicated your test in my instance and it worked fine. Thanks for building the keypad!

@mbarone Great app! This works great for me, and helped improve the Wife Approval Factor considerably! I do have one request though. Would it be possible to cancel the delay countdown if we type in our code and hit 'cancel alerts' or 'disarm all'? Currently, there's no way to stop the countdown timer from what I can tell. If there is, please let me know. There are times when we type in our code to leave, and then remember something, so we'd like to be able to cancel the delay before it sends the command to HSM to arm. Otherwise, you have to wait for it to arm and then disarm HSM. Great work though, much appreciated!

1 Like

Glad its working well for you and the WAF karma keeps flowing back my direction.

Cancelling the timer has been on my todo list for a bit. Due to the way the timer function was implemented, there's not an easy way to make this change, but its something i will look at when i have time to update the code next.

would you prefer a code gets entered (is required) to cancel the timer? or what if you hit the clear button 1 or 2 times?.. like the panic button.

In the mean time, I use the custom-ReArm command to leave the house when hsm is armed. It will turn the keypad-Custom-Disarm child device switch on (I have a RM rule to watch this and disarm HSM). Then wait the set armDelaySeconds before turning keypad-Custom-Arm child device switch on (RM watches this and arms HSM when it turns on).

I prefer the code to be required to cancel the timer countdown. That would mimic how my old ADT alarm panel worked, and also ensure that someone doesn't come in right behind us when we leave and just have to hit cancel to stop the alarm from being armed. I like your method of arming using the custom-ReArm. I'm still working on a way to get a piezo buzzer to beep every second or two while the timer is counting before the system is armed and that may help by using RM. Again, trying to replicate what the traditional alarm panel would do with it's exit delay notification. I've only been playing with this for a week, but it's working great so far, and definitely has potential to be even better. It's combined with a Konnected board as well. Many thanks for the reply and ideas.

Virtual Keypad
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

after the update, you should go into the keypad child app, and save it. In the app you can configure the chime option before saving.

If the chime option is enabled, after saving the app a new child device "Keypad (Chime)" will be created. Use the Keypad (Chime) switch (on) as a trigger for your RM/etc rule to send chime/etc to your speakers/devices.

You can also add a blinking 'led' that lights up with the child chime device on your keypad dashboard.
to do this, add the child chime device to the keypad dashboard as a switch. Position it in the top left position and apply the following custom CSS:

Chime Child Device CSS
/* Chime Switch --  #tile-20 is my chime child device */
#tile-20 .tile-title {
    display: none;
}
#tile-20 .material-icons {
    display: none;
}
#tile-20 {
    border: none;
    height: 10%;
    width: 10%;
    margin: 10px;
    border-radius: 50% !Important;
    pointer-events: none;
}

You also will want to customize the switch template (this should be the only switch on the dashboard) so that the "off" background is fully transparent, and the "on" background is what ever color you want your indicator to be. See here in action:

2 Likes

@mbarone Dude, you rock!! I just updated Virtual Keypad and did the CSS changes for the indicator LED, and it works great! The ability to cancel the countdown and hit that chime every couple of seconds really makes this come together as a full replacement for my old ADT system. My wife thinks I'm such a nerd when I get excited over stuff like this, but hey, nerds rule! Thanks for the update, it looks great!

I'm trying to get this set up for my HSM system, and I'm having trouble with the HSM-armAway button on the keypad I've set up. I've installed the Virtual Keypad, not the Virtual Basic Keypad. When I click the Keypad HSM-armAway button, it throws an error in the logs, and the InputDisplay reads "Setting armAway in 30 seconds" but it doesn't count down.

Logs:

[dev:506] 2021-02-13 10:17:55.721 pm [error] groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.Integer#div. Cannot resolve which method to invoke for [null] due to overlapping prototypes between: [class java.lang.Character] [class java.lang.Number] on line 392 (buttonPress)
[dev:506] 2021-02-13 10:17:55.691 pm [debug] clearCode
[dev:506] 2021-02-13 10:17:55.687 pm [debug] HSM-armAway executed with no entered code
[dev:506] 2021-02-13 10:17:55.684 pm [debug] checkInputCode

My hub is on platform version 2.2.5.131.

I ran into a problem not being able to set the PIN, but installed Lock Code Manager and added one from there. Is there also a problem with HSM-armAway? I can use HSM-armNight and it works fine, and I can enter a PIN and use HSM-disarm (ArmAway and armNight don't require a code in the Keypad settings). So far it's only the HSM-armNight that I've found won't work for me.

Once I added a 30s delay to armNight, and then it also had the same problem:

[dev:506] 2021-02-13 10:37:16.576 pm [error] groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.Integer#div. Cannot resolve which method to invoke for [null] due to overlapping prototypes between: [class java.lang.Character] [class java.lang.Number] on line 392 (buttonPress)
[dev:506] 2021-02-13 10:37:16.535 pm [debug] clearCode
[dev:506] 2021-02-13 10:37:16.534 pm [debug] HSM-armNight executed with no entered code
[dev:506] 2021-02-13 10:37:16.531 pm [debug] checkInputCode

I just pushed an update to fix your issue. The last update was a big change to the way the timing system worked, so i couldnt test everything, thanks for providing good bug feedback. Let me know if this update resolves the issue for you.

After each update, you should go into the child app that controls your keypad device and then hit 'done' even if making no changes to ensure any new options that have been added get pushed to the keypad device from the app. Theres probably a better way to do this automatically Ill have to look into.

Virtual Keypad
V1.0.11: 2021-02-13

  • bugfix - timer errors out when delay chime is not configured.

Just updated and that worked!

Thanks :slight_smile: