BN Adjustable Bed Mock API and Socket Interface
This project is not an official project of, and is in no way affiliated with, Blissful Nights or the Ronin Wifi mobile app
This project sets up an HTTP API and Socket Interface for the Blissful Nights Wall Hugger Adjustable Bed with Massage and Alexa Voice Command.
I can control the bed using the HTTP API or the mobile app without having anything connected to the official servers hosted in AWS.
I have the HTTP API hooked up to my iOS Shortcuts which allows me to use it in my automation.
Not all of the socket communication protocol is understood, but enough of it has been reverse engineered to provide this functionality.
Docker Hub Links
How to Use
To use it, you must hijack the DNS queries for cm2.xlink.cn and api2.xlink.cn and redirect them to your server.
api2.xlink.cn is used by the Ronin WiFi mobile app [ ios | android ].
cm2.xlink.cn is used by the bed. The bed creates a persistent socket connection to this address.
Use of the mobile app is required to perform the initial setup and get the bed hooked up to your wireless network. Once you have it setup, use of the mobile app is optional.
Mobile App API
The HTTP API is exposed on port 80 and provides endpoints that will allow you to log into the app without creating an account.
Setup
-
An example Docker Compose Config File is provided. It uses a default bridge network for communcation to the redis instance and configures the other 3 services to use an IP on a
macvlannetwork namedlan. Change<IP>in the example file based on your network, they all need to be unique. If you prefer, you could use the main Docker Compose Config File used for development as a start, it uses the default network and exposes the service ports through a single IP instead. In this case theBed Controller APIwill be on port8080instead of80. -
Setup a directory for the services and run Docker Compose to start the 4 services (Redis, App API, Bed Socket Interface and Controller API).
mkdir bn-adjustable-bed
cd bn-adjustable-bed
wget https://github.com/trevorlauder/bn-adjustable-bed/blob/main/docker-compose.yml.example -O docker-compose.yml
# adjust <IP> and config for your network
docker-compose up
-
Hijack DNS queries to
api2.xlink.cnandcm2.xlink.cnon your network so that they resolve to the IP address of your docker services. If you're using separate IP's for each service,api2.xlink.cnshould be pointed at theapp-apiservice andcm2.xlink.cnshould be pointed at thebed-socketservice. -
Log into the Ronin Wifi mobile app using any email address and password, neither need to be valid. Make sure your mobile device is connected to your network so that is resolves your hijacked domains properly.
-
Select
My Bedfrom the menu and thenConnect new bed-
Follow the instructions in the app to "Long press the Foot Up and Down buttons for 5 seconds until you hear a beep every 3 seconds". Click
Next -
Connect your mobile device to the
KeesonAp-XXXXXXXXXXWireless SSID. ClickNext -
Continue with the instructions and provide the Wireless network credentials for the network you wish to connect the bed to.
-
The bed will beep a couple times and connect to your Wireless Network. The bed should show up shortly in the list with an option to
Connect. Skip this part as not enough of the communications protocol has been reverse engineered at this point for the app to completely perform the setup. At this point you can force quit the app and re-open it, you should be able to control the bed now and see it in the list of beds.
-
Bed Controller API
The Bed Controller API is exposed on port 80 and provides an endpoint that allows you to send commands to the bed.
This can be easily added to Siri Shortcuts or similar tools to add bed control to whatever automation platform you use.
# Tell the bed to move to the flat position
curl -X 'PUT' \
'http://bn-adjustable-bed-controller.changethistoyourdomain.com/command?name=flat' \
-H 'accept: application/json'
# Tell the bed to move to the Zero-G position
curl -X 'PUT' \
'http://bn-adjustable-bed-controller.changethistoyourdomain.com/command?name=zero_g' \
-H 'accept: application/json'
# Tell the bed to move to the Preset I position
curl -X 'PUT' \
'http://bn-adjustable-bed-controller.changethistoyourdomain.com/command?name=preset_one' \
-H 'accept: application/json'
# Tell the bed to move to the Preset II position
curl -X 'PUT' \
'http://bn-adjustable-bed-controller.changethistoyourdomain.com/command?name=preset_two' \
-H 'accept: application/json'
# Tell the bed to move to the Preset III position
curl -X 'PUT' \
'http://bn-adjustable-bed-controller.changethistoyourdomain.com/command?name=preset_three' \
-H 'accept: application/json'
Metadata
Release files for bn-adjustable-bed 1.3.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bn-adjustable-bed-1.3.14.tar.gz | 12.3 kB | Without provenance | Details for bn-adjustable-bed-1.3.14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bn_adjustable_bed-1.3.14-py3-none-any.whl | Python 3 | none | any | Details for bn_adjustable_bed-1.3.14-py3-none-any.whl |
Total release size: 27.8 kB
Release files / bn-adjustable-bed-1.3.14.tar.gz
| Download URL | bn-adjustable-bed-1.3.14.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27e3384b407cd7cfff113d6cd9b87890b08172284b3c593e1689b4c2d8439bad
|
|
BLAKE2b-256 checksum How to use checksums |
584edee8bde84b5deb9cd0197a048ec69b33832796e2f142402514d0a5e99491
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.10.7 Linux/5.15.0-1020-azure
|
Release files / bn_adjustable_bed-1.3.14-py3-none-any.whl
| Download URL | bn_adjustable_bed-1.3.14-py3-none-any.whl |
|---|---|
| Size | 15.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf36cc182095f9598b88e4438dbd47b9a96b8ffbc12f2d1d952973ae1600032c
|
|
BLAKE2b-256 checksum How to use checksums |
d64ed9bc98fa5d23158b5049e25a183a841aa4de5af796c3baca00dda2341bef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.11 CPython/3.10.7 Linux/5.15.0-1020-azure
|
Security for bn-adjustable-bed 1.3.14
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.