Git Product home page Git Product logo

miflora's People

Contributors

chrisscheffler avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

miflora's Issues

MiFlora.discover() not returning if devices are already known

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!

Reporting interval setting?

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?

Timeout issue

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

Doubt about automatic disconnection (after 10 seconds)

@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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.