Try it out
Walk Through a Real-World Workflow
Connect to a Lobby
We have set up a test lobby for you to try out the robot mode API before integrating with your own lobby. Follow these steps to establish a connection using wscat, a simple WebSocket client for testing:
1. Install wscat
If you don’t already have wscat installed, you can install it globally using npm:
npm install -g wscat
2. Connect to the Test Lobby
You can connect to a virtual version of any lobby by setting the testing parameter to true
Use the following command to establish a WebSocket connection to our test lobby. Replace <API_KEY> with your provided API key and <LOBBY_ID> with the test lobby ID. For this demo we will connect to our test lobby using
Lobby ID: lobby0
API Key: key1
We are going to add the testing parameter to connect to a virtual instance instead.
wscat -c "wss://api.liftauth.com/v2?lobbyId=lobby0&testing=true" -H "Authorization: key1"
3. Send Commands
Once connected, we can send some commands.
Enable Robot Mode
First, we need to enable robot mode to take control of the lobby.
{ "requestId": "req000", "command": "ROBOT_MODE_ON", "parameters": { "reservedLiftId": "lobby0_lift0" } }
You will receive an immediate ROBOT_MODE_ON_OK acknowledgment, followed by a ROBOT_MODE_ENABLED response when robot mode is fully active. Wait for the ROBOT_MODE_ENABLED response before proceeding.
Get Lift Position
Before calling the lift we need to know if the lift is already here.
The lift will fulfill all requests on a best effort basis, meaning it might not be fulfilled immediately.
Copy paste the following into the terminal and wait for a response.
{ "requestId": "req001", "command": "GET_LIFT_POSITION", "parameters": { "liftId": "lobby0_lift0" } }
Assuming the lift is already stationary at the same floor as the robot, we can proceed to enter.
Open the Door
Copy paste the following into the terminal and wait for a response.
{ "requestId": "req002", "command": "SET_DOOR_OPEN", "parameters": { "liftId": "lobby0_lift0" } }
Drive Robot In
This is the stage where you drive the robot into the lift.
Close the Door
Once the robot was in the lift, we can close the door.
Sending the close door request does not close the door immediately. It releases door control back to the lift so the lift system can close the door naturally.
Copy paste the following into the terminal and wait for a response.
{ "requestId": "req003", "command": "SET_DOOR_CLOSE", "parameters": { "liftId": "lobby0_lift0" } }
Send the lift to Floor 1
Once the door is closed, send a request for the lift to travel to that floor.
The lift might not service that floor immediately. It will visit intermediate floors especially if the lift is being shared by human passengers.
Copy paste the following into the terminal and wait for a response.
{ "requestId": "req004","command": "CALL_LIFT","parameters": { "liftId": "lobby0_lift0", "targetFloor": 1, "setOpenOnArrival": false }}
When the lift arrives at a floor, it broadcasts a message to the websocket. Wait until it arrives at your target floor.
After sending CALL_LIFT, you will receive a CALL_LIFT_OK acknowledgment, but you must wait for the CURRENT_FLOOR message to confirm the lift has arrived at the requested floor before proceeding.
Disable Robot Mode
Once you're done with the robot workflow, disable robot mode to release control back to the lobby.
{ "requestId": "req005", "command": "ROBOT_MODE_OFF" }