Dreams Sleepmotion Bed Voice Integration

I own a Dreams sleepmotion 200i power bed; and in the middle of the night when it’s cold who wants to reach out for their phone or the remote to adjust the bed. The saying goes everything is better with Bluetooth but since this already has Bluetooth perhaps we could add voice control.

Okay so the awesome Home Assistant application already has voice control sorted how do I get the bed working in Home Assistant?

I give you two options one running on a Raspberry Pi Zero and the other running on an Atom Lite ESP32 microcontroller https://github.com/stevendodd/sleepmotion-ble

Depends on which one you feel comfortable with but I like the ESP32 implementation better the whole unit costs only about £8 and has a nice web interface, smart config and over the air updates to boot.

Both options expose a restful interface to the Bluetooth control which worked nicely when configured as remote commands.

rest_command:
  bed_flat:
    url: "http://192.168.1.248:5000/flat"
    method: post
  bed_zerog:
    url: "http://192.168.1.248:5000/zerog"
    method: post
  bed_light:
    url: "http://192.168.1.248:5000/light"
    method: post
  bed_situp:
    url: "http://192.168.1.248:5000/situp"
    method: post
  bed_feetdown:
    url: "http://192.168.1.248:5000/feetdown"
    method: post

Enjoy

1 Like

Hi @stevendodd,

Awesome job with this integration. Just got myself 800i model and wondering if you could guide me how to adopt to this model.

All help appreciated.

I suspect the codes are the same between models.

What would you like to know;

  1. Buy a raspberry pi zero with a Bluetooth adapter on it.
  2. Download the source code from the link above and get it running on the raspberry pi
  3. Test the rest API in a browser or a tool like postman (optional)
  4. Add the rest_command configuration to home assistant as per above
  5. Add buttons to your home assistant dashboard based on the rest_command

I think the 800i model might have additional functionality, you would need to reverse engineer these additional options.

  1. Enable BLE debug on your android phone
  2. Use the dreams app to press the additional functional buttons
  3. Download the BLE log file and identify what the Bluetooth code is for each of the new functionality
  4. Extend my code to add an additional rest calls using the new Bluetooth codes
1 Like

Awesome, thanks for the punters.

Hi @stevendodd and thanks so much for all that went getting this running for a bed.

This post is one of the main reasons I got a Raspberry Pi as I have a very similar bed and would love to control it via voice/HA.

I’m veryyy new to this all and would appreciate your help in getting it running on my HA. I’ve just bought a Raspberry Pi 400 (does have bluetooth), I’ve got HassOS 2022.7 installed, and it’s all working.

My bed is actually a Suta 500i but from what I’ve seen in the images and documents, it looks to be identical to the Dreams Sleepmotion 800i. Even the user manual is identical but with different branding. It also uses a bluetooth remote and when searching for bluetooth devices from my PC/phone the bed is discoverable.

In your GitHub link you’ve got 2 requirements: Bluepy and Flask. How/where do I install those in Homeassistant OS? However, on the latest version of HA they say that Bluepy no longer works because of Python 3.10. Is there another solution?

I’ll stop my questions there for now so as to not bombard you :stuck_out_tongue:

Hope you’re having a great weekend.

Hi,
Both those modules are python libraries. If you have python. 3.9 on your raspberry pi run something like pip install and pass in the requirements.txt file and it should all work once you run the Python script.
The Python script starts up a web server and you can control the bed using URL requests as per the information in the readme file.

From there, it is a simple task to set up home Assistant using the rest URL commands again documented in the readme.

Hope it works- it will really come down to if it uses the same BLE commands as my bed. Otherwise you may have to start connecting debugger to the application to find which Bluetooth commands the app is issuing.

Hi there,

Really appreciate your reply and apologies for my delay… had updated my HA core which seemed to have broken some things for me so I’ve spent the last couple days trying to sort that out.

I’m going to now try what you suggested.

I am assuming we need to find our MAC Address and input in the .py file? as I keep getting

INFO:sleepmotion-ble:Connecting…
ERROR:sleepmotion-ble:Failed to connect to peripheral 57:4c:54:2c:c6:31, addr type: public

Possibly, you could use a BLE app such as ‘BLE Analyser’ to discover and find that information

Thanks for your reply, I got my MAC Address but keep getting the same,

INFO:flask.app:Connecting…
ERROR:flask.app:Failed to connect to peripheral 57:4c:54:f1:3a:35, addr type: public

Do I need the UID too?

No, its failing before that; is there anything else connected like the dreams app?

I have the dreams app but do not use it. It is configured.

ps thanks for you help :slight_smile:

Does the dreams at work? Are you running on a pizero w2? Do the BLE analyser apps connect?

Yes dreams app works. It’s running on. Pi Zero same box I use to control some soma connect blinds which also use BLE I believe.

What tool do you use for Bluetooth analysis?

Have you disconnected the blinds when trying to connect to the bed? There are a few but I like BLE Analyser

I think it only connects on commands. Can you advise how to use BLE Analyser? or what package to download with commands will give it a go.

OK bought a atom light got it programs with the ESP32 program, but it wont connect… pulling my hair out, I can scan and see the bed but fails to connect. Should it connect automatically?

It’s been a couple of years since I’ve run it on that ESP32 but from memory and looking at the code you can run a scan through the UI and then click the connect link

Yeah got this far but but there is a lot in the list none seem to connect!