Homebridge Autostart funktioniert nicht

  • Guten Abend :)

    Hab nun endlich meine Homebridge mit einem GPIO-Plugin zum Laufen gebracht.

    Mit dieser Anleitung https://smartapfel.de/anleitun…-raspberry-pi-einrichten/ wollte ich auch den Autostart einstellen...denkste. Nach reboot passiert ungefähr gar nix :(

    Wenn ich das Terminal öffne und "homebridge" eingebe, wird erst gemault dass der GPIO nicht exportiert wurde (gpio export PIN). Nachdem ich dies gemacht habe kann ich homebridge starten und es funktioniert direkt.

    ABER. Sobald ich das Terminal schließe funktioniert homebridge nicht mehr. Ist das normal oder gibt es da einen Weg dass homebridge trotzdem im Hintergrund mitläuft? Und wie veranker ich den GPIO export ebenfalls im Autostart (BEVOR versucht wird homebridge zu starten)?

    Vielen Dank :)

    Gruß Mando

  • Hallo Mando,

    Der Autostart funktioniert bei mir.

    Unter Unix ist es üblich, dass sich Prozesse, die in einem Terminalfenster gestartet wurden, beendet werden wenn das Terminal geschlossen wird. Du kannst die aber helfen indem du homebridge folgendermaßen startest:

    Code
    nohup homebridge &

    Der Prozess wird dann im Hintergrund gestartet und läuft weiter auch wenn Du dein Fenster zu machst.

  • Ich habe auch das Problem. Wenn ich nohup im Terminal eingebe bekomme ich folgende Meldung:


    nohup: failed to open 'nohup.out': Permission denied

    nohup: failed to open '/home/pi/nohup.out': Permission denied

  • Ich habe auch das Problem. Wenn ich nohup im Terminal eingebe bekomme ich folgende Meldung:


    nohup: failed to open 'nohup.out': Permission denied

    nohup: failed to open '/home/pi/nohup.out': Permission denied


    Das könnte daran liegen, das es bereits eine /home/pi/nohup.out gibt, die nicht dem User pi gehört. Einfach checken mit

    Bash
    ls -l  /home/pi/nohup.out

    Und falls schon da eine ist, die root gehört, kannst du als User pi die halt nicht überschreiben. Wegmachen mit

    Bash
    sudo rm /home/pi/nohup.out

    und noch mal versuchen.


    Stefan

  • #!/bin/sh

    ### BEGIN INIT INFO

    # Provides: homebridge

    # Required-Start: $network $remote_fs $syslog

    # Required-Stop: $remote_fs $syslog

    # Default-Start: 2 3 4 5

    # Default-Stop: 0 1 6

    # Short-Description: Start daemon at boot time for homebridge

    # Description: Enable service provided by daemon.

    ### END INIT INFO

    export PATH=$PATH:/usr/local/bin

    export NODE_PATH=$NODE_PATH:/usr/local/lib/node_modules

    PID=`pidof homebridge`

    case "$1" in

    start)

    if ps -p $PID > /dev/null 2>&1; then

    echo "Homebridge is already running"

    else

    su - pi -c "homebridge > /dev/null 2>&1 &"

    echo "Homebridge starting"

    $0 status

    fi

    ;;

    stop)

    if ! ps -p $PID > /dev/null 2>&1; then

    echo "Homebridge is not running"

    else

    kill $PID

    echo "Homebridge closed"

    fi

    ;;

    restart)

    if ! ps -p $PID > /dev/null 2>&1; then

    $0 start

    else

    $0 stop

    $0 start

    fi

    ;;

    status)

    if ps -p $PID > /dev/null 2>&1; then

    echo "Homebridge is running PID $PID"

    else

    echo "Homebridge is not running"

    fi

    ;;

    *)

    echo "Usage: $0 {start|stop|status|restart}"

    exit 1

    ;;

    esac

    exit 0

    Einmal editiert, zuletzt von Decoderm ()

  • Ich vermute mal

    Code
    /etc/init.d/homebridge start

    startet dei homebridge nicht.

    startet die homebridge so:

    Code
    nohup homebridge &

    welche plugin genau hast du installiert?

    (mach mal einen Link hier)


    ändere mal in der Datei /etc/init.d/homebridge

    im Abschnitt start:

    Code
    su - pi -c "homebridge > /dev/null 2>&1 &"
    in
    su - pi -c "homebridge >> /var/log/homebridge.log 2>> /var/log/homebridge.err &"

    nun hast Du in /var/ 2 Dateien homebridge.log und homebridge.err

    kommt da im log eine Fehlermeldung?

    :)

  • ich habe folgende Plugins installiert:


    [email protected]

    https://www.npmjs.com/package/homebridge-fritzbox

    https://www.npmjs.com/package/http-switch (werde ich wieder runter schmeißen)


    habe die Zeile abgeändert.


    kann die Homebridge jetzt mit

    Code
    sudo /etc/init.d/homebridge start

    nicht mehr starten.


    kommt folgende Meldung:


    -su: /var/log/homebridge.log: Permission denied


    mit nohup homebridge &

    kommt jetzt


    nohup: ignoring input and appending output to 'nohup.out'

    2 Mal editiert, zuletzt von Decoderm ()

  • kommt folgende Meldung:


    -su: /var/log/homebridge.log: Permission denied


    Hatten wir oben schon: permission denied = falsche Rechte. Der User pi möchte auf die Datei /var/log/homebridge.log schreiben, was er nicht darf, weil sie ihm nicht gehört.


    Mach mal sudo chown pi:pi /var/log/homebridge.log und danach sudo /etc/init.d/homebridge start


    Stefan

  • Sorry bin ganz neu in der Materie.:rolleyes:

    Anscheinend ist die Datei nicht vorhanden


    chown: cannot access '/var/log/homebridge.log': No such file or directory


    habe den raspberry pi komplett neu gestartet, jetzt kann die homebridge mit sudo /etc/init.d/homebridge start gestartet werden.

    2 Mal editiert, zuletzt von Decoderm ()

  • Das sind keine ERRORS, sondern nur WARNINGS, und sie können ignoriert werden, wie die Dokumentation auf https://www.npmjs.com/package/homebridge ganz unten erwähnt. Wir alle leben damit :)


    Stefan

  • Das was uns interesiert steht in /var/homebridge.log !!

    existiert diese jetzt?

    wenn nicht, eingeben:


    Code
    sudo chmod 777 /var/
    sudo /etc/init.d homebridge restart
    tail -f /var/homebridge.log

    und sehen was da steht.


    wenn homebridgr mit sudo /etc/init.d/homebridge start

    läuft, sollte sie auch nach dem neustart des RasPi starten.

    sonst noch mal

    Code
    sudo chmod 755 /etc/init.d/homebridge
    sudo update-rc.d homebridge defaults

    und immer ins LOG sehen was da kommt.

    :)

  • [2018-2-20 06:14:09] Loaded plugin: homebridge-fritz

    [2018-2-20 06:14:09] Registering platform 'homebridge-fritz.Fritz!Box'

    [2018-2-20 06:14:09] ---

    [2018-2-20 06:14:09] Loaded plugin: homebridge-harmonyhub

    [2018-2-20 06:14:09] Registering platform 'homebridge-harmonyhub.HarmonyHub'

    [2018-2-20 06:14:09] ---

    [2018-2-20 06:14:10] Loaded plugin: homebridge-http-switch

    [2018-2-20 06:14:10] Registering accessory 'homebridge-http-switch.HTTP-SWITCH'

    [2018-2-20 06:14:10] ---

    [2018-2-20 06:14:10] Loaded config.json with 1 accessories and 2 platforms.

    [2018-2-20 06:14:10] ---

    [2018-2-20 06:14:10] Loading 2 platforms...

    [2018-2-20 06:14:10] [HarmonyHub] Initializing HarmonyHub platform...

    [2018-2-20 06:14:10] [HarmonyHub] Searching for Logitech Harmony remote hubs...

    [2018-2-20 06:14:10] [FRITZ!Box] Initializing Fritz!Box platform...

    [2018-2-20 06:14:10] Loading 1 accessories...

    [2018-2-20 06:14:10] [Dreambox] Initializing HTTP-SWITCH accessory...

    Failed to find plugin to handle accessory Harmony

    [2018-2-20 06:14:11] [FRITZ!Box] Fritz!Box platform login successful

    [2018-2-20 06:14:11] [FRITZ!Box] Discovering accessories

    [2018-2-20 06:14:11] [FRITZ!Box] Outlets found: 087610083856

    [2018-2-20 06:14:11] [HarmonyHub] Found Logitech Harmony remote hub: 192.168.1.180

    [2018-2-20 06:14:11] [HarmonyHub] Connecting to Logitech Harmony remote hub...

    [2018-2-20 06:14:12] [FRITZ!Box] Thermostats found: none

    [2018-2-20 06:14:12] [FRITZ!Box] Sensors found: none

    [2018-2-20 06:14:12] [FRITZ!Box] Initializing platform accessory 'FRITZ!DECT 200 #3'...

    [2018-2-20 06:14:12] [HarmonyHub] Connected to Logitech Harmony remote hub

    [2018-2-20 06:14:12] [HarmonyHub] Fetching Logitech Harmony devices and activites...

    [2018-2-20 06:14:12] [HarmonyHub] Fetching Logitech Harmony activities...

    [2018-2-20 06:14:13] [HarmonyHub] Found activities:

    Kartina

    PowerOff

    Musik hören

    Apple - TV

    Fernsehen

    [2018-2-20 06:14:13] [HarmonyHub] Initializing platform accessory 'Apple - TV'...

    [2018-2-20 06:14:13] [HarmonyHub] Initializing platform accessory 'Fernsehen'...

    [2018-2-20 06:14:13] [HarmonyHub] Initializing platform accessory 'Kartina'...

    [2018-2-20 06:14:13] [HarmonyHub] Initializing platform accessory 'Musik hören'...

  • hier fehlt der Rest, wo mann sieht ob es startet.!


    hier muss was in der config stehen:

    Code
    [2018-2-20 06:14:10] [Dreambox] Initializing HTTP-SWITCH accessory...
    
    Failed to find plugin to handle accessory Harmony

    wo kein Plugin dazu installiert ist.

    :)

  • Das ist von heute. Da sieht man das es gestern um 20:47 lief. Um 06:05 habe ich es von Hand gestartet.


    [2018-2-20 20:47:14] Homebridge is running on port 51826.

    [2018-2-21 06:05:21] Loaded plugin: homebridge-fritz

    [2018-2-21 06:05:21] Registering platform 'homebridge-fritz.Fritz!Box'

    [2018-2-21 06:05:21] ---

    [2018-2-21 06:05:22] Loaded plugin: homebridge-harmonyhub

    [2018-2-21 06:05:22] Registering platform 'homebridge-harmonyhub.HarmonyHub'

    [2018-2-21 06:05:22] ---

    [2018-2-21 06:05:22] Loaded plugin: homebridge-http-switch

    [2018-2-21 06:05:22] Registering accessory 'homebridge-http-switch.HTTP-SWITCH'

    [2018-2-21 06:05:22] ---

    [2018-2-21 06:05:22] Loaded config.json with 0 accessories and 2 platforms.

    [2018-2-21 06:05:22] ---

    [2018-2-21 06:05:22] Loading 2 platforms...

    [2018-2-21 06:05:22] [HarmonyHub] Initializing HarmonyHub platform...

    [2018-2-21 06:05:22] [HarmonyHub] Searching for Logitech Harmony remote hubs...

    [2018-2-21 06:05:22] [FRITZ!Box] Initializing Fritz!Box platform...

    [2018-2-21 06:05:22] Loading 0 accessories...

    Failed to find plugin to handle accessory Harmony

    [2018-2-21 06:05:23] [FRITZ!Box] Fritz!Box platform login successful

    [2018-2-21 06:05:23] [FRITZ!Box] Discovering accessories

    [2018-2-21 06:05:23] [FRITZ!Box] Outlets found: 087610083856

    [2018-2-21 06:05:24] [HarmonyHub] Found Logitech Harmony remote hub: 192.168.1.180

    [2018-2-21 06:05:24] [HarmonyHub] Connecting to Logitech Harmony remote hub...

    [2018-2-21 06:05:24] [FRITZ!Box] Thermostats found: none

    [2018-2-21 06:05:24] [FRITZ!Box] Sensors found: none

    [2018-2-21 06:05:24] [FRITZ!Box] Initializing platform accessory 'FRITZ!DECT 200 #3'...

    [2018-2-21 06:05:24] [HarmonyHub] Connected to Logitech Harmony remote hub

    [2018-2-21 06:05:24] [HarmonyHub] Fetching Logitech Harmony devices and activites...

    [2018-2-21 06:05:24] [HarmonyHub] Fetching Logitech Harmony activities...

    [2018-2-21 06:05:25] [HarmonyHub] Found activities:

    Kartina

    PowerOff

    Musik hören

    Apple - TV

    Fernsehen

    [2018-2-21 06:05:25] [HarmonyHub] Initializing platform accessory 'Apple - TV'...

    [2018-2-21 06:05:25] [HarmonyHub] Initializing platform accessory 'Fernsehen'...

    [2018-2-21 06:05:25] [HarmonyHub] Initializing platform accessory 'Kartina'...

    [2018-2-21 06:05:25] [HarmonyHub] Initializing platform accessory 'Musik hören'...

    Setup Payload:

    X-HM://0023ISYWYG9D2

    Scan this code with your HomeKit app on your iOS device to pair with Homebridge:


    [2018-2-21 06:05:25] Homebridge is running on port 51826.

    [2018-2-21 06:05:33] [FRITZ!Box] Getting outlet 087610083856 state

    [2018-2-21 06:05:33] [FRITZ!Box] Getting outlet 087610083856 temperature

    [2018-2-21 06:06:23] [FRITZ!Box] Updating outlet 087610083856

    [2018-2-21 06:06:23] [FRITZ!Box] Getting outlet 087610083856 state

    [2018-2-21 06:06:23] [FRITZ!Box] Getting outlet 087610083856 power usage

    [2018-2-21 06:06:23] [FRITZ!Box] Getting outlet 087610083856 in use

    [2018-2-21 06:06:23] [FRITZ!Box] Getting outlet 087610083856 energy consumption

    [2018-2-21 06:06:23] [FRITZ!Box] Getting outlet 087610083856 temperature

    [2018-2-21 06:07:24] [FRITZ!Box] Updating outlet 087610083856