dgreif / homebridge-hatch-baby-rest

A homebridge plugin for Hatch Baby Rest night light
MIT License
74 stars 19 forks source link

Command for touch ring favorites on Hatch Rest bluetooth? #98

Closed dancavallaro closed 1 year ago

dancavallaro commented 1 year ago

I want to preface this question with an apology since I know you're now discouraging use of the bluetooth-only plugin, and I also must admit that at the moment I'm not actually using your plugin, just taking advantage of the protocol reverse engineering you've already done to build my own controller using an ESP32.

I've been successfully testing my controller using the SI commands for setting the power. I was wondering if you've ever looked into whether there's a BLE command for choosing one of the "favorite" presets?

I'm not positive of course, but pretty sure there must be a BLE command for selecting a preset since selecting a favorite from the app seems to be in sync with the behavior when you touch the touch ring on the device to cycle through the favorites.

I've been trying to reverse engineer it myself but having some trouble with the BLE sniffer I bought, so figured I'd ask you in the meantime while I'm fighting with that. Anyway, no worries if you don't know or don't want to respond, just thought I'd ask. Thanks for the great work on this plugin, I've learned a lot about BLE and Homebridge from messing around with this.

dancavallaro commented 1 year ago

Well, I got my BLE sniffer working about 2 minutes after I opened this issue, so problem solved. The command for selecting a favorite is SP, followed by the preset number. Thanks for the rubber duck debugging ;-).

dgreif commented 1 year ago

Glad you were able to figure it out! I didn't personally find a way to send a preset request and I vaguely remember the app actually sending the full list of settings. Good to know there is actually a way to send those requests!

menesses commented 10 months ago

@dancavallaro do you mind sharing your ESP32 code? I've thought of doing something similar, but haven't gotten around to it yet. Would love to have a springboard to start from if you're willing to share.

dancavallaro commented 10 months ago

Hey @menesses, no problem, it's on GitHub at https://github.com/dancavallaro/hatch_rest_ble. The relevant code is all in src/hatch_rest_ble.cpp, it's not particularly beautiful code but hopefully it's straightforward enough to understand. Let me know if you have any questions about it or feel free to open an issue or whatever -- this is just a hacky side project I built for my daughter's room and I can't promise I'll respond super quickly, but I'm happy to try to help!