A C++ JSON API service for controlling a Jura coffee maker over Bluetooth using the protocol-bt-cpp library.
- RESTful JSON API for Jura coffee maker control
- Bluetooth connectivity using the Jura protocol
- Simple HTTP server with CORS support
- Easy-to-use endpoints for coffee brewing and device management
- CMake 3.14 or higher
- C++17 compatible compiler (GCC 7+, Clang 5+, MSVC 2017+)
- Bluetooth support on your system
mkdir build
cd build
cmake ..
makeThe executable jura-api-server will be created in the build directory.
Start the server with default port (8080):
./jura-api-serverOr specify a custom port:
./jura-api-server 3000Health check endpoint.
Response:
{
"status": "ok",
"service": "jura-api-server"
}Get API documentation with all available endpoints.
Get current connection status.
Response:
{
"connected": true,
"device_address": "XX:XX:XX:XX:XX:XX",
"ready": true,
"water_level": "ok",
"coffee_beans": "ok"
}Connect to a Jura device.
Request:
{
"device_address": "XX:XX:XX:XX:XX:XX"
}Response:
{
"success": true,
"device_address": "XX:XX:XX:XX:XX:XX"
}Disconnect from the current device.
Response:
{
"success": true
}Brew a coffee product.
Request:
{
"product": "coffee"
}Response:
{
"success": true,
"product": "coffee",
"message": "Brewing started"
}Send a custom command to the device.
Request:
{
"command": "CUSTOM_COMMAND"
}Response:
{
"success": true,
"command": "CUSTOM_COMMAND",
"response": "OK"
}Get information about the connected device.
Response:
{
"model": "Jura Coffee Maker",
"firmware": "1.0.0",
"device_address": "XX:XX:XX:XX:XX:XX"
}Connect to device:
curl -X POST http://localhost:8080/api/connect \
-H "Content-Type: application/json" \
-d '{"device_address": "AA:BB:CC:DD:EE:FF"}'Brew coffee:
curl -X POST http://localhost:8080/api/brew \
-H "Content-Type: application/json" \
-d '{"product": "espresso"}'Get status:
curl http://localhost:8080/api/status// Connect to device
fetch('http://localhost:8080/api/connect', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ device_address: 'AA:BB:CC:DD:EE:FF' })
})
.then(res => res.json())
.then(data => console.log(data));
// Brew coffee
fetch('http://localhost:8080/api/brew', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ product: 'coffee' })
})
.then(res => res.json())
.then(data => console.log(data));This project uses the following libraries (automatically fetched by CMake):
- nlohmann/json - JSON for Modern C++
- cpp-httplib - C++ HTTP server library
- protocol-bt-cpp - Jura protocol implementation
- main.cpp: Application entry point and signal handling
- api_server.cpp/h: HTTP server implementation with REST endpoints
- jura_controller.cpp/h: Jura device control and protocol integration
See LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.