shogunxam / esp32_bletracker Goto Github PK
View Code? Open in Web Editor NEWESP32 Bluetooth LE Tracker
License: MIT License
ESP32 Bluetooth LE Tracker
License: MIT License
As described here espressif/arduino-esp32#3797 there is an issue with the DST set in the NTP Time library .
The issue can be fixed using the proper Time Zone name instead of GMT and DST offsets.
Here there is the list of all the available Time Zones
Time Zone format is:
GMTGMT-1, M3.4.0/1,M10.4.0/2
Thank you @shogunxam for the nice firmware.
I compiled the newest git version with platform.io.
Decvices I use:
I am trying to use the FHEM collectord mode, but I get lots of reboots:
"
2021-02-17 18:30:28 | BLETracker initialized |
---|---|
2021-02-17 18:30:27 | Software reset due to exception/panic |
2021-02-17 18:30:27 | Connected to ... |
2021-02-17 18:29:25 | Software reset due to exception/panic |
2021-02-17 18:29:25 | Connected to ... |
2021-02-17 18:28:11 | Software reset due to exception/panic |
2021-02-17 18:28:11 | Connected to ... |
2021-02-17 18:27:43 | Software reset due to exception/panic |
" | |
Otherwise the funcion is good, but stability is not :( |
How can I contribute to the debugging process?
I have three ESP32 modules, two Wemos ESP32 Mini 1.0.0 and a generic Wroom one. Whenever I flash the firmware to them, I can access it via the webserver, but most of the time, the website is broken (no background, no boxes, etc, see:
It also does not detect any devices, no logs are generated on the log screen, none of the fields get populated.
I compiled with Arduino 1.8.13, ESP32 library 1.0.4, with the BLE library copied over as instructed.
When enabling serial debug logging, all seems good, the loop runs and shows that it connected to the broker and is sending data.
Any ideas what is going wrong here?
I looked today a bit closer to everthing and I see small issue.
Maybe you like to fix it in the code
(main.ino)
#define SYS_INFORMATION_DELAY 120000 /2 minutes/
should be
#define SYS_INFORMATION_DELAY 120 /2 minutes/
//System Information if (((lastSySInfoTime + SYS_INFORMATION_DELAY) < NTPTime::seconds()) || (lastSySInfoTime == 0)) { publishSySInfo(); lastSySInfoTime = NTPTime::seconds(); }
NTPTime::seconds(); is in seconds but SYS_INFORMATION_DELAY is set in milliseconds in you code.
So the calculation went wrong and sysinfo will only be published every 33.33 hours
Hi Mario,
from the ESP web panel it appears when you release a firmware update.
Could you implement the ability to receive an event notification?
Thank you
Hi Mario,
it is possible to memorize the last battery status of the NUT, detected by the ESP, so as to make it available even if the ESP should restart (with the device tracker not home)?
Thanks
Hi,
would it be possible to implement a retain on the home / not home state and on the last battery level?
If I'm not mistaken, after a blackout, if the NUT is out of the house, the values are "unknown"
Thanks
Thank you for your hard work. Excellent firmware. Tell me, could you add bluetooth scanning? For example, in the option enable scanning of phones that only have bluetooth.
I noticed that the gateway status changes frequently, almost every 30-40 seconds. You can somehow fix it so that it is stable. I tried changing the time in the config, but it didn't help. How do I fix this?
here I specified 5 minutes
#define WIFI_CONNECTION_TIME_OUT 300000 /30 seconds/
#Check BLETracker state
mqtt logs :
nabaztag/BLETracker/chambre_enfant/6AC7B6D0DB24 {"state":"off","rssi":-100,"battery":-1}
nabaztag/BLETracker/chambre_enfant/LWT online
nabaztag/BLETracker/chambre_enfant/LWT offline
nabaztag/BLETracker/chambre_enfant/A4C1385292B8 {"state":"off","rssi":-100,"battery":100}
nabaztag/BLETracker/chambre_enfant/A4C13848CC60 {"state":"off","rssi":-100,"battery":100}
nabaztag/BLETracker/chambre_enfant/D8A35C6BF705 {"state":"off","rssi":-100,"battery":-1}
nabaztag/BLETracker/chambre_enfant/7CD1C3369470 {"state":"off","rssi":-100,"battery":-1}
Hi, it looks be only battery notifications or I did something bad ?
//Set to true if you want track only the devices in the white list
#define ENABLE_BLE_TRACKER_WHITELIST false
//List of known devices you want track
//Each entry is in the format {"MAC-ADDRESS", read-battery, "Description"} i.e.{"A6B5C4D3E2F1", true, "My iTag"}
//Mac Addresses are in the form "A6B5C4D3E2F1" (uppercase and no separator)
//Each block is coma separated
#define BLE_KNOWN_DEVICES_LIST {"A4C1385292B8", true, "LYWSD03MMC chambre Gabriel"}, {"A4C13848CC60", true, "LYWSD03MMC chambre parents"}
these are Hygro thermometer and I would like to get all datas from them
cf. https://esphome.io/components/sensor/xiaomi_ble.html#lywsd03mmc
is this feature available? if not maybe I can add it on the code. I just need to know where is it ^^
I get them from python :
ATC_characteristic_datas = [
['00002a1f-0000-1000-8000-00805f9b34fb', 'int', 10, 'temperature'],
['0002a6f-0000-1000-8000-00805f9b34fb', 'int', 100, 'humidity'],
['00002a19-0000-1000-8000-00805f9b34fb', 'int', 1, 'battery'],
]
and about iBeacon UUID is it a feature enable ?
here my extra configuration :
#define LOCATION "nabaztag"
#define GATEWAY_NAME "BLETracker/chambre_enfant"
#define TOPIC_FORMAT 1
//Set to true if you want to enable the iBeacon mode
#define ENABLE_IBEACON true
//iBeacon type
#define IBEACON_TYPE 0x0215
//iBeacon UUID (709ecc6d-2f85-891f-ea42-4a544ca7e2c4)
#define IBEACON_UUID 0x70, 0x9e, 0xcc, 0x6d, 0x2f, 0x85, 0x89, 0x1f, 0xea, 0x42, 0x4a, 0x54, 0x4c, 0xa7, 0xe2, 0xc4
//iBeacon major (etaj)
#define IBEACON_MAJOR 1
//iBeacon minor (piece)
#define IBEACON_MINOR 2
on espHome I used these parameters :
sensor:
initially i tried this project because i wanted to use "esp32_ble_tracker" and "esp32_ble_beacon" at the same time, esphome doesn't allow that
esp32_ble_beacon:
type: iBeacon
uuid: '709ecc6d-2f85-891f-ea42-4a544ca7e2c4'
major: 1
minor: 2
Hello shogunxam,
I use your software now for some month an it works great. Thanks for that at first.
In my hole house I have installed 4x ESP32 with the software, and the detection works great.
For an perfect automation it would be helpful to start the scan via command like http://ip/scan or equal.
Use case is e.g. with opening of the front door or garage, I'd like to start directly the scan to know the user at the door.
I'm not a good programmer in C, so would it be able that you can help me?
Thanks in advance.
HisMastersVoice
Cannot build this project in VSCode
I have downloaded the code and unzipped it, then opened the folder in VSC. I have edited the user_config.h file only
This is what I get in the console window when I try to build
I am probably missing some simple step
Please help :)
Executing task: C:\Users\Admin.platformio\penv\Scripts\platformio.exe run <
Processing esp32dev-ble-release (platform: https://github.com/shogunxam/platform-espressif32.git#13a6a65fda58242ba3e10a7663fe07a2163c9f2f; board: esp32dev; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Platform Manager: Installing git+https://github.com/shogunxam/platform-espressif32.git#13a6a65fda58242ba3e10a7663fe07a2163c9f2f
Error: Traceback (most recent call last):
File "c:\users\admin.platformio\penv\lib\site-packages\platformio\commands\run\processor.py", line 70, in process
p = PlatformFactory.new(self.options["platform"])
File "c:\users\admin.platformio\penv\lib\site-packages\platformio\platform\factory.py", line 54, in new
raise UnknownPlatform(pkg_or_spec)
platformio.platform.exception.UnknownPlatform: Unknown development platform 'https://github.com/shogunxam/platform-espressif32.git#13a6a65fda58242ba3e10a7663fe07a2163c9f2f'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\admin.platformio\penv\lib\site-packages\platformio_main_.py", line 109, in main
cli() # pylint: disable=no-value-for-parameter
File "c:\users\admin.platformio\penv\lib\site-packages\click\core.py", line 829, in call
return self.main(*args, **kwargs)
File "c:\users\admin.platformio\penv\lib\site-packages\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "c:\users\admin.platformio\penv\lib\site-packages\platformio\commands_init_.py", line 44, in invoke
return super(PlatformioCLI, self).invoke(ctx)
File "c:\users\admin.platformio\penv\lib\site-packages\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\admin.platformio\penv\lib\site-packages\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\admin.platformio\penv\lib\site-packages\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "c:\users\admin.platformio\penv\lib\site-packages\click\decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\users\admin.platformio\penv\lib\site-packages\platformio\commands\run\command.py", line 133, in cli
process_env(
File "c:\users\admin.platformio\penv\lib\site-packages\platformio\commands\run\command.py", line 175, in process_env
result = {"env": name, "duration": time(), "succeeded": ep.process()}
File "c:\users\admin.platformio\penv\lib\site-packages\platformio\commands\run\processor.py", line 72, in process
self.cmd_ctx.invoke(
File "c:\users\admin.platformio\penv\lib\site-packages\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "c:\users\admin.platformio\penv\lib\site-packages\platformio\commands\platform.py", line 325, in platform_install
pkg = pm.install(
File "c:\users\admin.platformio\penv\lib\site-packages\platformio\package\manager\platform.py", line 51, in install
pkg = super(PlatformPackageManager, self).install(
File "c:\users\admin.platformio\penv\lib\site-packages\platformio\package\manager_install.py", line 48, in install
pkg = self._install(
File "c:\users\admin.platformio\penv\lib\site-packages\platformio\package\manager_install.py", line 97, in install
pkg = self.install_from_url(spec.url, spec, silent=silent)
File "c:\users\admin.platformio\penv\lib\site-packages\platformio\package\manager_install.py", line 141, in install_from_url
vcs = VCSClientFactory.new(tmp_dir, url)
File "c:\users\admin.platformio\penv\lib\site-packages\platformio\package\vcsclient.py", line 54, in new
obj = getattr(sys.modules[name], "%sClient" % type.title())(
File "c:\users\admin.platformio\penv\lib\site-packages\platformio\package\vcsclient.py", line 137, in init
self.configure()
File "c:\users\admin.platformio\penv\lib\site-packages\platformio\package\vcsclient.py", line 146, in configure
result = proc.exec_command([cls.command, "--exec-path"])
File "c:\users\admin.platformio\penv\lib\site-packages\platformio\proc.py", line 117, in exec_command
p = subprocess.Popen(*args, **kwargs)
File "C:\Users\Admin.platformio\python3\lib\subprocess.py", line 951, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Admin.platformio\python3\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
============================================================
An unexpected error occurred. Further steps:
Verify that you have the latest version of PlatformIO using
pip install -U platformio
command
Try to find answer in FAQ Troubleshooting section
https://docs.platformio.org/page/faq.html
Report this problem to the developers
https://github.com/platformio/platformio-core/issues
============================================================
The terminal process "C:\Users\Admin.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
Hello, can you help me implement this with your code?
Thank you
Dear Mario,
would you be able to insert in the control panel the possibility of managing the MAX_NON_ADV_PERIOD in order to better define any false outputs when the NUT fails to communicate with the ESP for a few minutes?
You could put it in configuration, near the scan interval
Thanks in advance
Hi,
would it be possible to associate a friendly name for each NUT that does not correspond to the real name and have it displayed next to the MAC ADDRESS in the devices?
It would be convenient to be able to immediately identify the NUT without having to remember the MAC, especially for new devices.
For example:
CXXXXXXXXXX0 with real name nut> friendly name Rocco
FXXXXXXXXXX3 with real name nut> friendly name Moana
DXXXXXXXXXX3 with real name nut> friendly name Selen
It's possible?
Thanks in advance
As per @xavier0smith request:
The only thing I'd like to add is the ability to set a static IP in the firmware. I don't want a captive portal, it takes up memory and if the power fails you get a lot of devices trying to connect. An optional line in user_config.h would suffice if possible
Hi,
I'm a FHEM user, a program similar to Home Assistant.
I have looking for long time a software like this that get rssi and battery status without crashing.
In FHEM BLE trackers data transmission is currently done via TCP/IP to a daemon named Collectord. This firmware for ESP32 talk with the daemon but does not detect the battery status, while this script reads everything but does not run under ESP32.
Do you find it difficult to extend your software to support FHEM through Collectord?
Best regards,
Xavier0Smith
is it possible to modify the firmware so that the web interface can specify the IP and port mqtt, specify the white and black list, specify the mac address? It's just inconvenient to flash esp32 every time to enter the mac address in the white list and specify a different address of the mqtt server. Also add the ability to change the time interval for scanning BLE devices.
Hi , I'm trying to build the master branch using platform.io: but I get this :
------------Tool Manager: Installing git+https://github.com/espressif/arduino-esp32#9be784f69b696d5bbb189a2fe5f1750ce2855426
git version 2.30.0.windows.2
Cloning into 'C:\Users******.platformio.cache\tmp\pkg-installing-bjh9ohhm'...
remote: Enumerating objects: 30622, done.
remote: Counting objects: 100% (152/152), done.
remote: Compressing objects: 100% (77/77), done.
Receiving objects: 100% (30622, reused 150 (delta 62), pack-reused 30470Receiving objects: 100% (30622/30622), 1.12 GiB | 21.12 MiB/s
/30622), 1.13 GiB | 22.65 MiB/s, done.
Resolving deltas: 100% (18749/18749), done.
Updating files: 100% (6908/6908), done.
fatal: not a git repository: ../../.git/modules/libraries/AzureIoT
fatal: could not reset submodule index
Error: VCS: Could not process command ['git', 'reset', '--hard', '9be784f69b696d5bbb189a2fe5f1750ce2855426']
I guess there's some dependencies problem, but I cannot figured it out 😫
Would it be possible to report the date and time of the last battery level reading?
It would be useful in case one carries out the detection in manual mode.
It would also be advisable to provide for the retain of the data in case of ESP shutdown.
Thanks in advance
Hello. I try to compile in debug mode
the only thing that I change in platformio.ini is:
[com]
esp32_platform = espressif32
#arduino-esp32 1.0.5-rc7
#esp32_platform = https://github.com/shogunxam/platform-espressif32.git#13a6a65fda58242ba3e10a7663fe07a2163c9f2f
My ESP32 just reebot/start and reboot
I have no messages on serial I try to print a string on
void setup() ... but it just reboot without messages
Decoder output is :
0x4009a1a9: abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/abort.c:38
0x401e5337: rcUpdatePhyMode at ??:?
0x401e537e: rcUpdatePhyMode at ??:?
0x401e5477: rcUpdatePhyMode at ??:?
0x401e5cf5: rcUpdateRate at ??:?
0x400db863: MyAdvertisedDeviceCallbacks::onResult(BLEAdvertisedDevice) at D:/Develop/Software/Local/ESP32_BLETracker-master/main/main.ino:152
0x400dbab9: _GLOBAL__sub_D_trackedDevicesMutex at D:/Develop/Software/Local/ESP32_BLETracker-master/main/main.ino:589
0x400dbb4b: _publishToMQTT(char const*, char const*, bool) at D:\Develop\Software\Local\ESP32_BLETracker-master/main/mqtt_client.cpp:43 (discriminator 8)
0x400dc60c: StringSumHelper::StringSumHelper(char const*) at D:\Develop\Software\Local\ESP32_BLETracker-master/main/settings.cpp:147
-> inlined by: Settings::toJSON() at D:\Develop\Software\Local\ESP32_BLETracker-master/main/settings.cpp:163
0x400f65c3: String::changeBuffer(unsigned int) at C:/Users/manjate/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.cpp:668 (discriminator 3)
Thanks in advanced
Tell me, with your firmware, any BLE tracker will work or certain models of BLE trackers? Какой BLE трекер порекомендуете, если заказать на aliexpress? Xiaomi Mi Smart Band 5 will see?
Hi,
Thanks for this project !
Is actually possible to connect multiple ESP32 like a mesh network ?
Like PainlessMesh (https://gitlab.com/painlessMesh/painlessMesh) ?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.