SwitchBotAPI-BLE
SwitchBotAPI-BLE copied to clipboard
Lock BLE API
Current Situation
There is no BLE API documentation for the lock API except for the device id
Proposed Change
Add documentation for the Lock BLE API
Additional Context
It is desirable to integrate the lock into other home automation systems.
I also think this would be a nice feature and probably shouldn't be closed as the BLE fix isn't available yet. I understand that it's not possible yet, but the issue shouldn't be closed IMO.
Hey team, any updates on this?
I saw a post in a live chat with a cofounder of switchbot that said the ble lock api is coming:
Here's the op:
"Hey. It's Richard here. I am one of the cofounders of this little robot SwitchBot. I am more on sales and marketing, but i also know how to code and play around with JavaScript and Python myself. I have around 160+ connected device, 20-30 scenes/ routines/automations or whatever you call it at my place and most of them are in use, which means I kinda know what smart home is. Also I use Alexa most of the time at home and Siri when I am on my phone. Just wanna say hi and if you guys have anything you wanna tell me, just let me know. Would like to interact with you guys more from now on. In case i missed you comments, pin me again. I am also on Twitter in case you wanna talk there too. https://twitter.com/richardmou63/"
Here's the reply that says the lock api is coming:
"1. Lock API is definitely on its way. We gotta test the security level before releasing and there is no ETA yet."
Post: https://www.reddit.com/r/TrySwitchBot/comments/vzr3y6/first_post_hello_world/?utm_source=share&utm_medium=ios_app&utm_name=iossmf
I don't understand. Why was this issue closed even though there is still no documentation on using the switchbot lock via BLE?
It's listed as open for me? But I believe comments may re open it. Pretty sure GitHub auto closes issues that don't get updates and go stale
with V1.1 of the API dropping about a week ago and bringing back the lock and unlock capability to the webAPI (which is awesome, thank you very much for that), is there any timetable in regards to this functionality being added to the bleAPI?
Best way I can find is to message Richard Mou on twitter. He responds quickly
Looking forward for the BLE API support!
Best way I can find is to message Richard Mou on twitter. He responds quickly
i‘m not on twitter, could somebody do that please?
Current Situation
There is no BLE API documentation for the lock API except for the device id
Proposed Change
Add documentation for the Lock BLE API
Additional Context
It is desirable to integrate the lock into other home automation systems.
This is Davidson from the dev team. We are working on the BLE API and we will update the BLE API doc hopefully in the next month. I myself will oversee the progress and keep you posted. Thanks a lot for being patient and supportive! You guys are the best!
This is Davidson from the dev team. We are working on the BLE API and we will update the BLE API doc hopefully in the next month. I myself will oversee the progress and keep you posted. Thanks a lot for being patient and supportive! You guys are the best!
This is fantastic news! Out of curiosity, what features will the api include?
- ability to lock/unlock
- ability to read state of lock
- ability to read state of door
- ability to read state of battery
Best
This is Davidson from the dev team. We are working on the BLE API and we will update the BLE API doc hopefully in the next month. I myself will oversee the progress and keep you posted. Thanks a lot for being patient and supportive! You guys are the best!
This is fantastic news! Out of curiosity, what features will the api include?
- ability to lock/unlock
- ability to read state of lock
- ability to read state of door
- ability to read state of battery
Best
We plan to support these triggers first,
- ability to read state of lock
- ability to read state of door
- ability to read state of battery
The actions will have to come after.
Davidson
awesome! @Minsheng do you have an estimated timeline for both reading and actions? Asking as our company is deciding which product to choose, so it may be worth to wait, but we need to understand how long. Thank you!
This is fantastic news! Out of curiosity, what features will the api include?
- ability to lock/unlock
- ability to read state of lock
- ability to read state of door
- ability to read state of battery
Please also add the ability to set PIN. This will create a huge use case for vacation homes.
awesome! @Minsheng do you have an estimated timeline for both reading and actions? Asking as our company is deciding which product to choose, so it may be worth to wait, but we need to understand how long. Thank you!
We have released the broadcast definition for Lock. The pull request is being reviewed atm. We don't have a timeline for the implementation of Lock actions yet. Please stay tuned.
great job, thank you for your work! patiently waiting for the ability to lock and unlock to be added to the BLE API though 🤞
Just goona buy in advance the lock waiting for this integration to be live asap 😃
Happy New Year ;) Any updates?
@advorsky73 check this repo out: https://github.com/Danielhiversen/pySwitchbot
@donavanbecker thats for cloud api, how does this help for BLE ??? 🤔
@advorsky73 pretty sure this is all BLE: https://github.com/dsypniewski/pySwitchbot/blob/ed46ac93e2c8985037e21f31e4bb7b933e17714f/switchbot/devices/lock.py
From this PR: https://github.com/Danielhiversen/pySwitchbot/pull/164
@advorsky73 it's all BLE, not cloud. I did some investigating of messages between the lock and the app. I'll try to make a PR here once I'll finish up and organize my notes. Next release of HA should also have this integrated, it already is in the beta.
FINALLY!! Home assistant added support for this lock via BLE! check version 2023.1 ;) Works fine and exposes several states:
I've just bought Daniel a coffee! hehe
@jpconfessor beautiful! thanks for letting us know 👍
are we sure locking and unlocking work over BLE though? I thought that wasn‘t yet available vie the BLE API, but i‘d love to be corrected
this is a big improvement as is, but it‘s worth even more if it‘s locally controlled
@martindinicolino Yes, as I said before it's local. I spend about a month reverse engineering the lock communication and making the integration for Home Assistant, that's why the integration works while there aren't any action related docs released by SwitchBot yet. The only internet connection is needed during setup to retrieve the locks encryption key from SwitchBot internal API.
@dsypniewski this is huge! thank you for your effort
i‘ll give it a try as soon as i get home
yes! I was able to validate using my ble proxy logs (from esphome).
I’ve noticed that the very first command after a while requires a connection, and due to this it takes around 1s to lock/unlock… if you try again.. it is almost instant…. so, this very first command is still waaaay faster than api (I was using the smartthings integration.. so, even worst!)
I’ve watched the release video from HA and they’ve mentioned some improvements around this area in the new version of esphome that requires a serial update (not OTA) in order to give us full performance. I will give it a try to see if I can reduce this even more :)
setup: I am using home assistant 2023.1 with the switchbot integration via bluetooth proxies around my house (esp32 devices - m5 atom lite) - check this: https://esphome.github.io/bluetooth-proxies/
I have also set this up in Home Assistant and can confirm it is local. You should be proud of your work here. I know I read a lot of comments about hesitation in buying this lock due to the lack of local support on Home Assistant. I would expect sales of this lock to improve greatly due to this improvement. Great job.
yes! I was able to validate using my ble proxy logs (from esphome).
I’ve noticed that the very first command after a while requires a connection, and due to this it takes around 1s to lock/unlock… if you try again.. it is almost instant…. so, this very first command is still waaaay faster than api (I was using the smartthings integration.. so, even worst!)
I’ve watched the release video from HA and they’ve mentioned some improvements around this area in the new version of esphome that requires a serial update (not OTA) in order to give us full performance. I will give it a try to see if I can reduce this even more :)
setup: I am using home assistant 2023.1 with the switchbot integration via bluetooth proxies around my house (esp32 devices - m5 atom lite) - check this: https://esphome.github.io/bluetooth-proxies/
Works great, as described! Thanks everyone for this solution! Regards
@martindinicolino Yes, as I said before it's local. I spend about a month reverse engineering the lock communication and making the integration for Home Assistant, that's why the integration works while there aren't any action related docs released by SwitchBot yet. The only internet connection is needed during setup to retrieve the locks encryption key from SwitchBot internal API.
Excellent work. Works flawlessly, thanks you so much ! Do you have any donations link ? That's the kind of work that definitely deserve it.