Open nehayward opened 4 years ago
Sure, I can help! This codebase has 90% of the kettle protocol figured out. Only things missing are the C/F selector state and Hold+ selector state. What are you having trouble with?
The code base alone should be a lot of help. I'm just getting into reverse engineer the bluetooth packets. Maybe I can help with the C/F selector I'm using Wireshark and bluetooth packet logger. Is this how you figured out the protocol?
I'm almost sure the missing selector states are the "unknown" data types in this method: https://github.com/tlyakhov/fellow-stagg-ekg-plus/blob/master/src/StaggKettle.cc#L167, I just haven't bothered to experiment yet heh
I used iOS bluetooth sysdiagnose + Wireshark to get the original packet snooping.
Okay is that the bluetooth packet logger? I'm using that and I'm still trying to figure out how read the logs. I can get the logs for switching the C/F, I just would need help reading them.
Reading the logs like that is extremely confusing - since the actual data frames will be split amongst multiple packets. That said your screenshot has the following kettle command in it:
0xef 0xdd 0x0a 0x0a 0x00 0x01 0x0b 00
Which means:
0xef 0xdd
= frame separator, magic number
0x0a
= command
0x0a
= sequence number, increases every time your app sends a command
0x00
= power command type
0x01
= on (would be 0x00 if it the command was for off)
0x0b
= sequence + previous data byte, so 0x0a + 0x01 = 0x0b
0x00
= same value as command type, so 0x00 as above.
See this method in the code: https://github.com/tlyakhov/fellow-stagg-ekg-plus/blob/master/src/StaggKettle.cc#L267
Okay sweet that's what I was looking at. So is the sequence somewhat arbitrary. You just have to increment it each time. This helps a lot! Thanks Tim.
Thanks Tim. This gives me a great starting point. I'll keep you updated on my progress and hopefully I can help finish the code coverage on the kettle protocol.
Hey figured I'd keep you updated.
Currently working on writing a homebridge plugin. I tried using noble in node for BLE communication but it doesn't currently work on my raspberry pi or macOS Catalina. However I think I can use the gatttool for communication. So I'm exploring that now.
Have any code up on github? I'd be curious to take a peek.
As soon as I have something working I'll share it.
Still a work in progress but I was able to setup small script to control the kettle.
https://gist.github.com/nehayward/28e5f4e3d22b2104b1f0203ee225fb2a
p.s. see my recent commits for improvements and more comments/documentation.
Yeah nice work on updating the docs! Looks good!
Thanks again for all the help. I think we can close this issue now. I have a working plugin for homebridge now 😄 https://github.com/nehayward/homebridge-stagg-ekg-kettle
Nice work @tlyakhov! I've been trying to reverse engineer the Stagg EKG the last couple days, I'm working on bringing support to home bridge. Maybe we could collaborate?