Node.js server to link Miniserver to Google Home/Assistant

Einklappen
X
 
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge
  • Tico
    Lox Guru
    • 31.08.2016
    • 1035

    Node.js server to link Miniserver to Google Home/Assistant

    I have installed a project called Google Assistant Relay. It provides a facility to send text from the Miniserver and broadcasts the content to Google Home/Mini's throughout the house.

    It's working well when I manually start it from the terminal. I can send POST commands from Loxone config and the text is broadcast across the home devices.

    I'm having trouble trying to make it auto-start after a Loxberry reboot. I should also add I'm a complete Linux newbie and just learning the basics. Please be gentle...

    I have created startup.sh in the directory /opt/loxberry/. The contents are -

    Code:
    #!/bin/sh
    sleep 30
    cd ~/webfrontend/legacy/gar/assistant-relay-2.1.1/
    npm run start

    I can start the Google Assistant Relay manually if I run -

    Code:
    bash ~/startup.sh

    Klicke auf die Grafik für eine vergrößerte Ansicht  Name: assistant relay working.png Ansichten: 1 Größe: 38,1 KB ID: 172713



    I've edited rc.local and added the following -



    Klicke auf die Grafik für eine vergrößerte Ansicht  Name: rc.local editing.png Ansichten: 1 Größe: 27,3 KB ID: 172714

    It stills refuses to start automatically on Loxberry reboot.

    Any suggestions?
    Zuletzt geändert von Tico; 21.10.2018, 04:12.
    Ich spreche kein Deutsch. Gib Google Translate die Schuld, wenn ich unverständlich bin.
  • svethi
    Lebende Foren Legende
    • 25.08.2015
    • 6292

    #2
    Morning Tico,

    after starting up manually you are getting back the command line? It looks like you don’t. If you don’t get back the command line, you have to add a blank and a & at the end. So it tells the shell to run the command in background. Your script is runnable itself, so you don’t need to add the sh before.
    Try it with ‘/opt/loxberry/starup.sh &’ in the rc.local. But remember, it is possible that your script will be deleted in /opt/loxberry during a loxberry update. Move it to your legacy dir and the run it from this dir.

    greetings
    Miniserver; KNX; Vitogate; EnOcean (EnOceanPi); Loxone Air; Caldav-Kalenderanbindung; RaspberryPi und für keine Frickellösung zu schade :-)

    Kommentar

    • Tico
      Lox Guru
      • 31.08.2016
      • 1035

      #3
      Hi svethi,

      Yes, that's correct. I don't get back the command line after starting the service manually. I've since been recommended an alternative option that works, a file called relay.service.

      Code:
      [Service]
      WorkingDirectory=/opt/loxberry/webfrontend/legacy/gar/assistant-relay-2.1.1/
      ExecStart=/usr/bin/npm start
      Restart=always
      StandardOutput=syslog
      StandardError=syslog
      SyslogIdentifier=notell
      User=root
      Group=root
      Environment=NODE_ENV=production
      
      [Install]
      WantedBy=multi-user.target
      relay.service is then copied to /etc/systemd/system/ and enabled by "systemctl enable relay.service".

      Out of the two options -

      1. rc.local with startup.sh in legacy directory
      or
      2. relay.service in etc/systemd/system

      is one better suited to not being overwritten by Loxberry update? I also tried Cron without success.
      Zuletzt geändert von Tico; 22.10.2018, 03:49.
      Ich spreche kein Deutsch. Gib Google Translate die Schuld, wenn ich unverständlich bin.

      Kommentar

      • svethi
        Lebende Foren Legende
        • 25.08.2015
        • 6292

        #4
        relay.service is much better. It looks like professional :-)
        /etc/systemd will not be overwritten.

        Greetings Sven
        Miniserver; KNX; Vitogate; EnOcean (EnOceanPi); Loxone Air; Caldav-Kalenderanbindung; RaspberryPi und für keine Frickellösung zu schade :-)

        Kommentar


        • Tico
          Tico kommentierte
          Kommentar bearbeiten
          Thank-you.
      Lädt...