Replies: 2 comments 10 replies
-
You would need to implement a bleSetup() and bleLoop() function. The bleLoop() function cannot be blocking because it would freeze the GUI. The .ino example scans for 30 seconds, which would not be possible in combination with hasp-lvgl. You need to make that scan asynchronous. BLE is very resource hungry. When we implement BLE it will probably be NimBLE based. This is a 3rd party BLE library that has a much smaller footprint then the Espressif one. NimBLE has an continuous scanning example. Instead of using a delay the loop would go in a bleEverySecond() or bleEvery5Seconds() function. I haven't tried this myself. I think most phones implement an anti-tracking token, so I'm not sure if you can track an individual phone like this. |
Beta Was this translation helpful? Give feedback.
-
@fvanroie check this: https://github.com/jptrsn/ESP32-mqtt-room |
Beta Was this translation helpful? Give feedback.
-
Somehow I was not aware that ESP32 has BLE capability, thank you for pointing that out.
That gave me the idea that we could very simply implement a presence detection in these devices using a simple BLE scanner which would drop in the list of the detected BLE tags in the air to MQTT. For example having a plate in each room, additionally to the controls it offers, provides a great way to inform the automation system about persons being there or not.
I've created a new branch for this: https://github.com/nagyrobi/hasp-lvgl/tree/0.4.0-ble
Added a single file named
ble.cpp
which contains a simple BLE scanner (inspired from moononournation).Can you please point me in the right direction on how to integrate this in the main loop and publish the data to MQTT?
I plan to make this user-configurable through user_config_override so only the ones who require it would have it.
Beta Was this translation helpful? Give feedback.
All reactions