top of page

Building a virtual keylock

Updated: May 7, 2020

Time to cook: 120min

Difficulty: +++++



In a previous recipe we retrofitted our garage door. In this recipe we will cover the keylock Application. Using Node Red, we are going to build a virtual keylock, simulating the exact behavior of it’s physical version. A user can enter a code from 4 upto 8 digits within a certain timeframe. If the code entered matches the programmed code, the keylock will control a dry-contact for a few seconds, which is used as a trigger to open or close the garage door.











 

Ingredients


  • Node-red-contrib-ui-led

  • Node-red-dashboard


Prerequisites

  • Cook recipe Retrofit the garage door

  • Cook recipe Installing Node-RED

Tools

 

The Building plan


The following flow shows how you can build a Virtual keylock using Node-Red.



For this Node-Red flow you need the following nodes installed:


  • Node-red-contrib-ui-led

  • Node-red-dashboard


The virtual keyboard is made out of 12 template dashboard nodes. Each representing a number or function.


The template widget can contain any valid html and Angular/Angular-Material directives. This node can be used to create a dynamic user interface element that changes its appearance based on the input message and can send back messages to Node-RED.


For example for number 1:


<md-button class="vibrate filled touched bigfont rounded" style="background-color:#2980b9" ng-click="send({payload: '1'})"> 1 </md-button>


The configuration of the node looks as follows:





The output of the template dashboard nodes are collected on a Join node which sequences the messages into a single message within a certain time span. I used 3 seconds in this example.




A function node is then used to compare the message with a pre-defined code.

In case it matches, it sends a payload “ON”. A delay node is used to reset the payload to ‘OFF”. This simulates a pulse which we will use to open or close the garage door. A UI-LED dashboard node shows the pulse state.


Now we can wire everything together.


An OpenHab node is used to control the smart implant. An on/off command is issued with a 2 sec delay to simulate a pulse on one of the 2 dry contacts available on the Smart implant. This dry-contact is physically connected to the door switch contact of my garage door controller.


We use the openhab2-out node which is installed by default when we install Node-red on top of OpenHab on the Raspberry-Pi.




- Configure the controller as follows:




  • For ItemName, select the switch_binary item from your Zwave Smart Implant.

  • Select ItemCommand as msg.topic



The complete node-red flow for this recipe can be downloaded here



virtual keylock
.zip
Download ZIP • 3KB


9 views0 comments
bottom of page