Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiFi and BLE at the same time possible with use of NimBLE #21

Open
KlausMu opened this issue Feb 19, 2024 · 7 comments
Open

WiFi and BLE at the same time possible with use of NimBLE #21

KlausMu opened this issue Feb 19, 2024 · 7 comments

Comments

@KlausMu
Copy link

KlausMu commented Feb 19, 2024

Hi, is this repo still maintained?

I've been using the eQ3 lib for some years. It always was annoying that you have to disconnect WiFi before using BLE and vice versa. Establishing the connection always takes some time, both for WiFi and BLE. The keyBLE connection always took about 10-15 sec, sometimes even more.

Recently I integrated the use of NimBLE into the eQ3 lib. With that, WiFi and BLE both can stay connected all the time. Works now for some months without any problems.

Since the timeout for the BLE connection is 4 minutes, I do an keyble->updateInfo(); each 3 min 50 sec. With that, the keyBLE stays super responsive all the time. You cannot recognize any delay.

Interested in a pull request?

@KlausMu KlausMu changed the title WiFi and BLE at the same time: with use of NimBLE WiFi and BLE at the same time possible with use of NimBLE Feb 19, 2024
@smarthomebude
Copy link

Hi @KlausMu,
I'm interested in the code. Could you please share it somehow?
Do you know if this also works with ESPHome?
Thank you!

Greetings Marco

@KlausMu
Copy link
Author

KlausMu commented Oct 7, 2024

What do you mean with "does it also work with ESPHome"? This project does not work directly with ESPHome. I saw that there are some ESPHome projects using the (more or less) same eQ3 library as the one from this repository:
https://github.com/digaus/esphome-components-eqiva
-> uses a changed eQ3-library
https://github.com/mccoy88f/esp32-keyble-ha
-> uses the unchanged eQ3-library (edit: this is not an ESPHome project, disconnects WiFi during use of BLE)
So what do you already have running? What is the obstacle with it? And what do you want to achieve?

@KlausMu
Copy link
Author

KlausMu commented Oct 9, 2024

@smarthomebude
I had a closer look at https://github.com/digaus/esphome-components-eqiva
If you want to use Home Assistant and ESPHome, I would suggest giving this project a try.
It can keep both WiFi and BLE connection open at the same time. Doing so, the keylock stays responsive.
Since that ESPHome project is not using arduino-esp32, but esp-idf, the changes I had to do for using NimBLE are not necessary.

@smarthomebude
Copy link

Thank you!
I'll give it a try.

@wladimir-computin
Copy link

Hi @KlausMu!

Could you please share your NimBLE version of the eQ3 lib? This would be awesome, it is exactly what I need for my project.

I'm using my very own smarthome ecosystem, written from scratch and started way before HA was a thing.
Long story short, I just need the eQ3 lib from this project since I'd like to implement this lock in it. It heavily relies on the WIFI connection, so dropping WIFI every time to perform BLE stuff would be a major PITA ^^

@KlausMu
Copy link
Author

KlausMu commented Oct 14, 2024

@wladimir-computin
Here it is:
https://github.com/KlausMu/esp32-keyble
You have to add

lib_deps = 
	h2zero/NimBLE-Arduino@^1.4.2

to platformio.ini

And this is the pull request:
#24

@wladimir-computin
Copy link

@KlausMu Thanks a lot! I built upon your work and made some additional changes to the lib. Since we don't need to switch between BT and WiFi, a lot of the complexity could be removed. Even the Semaphores are no longer necessary, at least according to my testing.

Since I modded the library to my needs, it is no longer directly compatible with this project. Anyway, it might still be useful for someone.

I also fixed the user registration / pairing, so no more node.js stuff is needed to get it up and running.

https://github.com/wladimir-computin/eq3-lib-NimBLE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants