chrisscheffler / miflora Goto Github PK
View Code? Open in Web Editor NEWNode.js package for the Xiaomi Plant Sensor Flower Care (Mi Flora)
License: MIT License
Node.js package for the Xiaomi Plant Sensor Flower Care (Mi Flora)
License: MIT License
I've found an issue in the miflora module where the MiFlora.discover() method will not resolve the open promise if the devices have already been previously discovered. I've verified that adding a new line:
miflora.js
line 162: return resolve();
fixes this issue. Please consider adding this fix. Thanks!
Interresting work on the mi flora!
Do you know how to set the reporting interval? Now, mine send sensor data extremely often, sometimes several per minute.
I'd like to set the interval to once every 30 minutes or so, in order to extend battery life.
Have you done any research on that?
Hi,
I'm trying to get data from my miflora device with your package but I'm getting stuck with a timeout error.
Here is my simple sample code :
const miflora = require('miflora');
(async function () {
const opts = {
duration: 60000,
ignoreUnknown: true,
addresses: ['c4:7c:8d:67:be:d0']
};
const devices = await miflora.discover(opts);
console.log('devices discovered: ', devices.length);
if (devices.length>0){
const device = devices[0];
let data = await device.query();
console.log(data);
}
})();
and here is the trace log in debug mode.
miflora waiting for adapter state change +0ms
miflora adapter changed to to 'poweredOn' +30ms
miflora starting discovery with 60000ms duration +3ms
miflora (discovery will be stopped when [ 'c4:7c:8d:67:be:d0' ] is found) +0ms
miflora discovery started +11ms
miflora discovered MiFloraMonitor @ c4:7c:8d:67:be:d0 +535ms
miflora found all requested devices, stopping discovery +0ms
miflora discovery finished +4ms
devices discovered: 1
miflora:device:c4:7c:8d:67:be:d0 querying multiple information +0ms
miflora:device:c4:7c:8d:67:be:d0 querying firmware information +1ms
miflora:device:c4:7c:8d:67:be:d0 initiating connection +1ms
miflora:device:c4:7c:8d:67:be:d0 connected to device +3s
miflora:device:c4:7c:8d:67:be:d0 connected, resolving chars +1ms
miflora:device:c4:7c:8d:67:be:d0 resolving characteristic +2ms
(node:16566) UnhandledPromiseRejectionWarning: Error: timeout
at Timeout.setTimeout [as _onTimeout] (/home/pi/Documents/shared/flora/node_modules/miflora/lib/miflora-device.js:11:20)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)
(node:16566) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:16566) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
miflora:device:c4:7c:8d:67:be:d0 disconnected from device +10s
Any idea?
Thanks for your help
Can the software work with this. Now scan does not detect these.
@ChrisScheffler, in Wiki worklog about the blink command you meant that accidentally mixed up the byte order and the device had changed its behavior. One of these change was "it won't automatically disconnect connections after 10 seconds". I need it. It cannot disconnect in my project. Do you know how to reproduce, please?
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.