OpenWonderLabs / SwitchBotAPI-BLE

SwitchBot BLE open API
98 stars 9 forks source link

Document Meter device commands for downloading stored data #37

Closed dyseg closed 4 months ago

dyseg commented 4 months ago

Current Situation

The commands for fetching the 36 days of stored data from the Meter device is not documented, meanwhile the official android app is capable to download it.

Proposed Change

Document all available commands via the BLE API of the Meter device. Currently only 0x02, 0x14, 0x30, 0x31is documented.

From an android bluetooth log, it is visible the the official SwitchBot app uses some not documented commands. For example: 0x3A (extended), 0x3B, 0x3C and I assume many others which I missed.

Additional Context

Request from SwitchBot app 1:

Handle: 0x000e (Unknown: Unknown)
    [Service UUID: cba20d00224d11e69fb80002a5d5c51b]
    [UUID: cba20002224d11e69fb80002a5d5c51b]
Value: 570f3a

Reply from Meter 1:

Opcode: Handle Value Notification (0x1b)
Handle: 0x000b (Unknown: Unknown)
    [Service UUID: cba20d00224d11e69fb80002a5d5c51b]
    [UUID: cba20003224d11e69fb80002a5d5c51b]
Value: 01520100040302

Request from SwitchBot app 2:

Opcode: Write Request (0x12)
Handle: 0x000e (Unknown: Unknown)
    [Service UUID: cba20d00224d11e69fb80002a5d5c51b]
    [UUID: cba20002224d11e69fb80002a5d5c51b]
Value: 570f3b01

Reply from Meter 2:

Handle: 0x000b (Unknown: Unknown)
    [Service UUID: cba20d00224d11e69fb80002a5d5c51b]
    [UUID: cba20003224d11e69fb80002a5d5c51b]
Value: 0165be3e1465be424c000a0078

Request from SwitchBot app 3:

Opcode: Write Request (0x12)
Handle: 0x000e (Unknown: Unknown)
    [Service UUID: cba20d00224d11e69fb80002a5d5c51b]
    [UUID: cba20002224d11e69fb80002a5d5c51b]
Value: 570f3c01000006

Reply from Meter 3:

Handle: 0x000b (Unknown: Unknown)
    [Service UUID: cba20d00224d11e69fb80002a5d5c51b]
    [UUID: cba20003224d11e69fb80002a5d5c51b]
Value: 01973888973897368897389735779737
dyseg commented 4 months ago

TL;DR these commands won't be documented.

Feedback from the official SwitchBot support:

Hi there, Thanks for your kind waiting. Sorry that as confirmed by the developers, our BLE API is not open to the customers. :-( The open API is already shared in GitHub with our customers. We also feedback if possible, please add more available API sharing in GitHub to the developer team so our customers can make good use of them. Sorry again for any inconvenience so far and if there is any other thing we can cooperate with, feel free to let us know.

I would suggest some clarification in the main readme: highlight that only SOME commands are part of the open BLE API. Currently it is very misleading. It seems like the documentation is just not yet finished, meanwhile it is indeed finished, and the other commands are not open for the public. And looking at some other issues in this repository(#32, #22), it seems like they are stuck in the same situation, without a single comment from the developers.

github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 4 months ago

This issue has been automatically closed because it has not had recent activity. Thank you for your contributions.