Dreams Sleepmotion Bed Voice Integration

Turns out IOS and Mac do not show the correct UUID they randomise them! and they will not expose the MAC Address! going to try to get my hand on a device that runs non IOS/Mac OS

Thanks for you help! When I do get it working, how easy is it to add Feed Up and Head Down?

Easy enough, just copy and paste and extend the code; the commands captured already.

byte commands[7][5] = {
  {0x6e, 0x01, 0x00, 0x3c, 0xab}, // light
  {0x6e, 0x01, 0x00, 0x45, 0xb4},  // zg
  {0x6e, 0x01, 0x00, 0x31, 0xa0}, // flat
  {0x6e, 0x01, 0x00, 0x24, 0x93},  // head up
  {0x6e, 0x01, 0x00, 0x25, 0x94}, // head down
  {0x6e, 0x01, 0x00, 0x26, 0x95},  // feet up
  {0x6e, 0x01, 0x00, 0x27, 0x96}   // feet down
};
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
  } else if (header.indexOf("GET /zg") >= 0) {
    Serial.println("BLE ZG");
    pRemoteCharacteristic->writeValue(commands[1], sizeof(commands[1]));
  } else if (header.indexOf("GET /flat") >= 0) {
    Serial.println("BLE Flat");
    pRemoteCharacteristic->writeValue(commands[2], sizeof(commands[2]));
  } else if ...

It looks like my ESP version of the code expects /zg while my rest_command in home assistant is looking for /zerog though :upside_down_face:

good old andriod phone

Woo Hoo

thanks for all your help :slight_smile:

1 Like

What did you need to change just the Mac address?

Yup! once I know what it was. Just ending the ino file now to add Head Down and Feet Up,

Feetdown you have this,

} else if (header.indexOf(“GET /feetdown”) >= 0) {
Serial.println(“BLE Feet Down”);
int hold = 32;
while (hold >= 0) {
pRemoteCharacteristic->writeValue(commands[6], sizeof(commands[6]));
delay(250);
hold = hold - 1;
}

I assume i change to feetup, just trying to work out how this knows the correct byte command to send?

} else if (header.indexOf(“GET /feetup”) >= 0) {
Serial.println(“BLE Feet up”);
int hold = 32;
while (hold >= 0) {
pRemoteCharacteristic->writeValue(commands[6], sizeof(commands[6]));
delay(250);
hold = hold - 1;
}

pRemoteCharacteristic->writeValue(commands[5], sizeof(commands[5]));

isnt that the situp command?

else if (header.indexOf(“GET /situp”) >= 0) {
Serial.println(“BLE Situp”);
int hold = 32;
while (hold >= 0) {
pRemoteCharacteristic->writeValue(commands[5], sizeof(commands[5]));
delay(250);
hold = hold - 1;
}

hold = 90;
while (hold >= 0) {
  pRemoteCharacteristic->writeValue(commands[3], sizeof(commands[3]));
  delay(250);
  hold = hold - 1;
}
byte commands[7][5] = {
  {0x6e, 0x01, 0x00, 0x3c, 0xab}, // light
  {0x6e, 0x01, 0x00, 0x45, 0xb4},  // zg
  {0x6e, 0x01, 0x00, 0x31, 0xa0}, // flat
  {0x6e, 0x01, 0x00, 0x24, 0x93},  // head up
  {0x6e, 0x01, 0x00, 0x25, 0x94}, // head down
  {0x6e, 0x01, 0x00, 0x26, 0x95},  // feet up
  {0x6e, 0x01, 0x00, 0x27, 0x96}   // feet down
};

light = 0, zg = 1 …

I think I implemented sit up as a combination of feet and head

Ah ok thanks make sense. All Working :slight_smile:

Nice - Your raspberry pi version should work now as well, I use a pi zero and it’s pretty robust, I’ve configured the pi automatically run at start-up. I haven’t tested the ESP for any length of time.

1 Like