What is CasaiKey? How is it Changing The Way The World Travels?

By Casai Hardware Tech Lead, Alfonso Brown Gonzalez

Year-over-year, the market of Smart Home products is experiencing an impressive 25-30% compound growth rate worldwide. However, for a lot of products, being ‘smart’ simply consists of adding a remote control in a smartphone app. At Casai, we believe connected devices have the potential to make our spaces more intelligent and change the way our guests travel for the better. The Casai Key, our home-built door locks system, is the perfect example of this.


CasaiKey is responsible for four main things:

  1. Setting and removing codes. This includes codes for reservations, housekeepers, maintenance, and/or visitors.
  2. Tracking the state of the locks and their batteries. We use this to know when a door is left open, when it gets jammed, and to preemptively replace the batteries before they run out.
  3. Logging everything that happens with the lock. Every time it is opened, and who opened it, so we can act in case of an emergency or suspicious activity. 
  4. Opening and closing the door remotely. Guests can open their door remotely through their Casai mobile app. 
Tech in Hospitality: Smart Lock1
Tech in Hospitality: Smart Lock2

Lock Communication


The magic of CasaiKey relies on making a variety of different types of smart locks and brands work within one common system. This happens in two steps:


Low-level communication

The first step is communicating directly with the lock, or with the API of the lock’s provider. This communication usually happens with a low-battery consumption protocol, such as Z-Wave or BLE (Bluetooth Low Energy). This step is handled by Butler, our in-apartment home automation server. Butler is connected to our backend server with a bidirectional communication tunnel, used for receiving commands and notifying events. This forms a star topology with all the Butler servers connected to a central server. A simplification of this is shown in the below image.

Simplification of star topology used to communicate with the smart locks.
Simplification of star topology used to communicate with the smart locks.

The CasaiKey API

The second step is gathering all of the data and translating all the different formats into one common HTTP API. This is the resource that Casai’s web backend and apps use to interact with the locks. It is also the way in which our internal ERP (Odoo) communicates with the devices so that Tech-Support, Guest Experience, Sales, and Operation teams can see what’s happening and interact with the locks. For all of them, it doesn’t make any difference if the lock is brand X communicating through Z-Wave, or brand Y communicating through BLE. The UI in Odoo, with locks of different integrations and protocols can be seen in the image below.

UI in odoo showing many locks from different brands and protocols. In odoo, all the locks behave equally, and all the status labels, battery reports, and buttons for controlling are the same.

Backend of CasaiKey

The CasaiKey backend is based on a task queue, where all the operations, including codes, are scheduled and run at specific time intervals by separated processes. This makes our whole system asynchronous, allowing it to process thousands of requests per minute.

Task Queue
Diagram of the backend architecture, based on a Task Queue and an Events Queue connecting a web server and asynchronous workers.

Whenever we want to send a command to the lock, instead of saturating the traffic of our servers by running it immediately, it will be pushed to the queue, scheduled, and handled by a separate worker. If the communication with the lock fails during a scheduled task, it will run again at the next available time interval, until it completes successfully, or is no longer relevant. The whole process of a code being created can be seen in the image below.

Code Scheduling
Sequence Diagram showcasing how a code is scheduled and set.

The same is true the other way around. When an event happens in a lock, instead of going directly to our servers and database, it is published to a queue-like service such as Google’s IoT Core and Pub/Sub. From there, it is processed by all the subscribers needed. Some subscribers can trigger alarms in Slack when the door is jammed, or when there are too many failed attempts to enter a code. Other subscribers store the events in a Data Lake such as BigQuery, which we then use through Metabase to create useful dashboards, analytics, and visualizations.


So, what does that mean for you, a Casai guest?

One of the key products Casai offers is touchless check in, with little to no interaction required. This has become increasingly important during the pandemic, with contactless support being the safest solution. Unique codes are generated for each reservation and they are scheduled to be set at the time of check-in and scheduled to be removed as soon as you check out. That means you can enter your apartment at any time, and because there are no physical keys required, there is no risk of losing them and getting charged an extra fee!


Security-wise it is also a lot safer than a traditional hotel. You can be rest assured knowing that your code is unique to your reservation. Even the codes used by housekeepers and maintenance staff are temporary and are only set for a few hours around work hours (except in case of emergencies, of course!). If it wasn’t enough, we can easily change your code upon request if you feel the need.

Guest in Casai apartment

Internally, it also simplifies our operative processes and improves our security. When a new reservation is created, the Casai web will create a task and schedule everything to run on its own. Granting a guest an early check-in or a late check-out also updates the schedules automatically. That way we don’t even need to think about changing a unit’s code. Creating a code for new employees is as simple as clicking a couple buttons and filling in their names. And if there are any problems with a unit, we get alerts in Slack that notify the IT support and maintenance teams promptly. 


The future of CasaiKey

It hasn’t been easy to get to where we are. CasaiKey has had many iterations and is constantly at the forefront of our minds. We are thinking about how we can improve your experience every day by building new automations that will run when you enter or leave the apartment, like turning on/off the lights or playing music. If you have any suggestions of features you’d like to see, please reach out to us!


We want CasaiKey to be the first of many products that take IoT to a whole new level. At Casai, we strive to get the most out of every connected device we install. We believe that it is one key to providing better and smarter stays, and to revolutionize the way you live in our units. 


With this, we want CasaiKey to be the first of many products that take IoT to a whole new level. At Casai, we strive to get the most out of every connected device we install. We believe that it is one key to providing better and smarter stays, and to revolutionize the way you live in our units. 

If you want to experience this technology, and see for yourself how we are changing the way we travel, book now!