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
Can i use this library to read the sensor in my custom app ? #53
Comments
Yes you can just skip using the homebridge part of this code and use the const { Scanner } = require("homebridge-mi-hygrothermograph/lib/scanner");
const scanner = new Scanner();
scanner.on("temperatureChange", function (value, peripheral) {
console.log("Temperature", value);
});
scanner.on("humidityChange", function (value, peripheral) {
console.log("Humidity", value);
});
scanner.on("batteryChange", function (value, peripheral) {
console.log("Battery", value);
}); Good luck! |
Your example was great for 1 device, but right now i have a total of 4 sensors and it got pretty unstable. This is is how the server looks right now and sometimes it's crashing and it was not hapening with 1 device. I want to ask for a suggestionof a better way of reading from multiple devices.
|
Really hard to help you without you providing more information than that it's unstable and crashing. But one thing you could try is to have one |
This is the error before crashing, probbaly won't help with anything:
I will try your example. |
This error is actually a known issue: #56 Did you upgrade your system or anything like that around the time you started seeing these errors? Also you could listen for the error-event to not crash the node-process on errors emitted by the scanner: scanner.on("error", error => console.log(error)); |
I did completely reinstalled my RPi3 recently.
The on error event doesn't help. It works for a while ..like minutes ..and then i'm seeing the error message and the app crashes.
|
Hmmm decided to give this another try, and now in version 2.3.2 it's not crashing anymore ...at least not yet! :D Keep up the good work! |
I was wrong. It's still throwing the same error. |
Hello, js dev here.
I'm currently using this method (https://zsiti.eu/xiaomi-mijia-hygrothermo-v2-sensor-data-on-raspberry-pi/) to read the sensor for my custom made home app. It works by giving it the mac address, but after a while it crashes and i hate it cose it's python. It's the only working way i could find to read the sensor.
So i've been looking for a nodejs library that could read the sensor and i'm happy to find this one.
Happy was the first feeling, but after reading the documentation i'm not so sure anymore because of the integration with the homebridge that seems to be a big thing on it's own and i don't really wanna learn it or use it just for 1 sensor type.
TLDR: So what i'm looking for is a js library that can read the sensor and use the data in my own app.
Can this library do it? Or do you know any other js library that can do this?
Thank you.
The text was updated successfully, but these errors were encountered: