OpenWonderLabs / SwitchBotAPI

SwitchBot Open API Documents
886 stars 73 forks source link

Question: Is there an undocumented endpoint to get logs of a device? #341

Open ThatProgrammerr opened 2 months ago

ThatProgrammerr commented 2 months ago

Current Situation

I thought that since the app has logs of what unlocked a Lock or Lock Pro, like OpenAPI, 'Thumb name' (for keypad touch), Manual, etc - I could grab those logs while waiting for my other issue (https://github.com/OpenWonderLabs/SwitchBotAPI/issues/338) to be approved and implemented, but I can't seem to find a method documented for this either, despite the data clearly being there.

Environment

Additional Context

The log page. image

cikabo commented 2 months ago

Similar issue, I am using the API to perform various actions, all good. I can see the device logs, including card and keyboard usage in the app - is that information available via the API?

ThatProgrammerr commented 2 months ago

Similar issue, I am using the API to perform various actions, all good. I can see the device logs, including card and keyboard usage in the app - is that information available via the API?

As far as I can see, there is no way to grab that data outside the app, via the API. I tried to setup some automation on an emulated android device, as well as sniffing traffic, but no luck. Unless it eventually gets added to the API, I don't personally see a way that this will be data you can pull and use in code.

hsakoh commented 2 months ago

In my observation, the app has a means to perform operations equivalent to Bluetooth commands via MQTT, even when there is no Bluetooth connection. When the app is connected via WiFi, the flow for retrieving keypad logs is as follows: App -> MQTT (AWS IoT Core) -> Hub -> Bluetooth -> Keypad

If sniffing is possible, a hint would be /user/policyCer. (I can't write anything too specific here, so if you want more detailed information, please contact me elsewhere.)

However, it’s highly unlikely that SwitchBot will document or open these things, so it would be great if they were added as an OpenAPI.

glenmich commented 1 month ago

@hsakoh have you found a way to get the information which finger/code/NFC card tried to unlock or successfully did? I would really like to use this as a trigger for further automations in home assistant...

I installed your switchbot-mqtt addon. I was able to add keypad codes, but can't test anything else right now. also the addon seems to just change attributes after polling information and doesn't "listen" to changes (when I unlock/lock via app). is this normal?

since I don't know how to send you a message, could you please send me one? kind regards from germany :)