Coder Social home page Coder Social logo

homebridge-mi-flora-filtered's Introduction

homebridge-mi-flora-filtered

NPM version License Downloads

This is a Homebridge plugin for exposing the Xiaomi Flower Care / Flower Mate / Flower Monitor / Mi Flora devices to HomeKit. Historical display of temperature / moisture data is available via HomeKit apps that support graphing (e.g. Elgato Eve).

Additional functionality

In this fork of homebridge-mi-flora, the data is first filtered with a moving-median filter to remove read errors. This is fixed with in this fork. Due to the median filter, the moving-median package is necessary. It should be installed automatically as dependency, but can be manually installed with:

(sudo) npm install -g moving-median

Installation

Prerequisites

System dependencies

This plugin is using node-mi-flora / @abandonware/noble in the background with the same package dependencies. @abandonware/noble is a version of noble that has support for Node 10+. To be able to use this version of Noble, I had to create a fork of the node-mi-flora with support for this version of Noble.

You can install the following dependencies using apt-get, if not already done.

(sudo) apt-get install bluetooth bluez libbluetooth-dev libudev-dev

It is recommended to install @abandonware/noble, node-gyp and bluetooth-hci-socket manually with the following commands:

sudo npm install --unsafe-perm -g bluetooth-hci-socket
sudo npm install -g --unsafe-perm @abandonware/noble
sudo npm install -g --unsafe-perm node-gyp

MAC address

Ensure you know the MAC address of your Xiaomi Flower Care. You can use hcitool lescan to scan for devices. The device will appear as AA:BB:CC:DD:EE:FF Flower care in the list.

npm

(sudo) npm install -g --unsafe-perm homebridge-mi-flora-filtered

Example Configuration

{
  "accessory": "mi-flower-care",
  "name": "Golden cane palm",
  "deviceId": "AA:BB:CC:DD:EE:FF",
  "interval": 300
}
Key Description Optional / Required
accessory     Has to be mi-flower-care. Required
name The name of this accessory. This will appear in your HomeKit app. Required
deviceId The MAC address of your Xiaomi Flower Care device. Required
interval Frequency of data refresh in seconds. Minimum: 1 (not recommended); Maximum: 600 (due to FakeGato). Required
humidityAlertLevel Humidity level in percent used to trigger the humidity alert contact sensor. Optional
lowLightAlertLevel Low light level in Lux used to trigger a low light alert contact sensor. Optional

Typical values for humidityAlertLevelare 30 (%) and 2000 (Lux) for lowLightAlertLevel.

Running

Due to Bluetooth access, Homebridge must run with elevated privileges to work correctly i.e. sudo or root.

Note

The plugins is using Bluetooth LE (Low Energy) to connect to the Xiaomi Flower Care devices. Therefore, the first measured values are only visible after the first broadcast of the sensor. Up to this point the plugin is marked as inactive in HomeKit. In the worst case, the waiting time can last up to several minutes. Just have a little patience.

Credits

  • lucavb - homebridge-mi-flora
  • demirhanaydin - node-mi-flora
  • simont77 - fakegato-history

Legal

Xiaomi and Mi are registered trademarks of BEIJING XIAOMI TECHNOLOGY CO., LTD.

This project is in no way affiliated with, authorized, maintained, sponsored or endorsed by BEIJING XIAOMI TECHNOLOGY CO., LTD or any of its affiliates or subsidiaries.

homebridge-mi-flora-filtered's People

Contributors

arouanet avatar honkmaster avatar lostjen avatar lucavb avatar martvvliet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

homebridge-mi-flora-filtered's Issues

No Data is updated

Hello,

today I installed your Plugin on my HOOBS Homebridge without any errors.
After configuration the Flower-Sensor was visible in the Home-App but no data was updated after several hours. I think the issue can be, that "sudo hcitool lescan" threw an error and I had to use "sudo bluetoothctl scan on" scanning for devices. The MAC-Address I used in the configuration of HOOBS.
Thank you for your help! :-)

Log-Warnings about Current Ambient Light Level

Hello.

In my Homebridge log I keep getting the following message (sometimes less, sometimes very often). This probably has no functional effect, but also does not serve the purpose of log clarity :-)).

[9/14/2021, 12:16:06 PM] [homebridge-mi-flora-filtered] This plugin generated a warning from the characteristic 'Current Ambient Light Level': characteristic was supplied illegal value: number 0 exceeded minimum of 0.0001. See https://git.io/JtMGR for more info.

It would be great if this could be fixed. According to my (amateurish) Google research, this is probably due to the plug-in.

Maybe helpfull: https://github.com/homebridge/homebridge/wiki/Characteristic-Warnings

Regards, 2lazy2chill

Log entries in Homebridge show correct data. Defined Accessories do not

I have six sensors currently in use. For ease of use I'm not going to refer to them by MAC but rather 1-6. 5 is at the edge of the range. Visually reading the log or even using grep would show that it was lowish on water. WatchFlower (another open source app to read MiFlora devices) agrees with the logged values. However the Accessory does NOT agree and actually I've seen it's moisture value get propagated into multiple accessories before being overwritten by the next set of values. Further it's low water opened this morning as it should since I just set it up yesterday. Interestingly the value for humidity was like 48% when contact open was 25%. I just watered and it hasn't closed but that sensor can take a hour because of range. In short it looks like the correct values come in, but homebridge-mi-flora-filtered is assigned them to the wrong and/or multiple accessories. Most of my MAC address do start with the same 6 hex chars, but the last two are unique. I am using a Pi 4 and I know you've said you are using a Pi 3, but really shouldn't matter.

did not start with actual node lts

Hi Guys,

I updated my homebridge today incl. the node version.

node.js 14.15.0
npm 6.14.8

after a reboot the homebridge-mi-flora-filtered plug-in did not start proper and the complete homebridge shutdown.

Nov 10 21:36:37 raspberrypi homebridge[9515]: [10/11/2020, 21:36:37] ERROR LOADING PLUGIN homebridge-mi-flora-filtered: Nov 10 21:36:38 raspberrypi homebridge[9515]: [10/11/2020, 21:36:38] Error: The module '/usr/local/lib/node_modules/homebridge-mi-flora-filtered/node_modules/@abandonware/bluetooth-hci-socket/lib/binding/binding.node' Nov 10 21:36:38 raspberrypi homebridge[9515]: was compiled against a different Node.js version using Nov 10 21:36:38 raspberrypi homebridge[9515]: NODE_MODULE_VERSION 72. This version of Node.js requires Nov 10 21:36:38 raspberrypi homebridge[9515]: NODE_MODULE_VERSION 83. Please try re-compiling or re-installing Nov 10 21:36:38 raspberrypi homebridge[9515]: the module (for instance, using npm rebuildornpm install). Nov 10 21:36:38 raspberrypi homebridge[9515]: at Object.Module._extensions..node (internal/modules/cjs/loader.js:1122:18) Nov 10 21:36:38 raspberrypi homebridge[9515]: at Module.load (internal/modules/cjs/loader.js:928:32) Nov 10 21:36:38 raspberrypi homebridge[9515]: at Function.Module._load (internal/modules/cjs/loader.js:769:14) Nov 10 21:36:38 raspberrypi homebridge[9515]: at Module.require (internal/modules/cjs/loader.js:952:19) Nov 10 21:36:38 raspberrypi homebridge[9515]: at require (internal/modules/cjs/helpers.js:88:18) Nov 10 21:36:38 raspberrypi homebridge[9515]: at Object.<anonymous> (/usr/local/lib/node_modules/homebridge-mi-flora-filtered/node_modules/@abandonware/bluetooth-hci-socket/lib/native.js:6:15) Nov 10 21:36:38 raspberrypi homebridge[9515]: at Module._compile (internal/modules/cjs/loader.js:1063:30) Nov 10 21:36:38 raspberrypi homebridge[9515]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) Nov 10 21:36:38 raspberrypi homebridge[9515]: at Module.load (internal/modules/cjs/loader.js:928:32) Nov 10 21:36:38 raspberrypi homebridge[9515]: at Function.Module._load (internal/modules/cjs/loader.js:769:14)

I tried out again
sudo npm install --unsafe-perm -g bluetooth-hci-socket sudo npm install -g --unsafe-perm @abandonware/noble sudo npm install -g --unsafe-perm node-gyp
but this didnt help.

Have anybode a tipp, please?

Currently I remove the entry in the config.json and the homebridge restart again, but without the xiaomi sensons of course.

Thank you!

1.3.5 - no data

Changes in this line compared to 1.3.4 Lead to no data:

if (data.deviceId == that.deviceId) {
that.log("Lux: %s, Temperature: %s, Moisture: %s, Fertility: %s", data.lux, data.temperature, data.moisture, data.fertility);

Neither in log nor Eve App.

In contrast

if (data.deviceId = that.deviceId) {
that.log("Firmware: %s, Battery level: %s", data.firmwareVersion, data.batteryLevel);
that.storedData.firmware = data;

gives data in log and App.

Humidity contact sensor

Hello, I'm trying to better understand how to use the contact sensors that are exposed.

What values trigger the humidity contact sensor to open? The guide here mentions 30% is typical, but currently the soil moisture (humidity) level of my Mi Flora is reading at 28% and I've yet to see the contact sensor open. Does that mean that the sensor opens if moisture/humidity rise above 30% instead?

Plugin does not run anymore from one day to the next...

Hello lucavb. I use Homebridge 1.2.3 (on a Synology NAS within a Docker) and since last updates (maybe...) of Homebridge UI (now v4.33.0) and/or Homebridge Dummy (now v0.4.1) your Plug-In doesn't work anymore...:

[11/15/2020, 12:17:54 PM] ====================
[11/15/2020, 12:17:54 PM] ERROR LOADING PLUGIN homebridge-mi-flora-filtered:
[11/15/2020, 12:17:54 PM] Error: Error relocating /homebridge/node_modules/homebridge-mi-flora-filtered/node_modules/@abandonware/bluetooth-hci-socket/lib/binding/binding.node: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE: symbol not found
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1122:18)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object. (/homebridge/node_modules/homebridge-mi-flora-filtered/node_modules/@abandonware/bluetooth-hci-socket/lib/native.js:6:15)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
[11/15/2020, 12:17:54 PM] ====================
[11/15/2020, 12:17:54 PM] Error loading accessory requested in your config.json at position 1
[11/15/2020, 12:17:55 PM] Error: The requested accessory 'mi-flower-care' was not registered by any plugin.
at PluginManager.getPluginForAccessory (/usr/local/lib/node_modules/homebridge/src/pluginManager.ts:198:15)

at /usr/local/lib/node_modules/homebridge/src/server.ts:345:37
at Array.forEach ()
at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/src/server.ts:328:29)
at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:154:12)
at cli (/usr/local/lib/node_modules/homebridge/src/cli.ts:80:10)
at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
[11/15/2020, 12:17:59 PM] [Homebridge UI] Homebridge Config UI X v4.33.0 is listening on :: port 8581
[11/15/2020, 12:18:01 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null
[11/15/2020, 12:18:06 PM] [HB Supervisor] Restarting Homebridge...
[11/15/2020, 12:18:06 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /homebridge/node_modules
[11/15/2020, 12:18:06 PM] [HB Supervisor] Started Homebridge v1.2.3 with PID: 1510
[11/15/2020, 12:18:08 PM] Loaded config.json with 1 accessories and 2 platforms.
[11/15/2020, 12:18:08 PM] ---
[11/15/2020, 12:18:09 PM] Loaded plugin: [email protected]
[11/15/2020, 12:18:09 PM] Registering accessory 'homebridge-dummy.DummySwitch'
[11/15/2020, 12:18:09 PM] ---
[11/15/2020, 12:18:10 PM] Loaded plugin: [email protected]
[11/15/2020, 12:18:10 PM] Registering platform 'homebridge-harmony.HarmonyHubWebSocket'
[11/15/2020, 12:18:10 PM] ---
[11/15/2020, 12:18:10 PM] ====================

Support for hoobs non root?

I tried a lot using your plugin within hoobs. Unfortunately I don't get any data from the sensor, even it is shown in the home app. The reason seems to be that I run Homebridge as a hoobs instance. For security purposes not with root rights but as hoobsadmin. That's the typical way how to run hoobs and there is absolutely no issue doing so with other plugins. To proof if the rights are the problem, I even run hoobs in a different instance with roots rights and the data was displayed. However I would prefer to run hoobs still not as root.

Are you able to improve the plugin in that way that it catches the data even without run Homebridge as root user? Thank you in advance!

It is possible to use this plugin on Mac OS X?

i'm truing to using plugin https://github.com/moifort/homebridge-xiaomi-plant-monitor
[6/17/2020, 1:49:17 PM] [xiaomi-plant-monitor] Finish scanning found 1 plant(s)
[6/17/2020, 1:49:17 PM] [xiaomi-plant-monitor] Add new plant 80:ea:ca:88:e4:26
[6/17/2020, 1:49:17 PM] [xiaomi-plant-monitor] Fetch plants data
[6/17/2020, 1:49:19 PM] [xiaomi-plant-monitor] battery: 100% firmware: 3.2.1 temperature: 33.2° lux: 26130 moisture: 18% fertility: 20
it's works, but home app shows only humidity data.

trying to use homebridge-mi-flora-filtered plugin with two variants of config - no data.

Node.js Version v14.3.0
NPM v6.14.5

,
{
"accessory": "mi-flower-care",
"name": "CLARA",
"deviceId": "B89927D7-67FC-4D89-98F7-9EE0BA7F0463",
"interval": 300
}

,
{
"accessory": "mi-flower-care",
"name": "CLARA",
"deviceId": "80:ea:ca:88:e4:26",
"interval": 300
}

plug-in looks like to work fine, but no data in Apple Homekit

Good Morning,

I used the Homebridge mi flora filtered plug-in for a while. With the last update of the plug-in I have the problem, the the values in the log of Homebridge are fine. I checked every 10 minutes and the values looks good.

[6/28/2020, 10:18:49] [Gartenbeet] Firmware: 3.1.9, Battery level: 100 [6/28/2020, 10:28:45] [Blume] Firmware: 3.2.1, Battery level: 97 [6/28/2020, 10:38:47] [Gartenbeet] Firmware: 3.1.9, Battery level: 100 [6/28/2020, 10:38:47] [Blume] Firmware: 3.2.1, Battery level: 98 [6/28/2020, 10:48:46] [Blume] Firmware: 3.2.1, Battery level: 98 [6/28/2020, 10:58:47] [Gartenbeet] Firmware: 3.1.9, Battery level: 100 [6/28/2020, 11:08:45] [Blume] Firmware: 3.2.1, Battery level: 98 [6/28/2020, 11:18:45] [Blume] Firmware: 3.2.1, Battery level: 98 [6/28/2020, 11:18:46] [Gartenbeet] Firmware: 3.1.9, Battery level: 100 [6/28/2020, 11:28:49] [Blume] Firmware: 3.2.1, Battery level: 98 [6/28/2020, 11:28:50] [Gartenbeet] Firmware: 3.1.9, Battery level: 100 [6/28/2020, 11:48:48] [Blume] Firmware: 3.2.1, Battery level: 98 [6/28/2020, 11:58:47] [Blume] Firmware: 3.2.1, Battery level: 98 [6/28/2020, 12:08:46] [Blume] Firmware: 3.2.1, Battery level: 98 [6/28/2020, 12:08:48] [Gartenbeet] Firmware: 3.1.9, Battery level: 100

But no data are transfered to Apple Homekit. I tried to restart Homebridge and Apple Homekit Central (Apple TV). But nothing change.

Any ideas before I remove the homebridge from Apple Homekit and re-connect? I fear all rules and automation are gone afterwards and have to reassign.

Homebridge 1.1.1.
node js 12.18.1
npm 6.14.5
homebridge-mi-flora-filtered 1.3.5
tvOS 13.4.6 (Apple TV as Apple Homekit Central)

Blocks other bluetooth apps.

Hey,

This plugin does exactly what I want, works perfectly gives correct data.
The only downside is it blocks other bluetooth apps, probably because it opens a connection with the flower, then retrieves data every X seconds. It does not close the connection so other apps cannot make a new connection, there already is one.

Maybe you could rewrite is, so that every X seconds it starts a connection retrieves data and closes the connection.
Should be possible, right?

Thanks anyway.

Error at Homebridge 1.3

Running the plug-in with Homebridge 1.3 causes a warning which could relate to a disfunction
image

Only see 0 as data

Hi,

I've installed your plugin and in HomeKit there are no errors, but my Mi Flower Care only shows 0's. Lux is 0, humidity is 0, and temperature the same. Everything went fine except the bluetooth socket. It doesn't want to load, error log below. Thank you upfront for help.

sudo npm install --unsafe-perm -g bluetooth-hci-socket

[email protected] install /opt/nodejs/lib/node_modules/bluetooth-hci-socket/node_modules/usb
prebuild-install --verbose || node-gyp rebuild

prebuild-install info begin Prebuild-install version 5.3.3
prebuild-install info looking for cached prebuild @ /root/.npm/_prebuilds/1e1a75-usb-v1.6.2-node-v67-linux-arm.tar.gz
prebuild-install http request GET https://github.com/tessel/node-usb/releases/download/v1.6.2/usb-v1.6.2-node-v67-linux-arm.tar.gz
prebuild-install http 404 https://github.com/tessel/node-usb/releases/download/v1.6.2/usb-v1.6.2-node-v67-linux-arm.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=11.5.0 runtime=node arch=arm libc= platform=linux)
make: Entering directory '/opt/nodejs/lib/node_modules/bluetooth-hci-socket/node_modules/usb/build'
CC(target) Release/obj.target/libusb/libusb/libusb/core.o
CC(target) Release/obj.target/libusb/libusb/libusb/descriptor.o
CC(target) Release/obj.target/libusb/libusb/libusb/hotplug.o
CC(target) Release/obj.target/libusb/libusb/libusb/io.o
CC(target) Release/obj.target/libusb/libusb/libusb/strerror.o
CC(target) Release/obj.target/libusb/libusb/libusb/sync.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/poll_posix.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/threads_posix.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_usbfs.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_udev.o
AR(target) Release/obj.target/usb.a
COPY Release/usb.a
CXX(target) Release/obj.target/usb_bindings/src/node_usb.o
In file included from ../src/helpers.h:3,
from ../src/node_usb.h:21,
from ../src/node_usb.cc:1:
../node_modules/nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../node_modules/nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void ()(uv_work_t)’ {aka ‘void ()(uv_work_s)’} to ‘uv_after_work_cb’ {aka ‘void ()(uv_work_s, int)’} [-Wcast-function-type]
, reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
^
In file included from ../src/node_usb.h:14,
from ../src/node_usb.cc:1:
../src/node_usb.cc: At global scope:
/root/.cache/node-gyp/11.5.0/include/node/node.h:495:43: warning: cast between incompatible function types from ‘void ()(v8::Localv8::Object)’ to ‘node::addon_register_func’ {aka ‘void ()(v8::Localv8::Object, v8::Localv8::Value, void*)’} [-Wcast-function-type]
(node::addon_register_func) (regfunc),
^
/root/.cache/node-gyp/11.5.0/include/node/node.h:529:3: note: in expansion of macro ‘NODE_MODULE_X’
NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
^~~~~~~~~~~~~
../src/node_usb.cc:95:1: note: in expansion of macro ‘NODE_MODULE’
NODE_MODULE(usb_bindings, Initialize)
^~~~~~~~~~~
../src/node_usb.cc: In function ‘void handleHotplug(std::pair<libusb_device*, libusb_hotplug_event>)’:
../src/node_usb.cc:151:58: warning: ‘v8::Localv8::Value Nan::MakeCallback(v8::Localv8::Object, const char*, int, v8::Localv8::Value)’ is deprecated [-Wdeprecated-declarations]
Nan::MakeCallback(Nan::New(hotplugThis), "emit", 2, argv);
^
In file included from ../src/helpers.h:3,
from ../src/node_usb.h:21,
from ../src/node_usb.cc:1:
../node_modules/nan/nan.h:1001:46: note: declared here
NAN_DEPRECATED inline v8::Localv8::Value MakeCallback(
^~~~~~~~~~~~
../src/node_usb.cc:151:58: warning: ‘v8::Localv8::Value Nan::MakeCallback(v8::Localv8::Object, const char
, int, v8::Localv8::Value)’ is deprecated [-Wdeprecated-declarations]
Nan::MakeCallback(Nan::New(hotplugThis), "emit", 2, argv);
^
In file included from ../src/helpers.h:3,
from ../src/node_usb.h:21,
from ../src/node_usb.cc:1:
../node_modules/nan/nan.h:1001:46: note: declared here
NAN_DEPRECATED inline v8::Localv8::Value MakeCallback(
^~~~~~~~~~~~
In file included from ../src/node_usb.h:12,
from ../src/node_usb.cc:1:
/root/.cache/node-gyp/11.5.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P
, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void ()(const v8::WeakCallbackInfonode::ObjectWrap&)’:
/root/.cache/node-gyp/11.5.0/include/node/node_object_wrap.h:85:78: required from here
/root/.cache/node-gyp/11.5.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfonode::ObjectWrap::Callbac’ {aka ‘void (
)(const v8::WeakCallbackInfonode::ObjectWrap&)’} to ‘Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} [-Wcast-function-type]
reinterpret_cast(callback), type);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.cache/node-gyp/11.5.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P
, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void ()(const v8::WeakCallbackInfoNan::ObjectWrap&)]’:
../node_modules/nan/nan_object_wrap.h:65:61: required from here
/root/.cache/node-gyp/11.5.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfoNan::ObjectWrap::Callback’ {aka ‘void (
)(const v8::WeakCallbackInfoNan::ObjectWrap&)’} to ‘Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} [-Wcast-function-type]
CXX(target) Release/obj.target/usb_bindings/src/device.o
In file included from ../src/helpers.h:3,
from ../src/node_usb.h:21,
from ../src/device.cc:1:
../node_modules/nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker
)’:
../node_modules/nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void ()(uv_work_t)’ {aka ‘void ()(uv_work_s)’} to ‘uv_after_work_cb’ {aka ‘void ()(uv_work_s, int)’} [-Wcast-function-type]
, reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
^
../src/device.cc: In member function ‘void Req::submit(Device*, v8::Localv8::Function, uv_work_cb, uv_work_cb)’:
../src/device.cc:220:70: warning: cast between incompatible function types from ‘uv_work_cb’ {aka ‘void ()(uv_work_s)’} to ‘uv_after_work_cb’ {aka ‘void ()(uv_work_s, int)’} [-Wcast-function-type]
uv_queue_work(uv_default_loop(), &req, backend, (uv_after_work_cb) after);
^~~~~
../src/device.cc: In static member function ‘static void Req::default_after(uv_work_t*)’:
../src/device.cc:237:64: warning: ‘v8::Localv8::Value Nan::MakeCallback(v8::Localv8::Object, v8::Localv8::Function, int, v8::Localv8::Value)’ is deprecated [-Wdeprecated-declarations]
Nan::MakeCallback(device, Nan::New(baton->callback), 1, argv);
^
In file included from ../src/helpers.h:3,
from ../src/node_usb.h:21,
from ../src/device.cc:1:
../node_modules/nan/nan.h:959:46: note: declared here
NAN_DEPRECATED inline v8::Localv8::Value MakeCallback(
^~~~~~~~~~~~
../src/device.cc:237:64: warning: ‘v8::Localv8::Value Nan::MakeCallback(v8::Localv8::Object, v8::Localv8::Function, int, v8::Localv8::Value
)’ is deprecated [-Wdeprecated-declarations]
Nan::MakeCallback(device, Nan::New(baton->callback), 1, argv);
^
In file included from ../src/helpers.h:3,
from ../src/node_usb.h:21,
from ../src/device.cc:1:
../node_modules/nan/nan.h:959:46: note: declared here
NAN_DEPRECATED inline v8::Localv8::Value MakeCallback(
^~~~~~~~~~~~
In file included from ../src/node_usb.h:12,
from ../src/device.cc:1:
/root/.cache/node-gyp/11.5.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P*, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void ()(const v8::WeakCallbackInfonode::ObjectWrap&)’:
/root/.cache/node-gyp/11.5.0/include/node/node_object_wrap.h:85:78: required from here
/root/.cache/node-gyp/11.5.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfonode::ObjectWrap::Callbac’ {aka ‘void (
)(const v8::WeakCallbackInfonode::ObjectWrap&)’} to ‘Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} [-Wcast-function-type]
reinterpret_cast(callback), type);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.cache/node-gyp/11.5.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P
, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void ()(const v8::WeakCallbackInfoNan::ObjectWrap&)]’:
../node_modules/nan/nan_object_wrap.h:65:61: required from here
/root/.cache/node-gyp/11.5.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfoNan::ObjectWrap::Callback’ {aka ‘void (
)(const v8::WeakCallbackInfoNan::ObjectWrap&)’} to ‘Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} [-Wcast-function-type]
CXX(target) Release/obj.target/usb_bindings/src/transfer.o
In file included from ../src/helpers.h:3,
from ../src/node_usb.h:21,
from ../src/transfer.cc:1:
../node_modules/nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker
)’:
../node_modules/nan/nan.h:2232:62: warning: cast between incompatible function types from ‘void ()(uv_work_t)’ {aka ‘void ()(uv_work_s)’} to ‘uv_after_work_cb’ {aka ‘void ()(uv_work_s, int)’} [-Wcast-function-type]
, reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
^
../src/transfer.cc: In function ‘void handleCompletion(Transfer*)’:
../src/transfer.cc:126:72: warning: ‘v8::Localv8::Value Nan::MakeCallback(v8::Localv8::Object, v8::Localv8::Function, int, v8::Localv8::Value)’ is deprecated [-Wdeprecated-declarations]
Nan::MakeCallback(self->handle(), Nan::New(self->v8callback), 3, argv);
^
In file included from ../src/helpers.h:3,
from ../src/node_usb.h:21,
from ../src/transfer.cc:1:
../node_modules/nan/nan.h:959:46: note: declared here
NAN_DEPRECATED inline v8::Localv8::Value MakeCallback(
^~~~~~~~~~~~
../src/transfer.cc:126:72: warning: ‘v8::Localv8::Value Nan::MakeCallback(v8::Localv8::Object, v8::Localv8::Function, int, v8::Localv8::Value
)’ is deprecated [-Wdeprecated-declarations]
Nan::MakeCallback(self->handle(), Nan::New(self->v8callback), 3, argv);
^
In file included from ../src/helpers.h:3,
from ../src/node_usb.h:21,
from ../src/transfer.cc:1:
../node_modules/nan/nan.h:959:46: note: declared here
NAN_DEPRECATED inline v8::Localv8::Value MakeCallback(
^~~~~~~~~~~~
In file included from ../src/node_usb.h:12,
from ../src/transfer.cc:1:
/root/.cache/node-gyp/11.5.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P*, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void ()(const v8::WeakCallbackInfonode::ObjectWrap&)’:
/root/.cache/node-gyp/11.5.0/include/node/node_object_wrap.h:85:78: required from here
/root/.cache/node-gyp/11.5.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfonode::ObjectWrap::Callbac’ {aka ‘void (
)(const v8::WeakCallbackInfonode::ObjectWrap&)’} to ‘Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} [-Wcast-function-type]
reinterpret_cast(callback), type);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.cache/node-gyp/11.5.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P
, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void ()(const v8::WeakCallbackInfoNan::ObjectWrap&)]’:
../node_modules/nan/nan_object_wrap.h:65:61: required from here
/root/.cache/node-gyp/11.5.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfoNan::ObjectWrap::Callback’ {aka ‘void (
)(const v8::WeakCallbackInfoNan::ObjectWrap&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo&)’} [-Wcast-function-type]
SOLINK_MODULE(target) Release/obj.target/usb_bindings.node
COPY Release/usb_bindings.node
make: Leaving directory '/opt/nodejs/lib/node_modules/bluetooth-hci-socket/node_modules/usb/build'

[email protected] install /opt/nodejs/lib/node_modules/bluetooth-hci-socket
node-gyp rebuild

make: Entering directory '/opt/nodejs/lib/node_modules/bluetooth-hci-socket/build'
CXX(target) Release/obj.target/binding/src/BluetoothHciSocket.o
In file included from ../src/BluetoothHciSocket.cpp:8:
../node_modules/nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../node_modules/nan/nan.h:2298:62: warning: cast between incompatible function types from ‘void ()(uv_work_t)’ {aka ‘void ()(uv_work_s)’} to ‘uv_after_work_cb’ {aka ‘void ()(uv_work_s, int)’} [-Wcast-function-type]
, reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
^
../src/BluetoothHciSocket.cpp: In member function ‘void BluetoothHciSocket::poll()’:
../src/BluetoothHciSocket.cpp:251:95: warning: ‘v8::Localv8::Value Nan::MakeCallback(v8::Localv8::Object, v8::Localv8::String, int, v8::Localv8::Value*’ is deprecated [-Wdeprecated-declarations]
back(Nan::New(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);
^

In file included from ../src/BluetoothHciSocket.cpp:8:
../node_modules/nan/nan.h:1045:46: note: declared here
NAN_DEPRECATED inline v8::Localv8::Value MakeCallback(
^~~~~~~~~~~~
../src/BluetoothHciSocket.cpp:251:95: warning: ‘v8::Localv8::Value Nan::MakeCallback(v8::Localv8::Object, v8::Localv8::String, int, v8::Localv8::Value*’ is deprecated [-Wdeprecated-declarations]
back(Nan::New(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);
^

In file included from ../src/BluetoothHciSocket.cpp:8:
../node_modules/nan/nan.h:1045:46: note: declared here
NAN_DEPRECATED inline v8::Localv8::Value MakeCallback(
^~~~~~~~~~~~
../src/BluetoothHciSocket.cpp: In member function ‘void BluetoothHciSocket::emitErrnoError()’:
../src/BluetoothHciSocket.cpp:275:72: error: no matching function for call to ‘v8::Function::NewInstance(int, v8::Localv8::Value [1])’
Local error = errorConstructor->NewInstance(1, constructorArgs);
^
In file included from /root/.cache/node-gyp/11.5.0/include/node/node.h:63,
from /root/.cache/node-gyp/11.5.0/include/node/node_buffer.h:2,
from ../src/BluetoothHciSocket.cpp:7:
/root/.cache/node-gyp/11.5.0/include/node/v8.h:4105:44: note: candidate: ‘v8::MaybeLocalv8::Object v8::Function::NewInstance(v8::Localv8::Context, int, v8::Localv8::Value) const’
V8_WARN_UNUSED_RESULT MaybeLocal NewInstance(
^~~~~~~~~~~
/root/.cache/node-gyp/11.5.0/include/node/v8.h:4105:44: note: candidate expects 3 arguments, 2 provided
/root/.cache/node-gyp/11.5.0/include/node/v8.h:4108:44: note: candidate: ‘v8::MaybeLocalv8::Object v8::Function::NewInstance(v8::Localv8::Context) const’
V8_WARN_UNUSED_RESULT MaybeLocal NewInstance(
^~~~~~~~~~~
/root/.cache/node-gyp/11.5.0/include/node/v8.h:4108:44: note: candidate expects 1 argument, 2 provided
../src/BluetoothHciSocket.cpp:282:93: warning: ‘v8::Localv8::Value Nan::MakeCallback(v8::Localv8::Object, v8::Localv8::String, int, v8::Localv8::Value’ is deprecated [-Wdeprecated-declarations]
back(Nan::New(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);
^

In file included from ../src/BluetoothHciSocket.cpp:8:
../node_modules/nan/nan.h:1045:46: note: declared here
NAN_DEPRECATED inline v8::Localv8::Value MakeCallback(
^~~~~~~~~~~~
../src/BluetoothHciSocket.cpp:282:93: warning: ‘v8::Localv8::Value Nan::MakeCallback(v8::Localv8::Object, v8::Localv8::String, int, v8::Localv8::Value*’ is deprecated [-Wdeprecated-declarations]
back(Nan::New(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);
^

In file included from ../src/BluetoothHciSocket.cpp:8:
../node_modules/nan/nan.h:1045:46: note: declared here
NAN_DEPRECATED inline v8::Localv8::Value MakeCallback(
^~~~~~~~~~~~
../src/BluetoothHciSocket.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE BluetoothHciSocket::BindRaw(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/BluetoothHciSocket.cpp:395:34: warning: ‘int64_t v8::Value::IntegerValue() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
devId = arg0->IntegerValue();
^
In file included from /root/.cache/node-gyp/11.5.0/include/node/v8.h:26,
from /root/.cache/node-gyp/11.5.0/include/node/node.h:63,
from /root/.cache/node-gyp/11.5.0/include/node/node_buffer.h:2,
from ../src/BluetoothHciSocket.cpp:7:
/root/.cache/node-gyp/11.5.0/include/node/v8.h:2570:46: note: declared here
V8_DEPRECATED("Use maybe version", int64_t IntegerValue() const);
^~~~~~~~~~~~
/root/.cache/node-gyp/11.5.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
declarator attribute((deprecated(message)))
^~~~~~~~~~
../src/BluetoothHciSocket.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE BluetoothHciSocket::BindUser(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/BluetoothHciSocket.cpp:417:34: warning: ‘int64_t v8::Value::IntegerValue() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
devId = arg0->IntegerValue();
^
In file included from /root/.cache/node-gyp/11.5.0/include/node/v8.h:26,
from /root/.cache/node-gyp/11.5.0/include/node/node.h:63,
from /root/.cache/node-gyp/11.5.0/include/node/node_buffer.h:2,
from ../src/BluetoothHciSocket.cpp:7:
/root/.cache/node-gyp/11.5.0/include/node/v8.h:2570:46: note: declared here
V8_DEPRECATED("Use maybe version", int64_t IntegerValue() const);
^~~~~~~~~~~~
/root/.cache/node-gyp/11.5.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
declarator attribute((deprecated(message)))
^~~~~~~~~~
In file included from /root/.cache/node-gyp/11.5.0/include/node/node_buffer.h:2,
from ../src/BluetoothHciSocket.cpp:7:
../src/BluetoothHciSocket.cpp: At global scope:
/root/.cache/node-gyp/11.5.0/include/node/node.h:495:43: warning: cast between incompatible function types from ‘void ()(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void ()(v8::Localv8::Object)’} to ‘node::addon_register_func’ {aka void ()(v8::Localv8::Object, v8::Localv8::Value, void)’} [-Wcast-function-type]
(node::addon_register_func) (regfunc),
^
/root/.cache/node-gyp/11.5.0/include/node/node.h:529:3: note: in expansion of macro ‘NODE_MODULE_X’
NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
^~~~~~~~~~~~~
../src/BluetoothHciSocket.cpp:499:1: note: in expansion of macro ‘NODE_MODULE’
NODE_MODULE(binding, BluetoothHciSocket::Init);
^~~~~~~~~~~
In file included from /root/.cache/node-gyp/11.5.0/include/node/node.h:63,
from /root/.cache/node-gyp/11.5.0/include/node/node_buffer.h:2,
from ../src/BluetoothHciSocket.cpp:7:
/root/.cache/node-gyp/11.5.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P*, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void ()(const v8::WeakCallbackInfonode::ObjectWrap&)’:
/root/.cache/node-gyp/11.5.0/include/node/node_object_wrap.h:85:78: required from here
/root/.cache/node-gyp/11.5.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfonode::ObjectWrap::Callbac’ {aka ‘void (
)(const v8::WeakCallbackInfonode::ObjectWrap&)’} to ‘Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} [-Wcast-function-type]
reinterpret_cast(callback), type);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.cache/node-gyp/11.5.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase::SetWeak(P
, typename v8::WeakCallbackInfo

::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo

::Callback = void ()(const v8::WeakCallbackInfoNan::ObjectWrap&)]’:
../node_modules/nan/nan_object_wrap.h:65:61: required from here
/root/.cache/node-gyp/11.5.0/include/node/v8.h:9707:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfoNan::ObjectWrap::Callback’ {aka ‘void (
)(const v8::WeakCallbackInfoNan::ObjectWrap&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo&)’} [-Wcast-function-type]
make: *** [binding.target.mk:99: Release/obj.target/binding/src/BluetoothHciSocket.o] Error 1
make: Leaving directory '/opt/nodejs/lib/node_modules/bluetooth-hci-socket/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/opt/nodejs/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:189:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Linux 4.19.97-v7l+
gyp ERR! command "/opt/nodejs/bin/node" "/opt/nodejs/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/nodejs/lib/node_modules/bluetooth-hci-socket
gyp ERR! node -v v11.5.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-04-05T16_10_23_085Z-debug.log

new update error

Error: Cannot add a Characteristic with the same UUID as another Characteristic in this Service: undefined
    at PlantSensor.Service._this.addCharacteristic (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Service.ts:190:15)
    at PlantSensor.Service.getCharacteristic (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Service.ts:292:23)
    at MiFlowerCarePlugin.setUpServices (/usr/lib/node_modules/homebridge-mi-flora-filtered/index.js:337:29)
    at new MiFlowerCarePlugin (/usr/lib/node_modules/homebridge-mi-flora-filtered/index.js:54:10)
    at /usr/lib/node_modules/homebridge/src/server.ts:356:50
    at Array.forEach (<anonymous>)
    at Server._loadAccessories (/usr/lib/node_modules/homebridge/src/server.ts:329:29)
    at Server.start (/usr/lib/node_modules/homebridge/src/server.ts:155:12)
    at cli (/usr/lib/node_modules/homebridge/src/cli.ts:80:10)
    at Object.<anonymous> (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)

Writing data of multiple Mi-Flora to txt files

Hey!
I managed by modifying the index.js to print the collected data to several textfiles (PlantA_temp.txt) .
But i can not make it work with the data of a second stick (target file PlantB_temp.txt)
The data of both sticks is always written to PlantA files.

Can you help me or give a hint?

Greetz!

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.