Giter VIP home page Giter VIP logo

node-mi-flora's People

Contributors

bepitulaz avatar danielbh avatar demirhanaydin avatar lucavb avatar webnator 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-mi-flora's Issues

No data when executing on raspberry pi

First of all my sensor idk why is called Flower care and not Flower mate so I had to change it in the index.js file.
Second when I run the code on my Mac i see right data, this is my output after changing the Flower care string:

data DeviceData {
  deviceId: 'f31143dde9f749d596a571b481623490',
  temperature: 21.2,
  lux: 140,
  moisture: 0,
  fertility: 0 }
firmware { deviceId: 'f31143dde9f749d596a571b481623490',
  batteryLevel: 100,
  firmwareVersion: '2.9.4' }

But if I run the same code on my raspberry pi 0w I see wrong data.
The deviceId is different and similar to device macaddress.
Temperature, lux, moisture and fertility are random datas, here's my output on raspberry:

data DeviceData {
  deviceId: 'c47c8d61b312',
  temperature: 4804.2,
  lux: 2583686877,
  moisture: 39304,
  fertility: 26231 }
firmware { deviceId: 'c47c8d61b312',
  batteryLevel: 100,
  firmwareVersion: '2.9.4' }

My node versions are both 7.9.0 on Mac and Raspberry.

Replace let statement for var

Hi!

So I'm writing a plugin for Mi Flora for Pimatic, I would like to use this node-mi-flora module however Pimatic depends on an older version of Node.js. Don's ask me why.

Anyhow, I get the error message "Block-scoped declarations (let, const, function, class) not yet supported outside strict mode"

This is because the node-mi-flora module declares variables using the let statement instead of the var one.

To my understanding the behaviour of a variable defined with the let statement is the same as with the var statement if the variable is within the scope of a function, which is the case in the node-mi-flora module.

Is it possible to replace the let statement for the var one? To my understanding this would not change the functionality of the code whatsoever, however makes the code more backwards compatible.

Raspberry and Homebridge

Is it possibile to make this repo compatible with bluetooth of Raspberry Pi 3 and Homebridge?

Spotty telemetry.

Hi there. I'm having spotty telemetry from the device. I check it every 20 minutes (the device has latest firmware, 3.8.1). If i do it manually in Node Red i always get data, but when i leave it alone i get somethig like this:
`
{"time":"2017-12-28T04:37:49.919Z","address":"c4:7c:8d:65:cc:a9","rssi":-88,"temp":25,"moist":23,"light":42,"conductivity":133,"batteryLevel":100}

{"time":"2017-12-28T05:37:39.513Z","address":"c4:7c:8d:65:cc:a9","rssi":-89,"temp":25.2,"moist":22,"light":27,"conductivity":129}

{"time":"2017-12-28T05:57:39.691Z","address":"c4:7c:8d:65:cc:a9","rssi":-88,"temp":24.3,"moist":22,"light":45,"conductivity":127,"batteryLevel":100}

{"time":"2017-12-28T07:17:38.332Z","address":"c4:7c:8d:65:cc:a9","rssi":-95,"temp":23.6,"moist":21,"light":8,"conductivity":127}

{"time":"2017-12-28T07:37:37.330Z","address":"c4:7c:8d:65:cc:a9","rssi":-89}

{"time":"2017-12-28T07:57:37.282Z","address":"c4:7c:8d:65:cc:a9","rssi":-89}

{"time":"2017-12-28T08:17:38.271Z","address":"c4:7c:8d:65:cc:a9","rssi":-96}

{"time":"2017-12-28T08:37:44.256Z","address":"c4:7c:8d:65:cc:a9","rssi":-89}

{"time":"2017-12-28T08:57:42.270Z","address":"c4:7c:8d:65:cc:a9","rssi":-97}

{"time":"2017-12-28T09:17:39.154Z","address":"c4:7c:8d:65:cc:a9","rssi":-88}

{"time":"2017-12-28T09:37:38.164Z","address":"c4:7c:8d:65:cc:a9","rssi":-93}

{"time":"2017-12-28T10:17:38.060Z","address":"c4:7c:8d:65:cc:a9","rssi":-95}

{"time":"2017-12-28T10:37:46.057Z","address":"c4:7c:8d:65:cc:a9","rssi":-88,"temp":26.5,"moist":20,"light":5393,"conductivity":112,"batteryLevel":100}

{"time":"2017-12-28T10:57:45.945Z","address":"c4:7c:8d:65:cc:a9","rssi":-94,"temp":27,"moist":20,"light":5772,"conductivity":109,"batteryLevel":100}

{"time":"2017-12-28T11:17:40.160Z","address":"c4:7c:8d:65:cc:a9","rssi":-88,"temp":28.4,"moist":20,"light":8533,"conductivity":107,"batteryLevel":100}

{"time":"2017-12-28T11:37:40.148Z","address":"c4:7c:8d:65:cc:a9","rssi":-92,"temp":28.8,"moist":20,"light":7467,"conductivity":104,"batteryLevel":100}
`

I merged both data streams in an object. There is response from the bluetooth interface (you have the address and the signal strenght) but the data is not there.

What firmware version tested with?

Tested with v2.8.6
In index.js, there is: const DEFAULT_DEVICE_NAME = 'Flower mate';
But the Mi Flora's are called 'Flower care'

After changing this in index.js it finds the flora's, but the readings are odd:

miflora enabling realtime +544ms
miflora data: <Buffer aa bb cc dd ee ff 99 88 77 66 00 00 00 00 00 00> +44ms
miflora temperature: 4804.2 °C +6ms
miflora Light: 2583686877 lux +1ms
miflora moisture: 39304 % +0ms
miflora fertility: 26231 µS/cm +0ms
data DeviceData {
deviceId: 'c47c8d61fcf3',
temperature: 4804.2,
lux: 2583686877,
moisture: 39304,
fertility: 26231 }
miflora firmware data: <Buffer 64 1d 32 2e 38 2e 36> +67ms
firmware { deviceId: 'c47c8d61fcf3',
batteryLevel: 100,
firmwareVersion: '2.8.6' }

Is it possible to use it also in MAC OS terminal?

nice to meet you.
Is it possible to use it also in MAC OS terminal?
I was trying to communicate with Bluetooth on the MAC pro
I can not connect the device.

Do I need to set the Bluetooth setting on the node separately?

Too many errors

pi@raspberrypi:~ $ npm install node-mi-flora

> [email protected] install /home/pi/node_modules/usb
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download: https://github.com/tessel/node-usb/releases/download/1.2.0/usb_bindings-v1.2.0-node-v51-linux-arm.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v51 ABI) (falling back to source compile with node-gyp) 
Traceback (most recent call last):
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 13, in <module>
    import gyp
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 8, in <module>
    import gyp.input
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 5, in <module>
    from compiler.ast import Const
  File "/usr/lib/python2.7/compiler/__init__.py", line 29, in <module>
    from compiler.transformer import parse, parseFile
  File "/usr/lib/python2.7/compiler/transformer.py", line 29, in <module>
    import parser
ImportError: No module named parser
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:308:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:192:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.38-v7+
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/pi/node_modules/usb/src/binding/usb_bindings.node" "--module_name=usb_bindings" "--module_path=/home/pi/node_modules/usb/src/binding"
gyp ERR! cwd /home/pi/node_modules/usb
gyp ERR! node -v v7.6.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/nodejs /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/pi/node_modules/usb/src/binding/usb_bindings.node --module_name=usb_bindings --module_path=/home/pi/node_modules/usb/src/binding' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/pi/node_modules/usb/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:192:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:890:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Linux 4.4.38-v7+
node-pre-gyp ERR! command "/usr/bin/nodejs" "/home/pi/node_modules/usb/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pi/node_modules/usb
node-pre-gyp ERR! node -v v7.6.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.30
node-pre-gyp ERR! not ok 
Failed to execute '/usr/bin/nodejs /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/pi/node_modules/usb/src/binding/usb_bindings.node --module_name=usb_bindings --module_path=/home/pi/node_modules/usb/src/binding' (1)

> [email protected] install /home/pi/node_modules/bluetooth-hci-socket
> node-gyp rebuild

Traceback (most recent call last):
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 13, in <module>
    import gyp
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 8, in <module>
    import gyp.input
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 5, in <module>
    from compiler.ast import Const
  File "/usr/lib/python2.7/compiler/__init__.py", line 29, in <module>
    from compiler.transformer import parse, parseFile
  File "/usr/lib/python2.7/compiler/transformer.py", line 29, in <module>
    import parser
ImportError: No module named parser
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:308:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:192:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.38-v7+
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/pi/node_modules/bluetooth-hci-socket
gyp ERR! node -v v7.6.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok 
[email protected] node_modules/node-mi-flora/node_modules/noble/node_modules/bplist-parser -> node_modules/bplist-parser
[email protected] node_modules/node-mi-flora/node_modules/debug/node_modules/ms -> node_modules/ms
[email protected] node_modules/node-mi-flora/node_modules/debug -> node_modules/debug
[email protected] node_modules/node-mi-flora/node_modules/noble/node_modules/debug/node_modules/ms -> node_modules/noble/node_modules/ms
[email protected] node_modules/node-mi-flora/node_modules/noble/node_modules/debug -> node_modules/noble/node_modules/debug
[email protected] node_modules/node-mi-flora/node_modules/noble -> node_modules/noble
/home/pi
`-- [email protected] 

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: xpc-connection@~0.1.4 (node_modules/noble/node_modules/xpc-connection):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json'
npm WARN pi No description
npm WARN pi No repository field.
npm WARN pi No README data
npm WARN pi No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/usb):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-pre-gyp install --fallback-to-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/bluetooth-hci-socket):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

Possible EventEmitter memory leak detected

I am using this component with homebridge-mi-flower-care. After some time this error appears in the log and no updates are received subsequently:

(node) warning: possible EventEmitter memory leak detected. 11 servicesDiscover listeners added. Use emitter.setMaxListeners() to increase limit.

Do you have any idea?

Maybe it is related to the following issues: noble/noble#480

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.