stelford / inkbird_mqtt Goto Github PK
View Code? Open in Web Editor NEWInkbird Btle devices to MQTT via ESP32
Inkbird Btle devices to MQTT via ESP32
Hi, after implementing this I found that the first scan after reset always showed name & manufacturer, but from the 2nd scan these 2 values were not shown, so advertisedDevice.haveManufacturerData() was false and no data was published.
This was solved by adding init & deinit BLE in void loop(), I think that by doing this, every new scan found the inkbird sensors "for the first time", so that advertisedDevice.haveManufacturerData() = true and the code could run OK. Maybe after the first pairing the BLE data read was different, as the devices were no more "unknown" for the ESP32. I do not really know if this was the actual problem or why was this happening, and maybe there are more elegant solutions. This is my new void loop:
void loop() {
BLEDevice::init("myBLEScan");
client.loop();
if (cnt == 0) { bleScan(); }
cnt=cnt+1;
if (cnt >= 5) { cnt=0; }
client.loop();
delay(5000); // or 5s
BLEDevice::deinit(false);
}
Makes this sense? At least solved my problem and now I can read them in Home Assistant.
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.