Bluetooth LE access library for CANDY HOUSE SESAME 5 / SESAME 5 PRO / SESAME Bot 2 / SESAME 4 / SESAME 3 / SESAME bot / SESAME 3 bike (SESAME Cycle)
This library contains the message processing part. BLE connections must be handled outside of this library.
- Prepare a callback object inherited from
SesameClientBackend
- Create
SesameClientCore
instance. - Initialize with
SesameClientCore::begin()
andSesameClientCore::set_key()
. - Connect to SESAME by any BLE API (use BLE MAC Address of SESAME).
- Prepare to access service (UUID=
Sesame::SESAME3_SRV_UUID
). - Prepare to send data to Tx characteristic in above service (UUID=
Sesame::TxUUID
). - Prepare to receive notification from Rx characteristic (UUID=
Sesame::RxUUID
). - When notification received from above Rx characteristic, call
SesameClientCore::on_received()
with the notification data. - When
SesameClientBackend::write_to_tx()
is called, send the data to above Tx characteristic(w/o request response). - When
SesameClientBackend::disconnect()
is called, disconnect from SESAME. - When disconnected from SESAME, call
SesameClientCore::on_disconnected()
.
If your execution environment includes Mbed TLS's CMAC functions, define USE_FRAMEWORK_MBEDTLS_CMAC at compile time.
libsesame3bt is a library that integrates this library with the ESP32 / Android / NimBLE libraries.
With libsesame3bt, you can control SESAME as follows.
platformmio.ini
[env]
platform = espressif32
framework = arduino
lib_deps =
https://github.com/homy-newfs8/libsesame3bt#0.18.0
build_flags =
-std=gnu++17
build_unflags =
-std=gnu++11
using libsesame3bt::SesameInfo;
using libsesame3bt::SesameScanner;
void do_scan() {
SesameScanner& scanner = SeameScanner::get();
std::vector<SesameInfo> results;
scanner.scan(10, [&results](SesameScanner& _scanner, const SesameInfo* _info)) {
results.push_back(*_info);
}
Serial.printf("%u devices found\n", results.size());
for (const auto& it : results) {
Serial.printf("%s: %s: model=%u, registered=%u\n", it.uuid.toString().c_str(), it.address.toString().c_str(),
(unsigned int)it.model, it.flags.registered);
}
}
using libsesame3bt::Sesame;
using libsesame3bt::SesameClient;
using libsesame3bt::SesameInfo;
void do_unlock_lock() {
SesameClient client{};
// Use SesameInfo to initialize
client.begin(sesameInfo.addr, sesameInfo.model);
// or specify bluetooth address and model type directory
client.begin(BLEAddress{"***your device address***", BLE_ADDR_RANDOM}, Sesame::model_t::sesame_5);
client.set_keys(nullptr, SESAME_SECRET);
client.connect();
// Wait for connection and authentication done
// See example/by_scan/by_scan.cpp for details
client.unlock(u8"**TAG**");
delay(3000);
client.lock(u8"***TAG***");
}
- ESPHome External Component esphome-sesame3
Starting with version 0.8.0, the Sesame Server feature has been added, allowing the device to pretend to be a SESAME 5 device and listen for and handle push button events from CANDY HOUSE Remote/nano and open/close events from the Open Sensor.
See libsesame3bt-server library for usage.
MIT AND Apache-2.0
Almost all code is licensed under MIT-style license. Files under src/mbedtls-extra are licensed under Apache-2.0.