Xiaomi Mi Flora / Flower Care - Smarter Pflanzensensor homebridge-mi-flower-care

  • So, ich gebe nicht auf! Die Dinger müssen irgendwann doch mal Daten ausspucken. Vielleicht könnt ihr mir bei der Eingrenzung des Problems helfen und einen Blick drüber werfen, ob ich hier richtig denke. Folgendes habe ich geprüft:


    1. Homebridge startet als root

    pi@raspberrypi:~ $ sudo systemctl status homebridge -l

    ...

    CGroup: /system.slice/homebridge.service

    ??1399 sudo -u root DEBUG=* /usr/local/bin/homebridge

    ??1406 homebridge


    Apr 09 19:06:17 raspberrypi homebridge[1397]: Starting homebridge

    Apr 09 19:06:17 raspberrypi sudo[1399]: root : TTY=unknown ; PWD=/root ; USE

    ...


    2. Bluetooth-Dienst läuft - oder nicht? Die roten Einträge sehen seltsam aus.

    pi@raspberrypi:~ $ bluetoothctl

    [NEW] Controller B8:27:EB:79:18:2B raspberrypi [default]

    [NEW] Device C4:7C:8D:6A:5D:93 Flower care

    [NEW] Device C4:7C:8D:6A:61:B8 Flower care


    pi@raspberrypi:~ $ service bluetooth status

    ? bluetooth.service - Bluetooth service

    Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)

    Active: active (running) since Tue 2019-04-09 18:55:01 CEST; 3h 8min ago

    Docs: man:bluetoothd(8)

    Main PID: 560 (bluetoothd)

    Status: "Running"

    CGroup: /system.slice/bluetooth.service

    ??560 /usr/lib/bluetooth/bluetoothd


    Apr 09 18:55:01 raspberrypi systemd[1]: Starting Bluetooth service...

    Apr 09 18:55:01 raspberrypi bluetoothd[560]: Bluetooth daemon 5.43

    Apr 09 18:55:01 raspberrypi systemd[1]: Started Bluetooth service.

    Apr 09 18:55:01 raspberrypi bluetoothd[560]: Starting SDP server

    Apr 09 18:55:01 raspberrypi bluetoothd[560]: Bluetooth management interface 1.14 initialized

    Apr 09 18:55:01 raspberrypi bluetoothd[560]: Failed to obtain handles for "Service Changed" characteri

    Apr 09 18:55:01 raspberrypi bluetoothd[560]: Sap driver initialization failed.

    Apr 09 18:55:01 raspberrypi bluetoothd[560]: sap-server: Operation not permitted (1)

    Apr 09 18:55:02 raspberrypi bluetoothd[560]: Endpoint registered: sender=:1.10 path=/A2DP/SBC/Source/1

    Apr 09 18:55:02 raspberrypi bluetoothd[560]: Endpoint registered: sender=:1.10 path=/A2DP/SBC/Sink/1



    3. Flower-Cares werden mittels lescan gefunden

    pi@raspberrypi:~ $ sudo hcitool lescan

    LE Scan ...

    C4:7C:8D:6A:61:B8 Flower care

    C4:7C:8D:6A:5D:93 Flower care


    4. die aktuelle Version des Plugins ist installiert

    pi@raspberrypi:~ $ sudo npm list -g --depth=0

    /usr/local/lib

    ??? [email protected]

    ??? [email protected]

    ??? [email protected]

    ??? [email protected]

    ??? [email protected]

    ??? [email protected]

    ??? [email protected]


    5. Plugin und Geräte werden bei Start sauber geladen

    [2019-4-9 19:06:20] Loaded plugin: homebridge-mi-flower-care

    [2019-4-9 19:06:21] Registering accessory 'homebridge-mi-flower-care.mi-flower-care'

    [2019-4-9 19:06:22] [Tomaten] Initializing mi-flower-care accessory...

    [2019-4-9 19:06:22] [Lavendel] Initializing mi-flower-care accessory...


    6. config.json ist korrekt eingerichtet

    pi@raspberrypi:~ $ sudo cat /root/.homebridge/config.json

    ...

    {

    "accessory" : "mi-flower-care",

    "name" : "Tomaten",

    "deviceID" : "C4:7C:8D:6A:5D:93",

    "interval" : 30

    },

    {

    "accessory" : "mi-flower-care",

    "name" : "Lavendel",

    "deviceID" : "C4:7C:8D:6A:61:B8",

    "interval" : 30

    }

    ...


    7. Pi und Flower Cares kommunizieren, aber: alle Daten werden ins Error-Log geschrieben ???

    ...

    Tue, 09 Apr 2019 19:52:54 GMT att c4:7c:8d:6a:61:b8: read: 0be7000003000000070000023c00fb349b

    Tue, 09 Apr 2019 19:52:54 GMT miflora data: <Buffer e7 00 00 03 00 00 00 07 00 00 02 3c 00 fb 34 9b>

    Tue, 09 Apr 2019 19:52:54 GMT miflora temperature: 23.1 °C

    Tue, 09 Apr 2019 19:52:54 GMT miflora Light: 3 lux

    Tue, 09 Apr 2019 19:52:54 GMT miflora moisture: 7 %

    Tue, 09 Apr 2019 19:52:54 GMT miflora fertility: 0 µS/cm

    Tue, 09 Apr 2019 19:52:54 GMT att c4:7c:8d:6a:61:b8: write: 0a3800

    ...

  • Keine Anmeldung in der MiHome App möglich. Mir schwant böses - auf der Verpackung steht weder was von Xiaomi noch von Mi. Wahrscheinlich habe ich irgendeine billige Kopie erwischt. Werde mal ein weiteres Gerät bestellen und dann noch mal probieren. =O

  • Besteht eigentlich auch die Möglichkeit, das man einen Alarm nicht nur für die Helligkeit, und Bodenfeuchte setzt, sondern das man auch wieder erinnert wird wenn gedüngt werden muss ?

  • So, Homebridge komplett nach Anleitung von sschuste aufgesetzt. Alle Plugins laufen, habe mich dann meinen Sorgenkinder zugewendet. Plugin kann ich installieren, es erscheint beim Starten aber folgende Fehlermeldung:


    Apr 17 19:01:32 raspberrypi homebridge[2819]: [4/17/2019, 7:01:32 PM] ====================

    Apr 17 19:01:32 raspberrypi homebridge[2819]: [4/17/2019, 7:01:32 PM] ERROR LOADING PLUGIN homebridge-mi-flower-care:

    Apr 17 19:01:32 raspberrypi homebridge[2819]: [4/17/2019, 7:01:32 PM] Error: Cannot find module 'bluetooth-hci-socket'

    Apr 17 19:01:32 raspberrypi homebridge[2819]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)

    Apr 17 19:01:32 raspberrypi homebridge[2819]: at Function.Module._load (internal/modules/cjs/loader.js:591:27)

    Apr 17 19:01:32 raspberrypi homebridge[2819]: at Module.require (internal/modules/cjs/loader.js:723:19)

    Apr 17 19:01:32 raspberrypi homebridge[2819]: at require (internal/modules/cjs/helpers.js:14:16)

    Apr 17 19:01:32 raspberrypi homebridge[2819]: at Object.<anonymous> (/usr/local/lib/node_modules/homebridge-mi-flower-care/node_modules/noble/lib/hci-socket/hci.js:6:26)

    Apr 17 19:01:32 raspberrypi homebridge[2819]: at Module._compile (internal/modules/cjs/loader.js:816:30)

    Apr 17 19:01:32 raspberrypi homebridge[2819]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)

    Apr 17 19:01:32 raspberrypi homebridge[2819]: at Module.load (internal/modules/cjs/loader.js:685:32)

    Apr 17 19:01:32 raspberrypi homebridge[2819]: at Function.Module._load (internal/modules/cjs/loader.js:620:12)

    Apr 17 19:01:32 raspberrypi homebridge[2819]: at Module.require (internal/modules/cjs/loader.js:723:19)

    Apr 17 19:01:32 raspberrypi homebridge[2819]: [4/17/2019, 7:01:32 PM] ====================



    Kann mir jemand sagen, wie ich das Modul "bluetooth-hci-socket" überprüfen oder installieren kann?

  • Versuch mal:


    Code
    sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev


    Falls noch nicht ausreichend:


    Code
    sudo npm install bluetooth-hci-socket
  • Habe ein Berechtigungsproblem mit root ?


    pi@raspberrypi:~ $ sudo npm install bluetooth-hci-socket


    > [email protected] install /home/pi/node_modules/usb

    > node-pre-gyp install --fallback-to-build


    node-pre-gyp WARN Using needle for node-pre-gyp https download

    node-pre-gyp WARN Tried to download(404): https://github.com/tessel/node…node-v67-linux-arm.tar.gz

    node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI, glibc) (falling back to source compile with node-gyp)

    gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/11.14.0"

    gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/node_modules/usb/.node-gyp"

    gyp WARN install got an error, rolling back install

    gyp WARN install got an error, rolling back install

    gyp ERR! configure error

    gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/pi/node_modules/usb/.node-gyp'

    gyp ERR! System Linux 4.14.98-v7+

    gyp ERR! command "/usr/local/bin/node" "/usr/local/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" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v67"

    gyp ERR! cwd /home/pi/node_modules/usb

    gyp ERR! node -v v11.14.0

    gyp ERR! node-gyp -v v3.8.0

    gyp ERR! not ok

    node-pre-gyp ERR! build error

  • Gleiches Bild als "Superuser":


    root@raspberrypi:/home/pi# npm install bluetooth-hci-socket


    > [email protected] install /home/pi/node_modules/usb

    > node-pre-gyp install --fallback-to-build


    node-pre-gyp WARN Using needle for node-pre-gyp https download

    node-pre-gyp WARN Tried to download(404): https://github.com/tessel/node…node-v67-linux-arm.tar.gz

    node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI, glibc) (falling back to source compile with node-gyp)

    gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/11.14.0"

  • hmmmm, das ist zumindest der offizielle Befehl von github. Andere Variante waere:


    Code
    sudo npm install -g --unsafe-perm bluetooth-hci-socket 
  • Hat leider auch nicht geklappt, Fehlermeldung ändert sich:


    binding.target.mk:99: recipe for target 'Release/obj.target/binding/src/BluetoothHciSocket.o' failed

    make: *** [Release/obj.target/binding/src/BluetoothHciSocket.o] Error 1

    make: Leaving directory '/usr/local/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 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)

    gyp ERR! stack at ChildProcess.emit (events.js:193:13)

    gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:255:12)

    gyp ERR! System Linux 4.14.98-v7+

    gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"

    gyp ERR! cwd /usr/local/lib/node_modules/bluetooth-hci-socket

    gyp ERR! node -v v11.14.0

    gyp ERR! node-gyp -v v3.8.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.

  • Ah warte... Ich glaube ich habs...


    Bei mir lief das Plugin und alles andere NIE unter der aktuellen Node Version, deshalb musst ich gezielt 8.15.1 laden/installieren. Auf github scheinen so einige issues offen zu sein, dass es unter den aktuellen Node Versionen nicht wirklich zu klappen scheint. :-/

  • Nastra  det  DJay Liebe Moderatoren, ich habe diesen Thread ganz schön zugemüllt. Wenn es für @vgnsxe in Ordnung wäre, würde ich vorschlagen, die Beiträge #157 bis #210 zu löschen. Ist viel Text, der wahrscheinlich keinem weiterhelfen wird.


    Sobald bei mir das Plugin sauber läuft, werde ich kurz hier meinen Lösungsweg posten.

  • Ich empfehle zur Verwaltung von node den Node-Manager n.


    Falls er noch nicht installiert ist, kann man das nachholen mit sudo npm install -g --unsafe-perm n.


    n --help hilft dann weiter. So installiert sudo n latest die neueste node-Version, sudo n lts installiert die letzte Long Time Support-Version und sudo n 8.15.1 würde Version 8.15.1 installieren.


    Stefan