Openhab : door access control


I’m very new in Openhab. I think my project is very new, google was not able to return something equivalent.
I would have you opinion if this project can be run on openhab/Pi platform.

Here my idea:

To avoid the use of keys, I’ve put electric strikes on garage doors and in the inside & outside my gates (total of 5 access points). The strikes and driven by keypads.
I need the allow the access to the housekeeper, the postman … and to all the members to my family.
Here the problem : we share all the same access code, and a don’t want to give everyone the access every time.
So a have to give a specific access PW to each one and manage access periods (2 periods/day) and restrictions for each PW (ex : PW1 -> Access Monday: 8:00 to 11:00 and 13:00 to 17:15 and so on for each day).
A would build this “access table” through openhab.

I hacked a keypad and I found the way to graft an Arduino + RFM69 to drive the electric strike.
The access table would be send from openhab to the Arduino so they can read the keypad inputs, verify the accessibility and drive the strickes.

Now my question… Can this be done by openhab ? and thank you for your help !

This can easily be done with openHAB, though I would implement a lot of this on your Arduino.

Configure the keypad/Arduino to only send the full code when it is fully entered (e.g. after pressing ‘#’). What ever you use to bridge the RFM69 to IP will forward that full code string to OH. I like MQTT for this.

OH will receive the code and trigger a rule that checks the code is valid an the time periods to see if the door should open. If so it sends an MQTT message back to the gateway which forwards it to the Arduino over RFM69. The Arduino then opens the door.

I recommend making sure you implement encryption on the RFM69 and potentially implement some other time based signature or token to avoid replay attacks (i.e. someone recording the RFM69 packet and playing it back to open the door).

Question: what sort of range and RSSI are you getting out of the RFM69s? I started implementing some sensors using them but I’m having terrible range and signal strength. I’m probably going to move to ESP8266s as a result.

That’s not exactly how I see the business !

For realability, it’s better to store the time table in the Arduino and let it manage the acces periods. I want to use OH only to create the time table and send it to the Arduinos.

I need many of datas such as

  • Access code
  • open/close times pour each code
    -> monday_open1_hour, monday_open1_minute, monday_close1_hour, monday_close1_minute
    -> thuesday_open1_hour, thuesday_open1_minute, thuesday_close1_hour, thuesday_close1_minute
    -> etc…

How and where would you store all of that ?
What with the link between code and his time table ?

Better to use SQL database or a TXT or XML file ?

And that is a problem. Arduinos do not have permanent storage. It can store the values in memory but that data will have to be resent to it in the event that the Arduiono restarts.

Since you want to put everything on the Arduino itself you would have to do this in the Arduino sketch code itself. Keep in mind most Arduinos have very limited memory so you will have a hard limit on how many codes and time periods you can support on any given device.

I know of no libraries that would let an Arduino access an SQL database. Most of the access libraries I’m aware of are larger than the amount of memory in the typical Arduino. It could theoretically reach out to a DB that has a REST API, but if you are doing that why not just have it reach out to OH?

The easiest to manage on the Arduino itself will probably a C style struct and push binary to it. Because the Arduino is so limited in memory you will chew through a lot of it just to support the libraries and code necessary to parse text or XML.

And for a comparison, pretty much all commercial systems of this type (i.e. those used in businesses) work just like I describe. The device at the door takes some input (pin, data from a smart card, etc), sends it to a central clearing house to decide whether that individual is authorized, and then returns an “approved” or “denied” message to the device at the door which opens or not the door lock. There is a reason they are implemented in this way.

If you do insist on implementing everything on the device at the door, I recommend using something with a bit more resources like a Pi Zero or even a full up Raspberry Pi. Then you have enough memory and permanent storage.

Finally, if all you are using OH for is to send these time periods and codes to the devices, OH is a poor choice for you. OH excels at communicating with lots of different devices and technologies (but not RFM69 directly though there is an experimental binding for Jeenode) but it is really poor for accepting free text or freeform input from the user on the UIs. There is no free text widget nor is there a calendar/time widget which allow you to enter arbitrary text or date times.