Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. Anderen Raspberry herunterfahren

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Anderen Raspberry herunterfahren

    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      saeft_2003 Most Active last edited by saeft_2003

      Hallo @Asgothian

      ich versuche das ganze auch gerade zum laufen zu bringen, aber sobald ich das skript trigger kommen folgende Fehler im log. node-ssh wurde in js instanz eingetragen.

      javascript.0	2020-03-31 20:48:13.943	error	(9562) at processImmediate (timers.js:658:5)
      javascript.0	2020-03-31 20:48:13.942	error	(9562) at tryOnImmediate (timers.js:676:5)
      javascript.0	2020-03-31 20:48:13.942	error	(9562) at runCallback (timers.js:705:18)
      javascript.0	2020-03-31 20:48:13.942	error	(9562) at Immediate.setImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:4848:37)
      javascript.0	2020-03-31 20:48:13.942	error	(9562) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:439:25)
      javascript.0	2020-03-31 20:48:13.941	error	(9562) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1101:38)
      javascript.0	2020-03-31 20:48:13.941	error	(9562) at Object.<anonymous> (script.js.funktioniert.volumio_shutdown:2:11)
      javascript.0	2020-03-31 20:48:13.940	error	(9562) Error in callback: ReferenceError: node_ssh is not defined
      
      on({id:'meine-datenpunkte.0.volumio.shutdown', change: 'any'}, function() {
      let ssh = new node_ssh();
      ssh.connect({ host: '192.168.178.59',
                             username: 'volumio',
                             password: 'xxxxxxxx'}).then(()=> {
                   ssh.execCommand("nohup shutdown -h 1");
      })
      }); 
      
      

      Wenn ich mich über putty als nicht root anmelde dann kann ich mit shutdown -h1 den raspi ausschalten. Könnt ihr mir weiter helfen?

      1 Reply Last reply Reply Quote 0
      • S
        saeft_2003 Most Active last edited by

        Mit diesem skript hab ich es hinbekommen:

        on({id:'meine-datenpunkte.0.volumio.shutdown', change: 'any'}, function() {
        
            node_ssh = require('node-ssh');
        
            ssh = new node_ssh();
        
            ssh.connect({
        
            host: '192.168.178.59',
        
            username: 'volumio',
        
            password: 'xxxxxxx'
        
            }).then(() => {
        
            ssh.execCommand("sudo shutdown");
        
        })
        
        });
        
        opossum 1 Reply Last reply Reply Quote 1
        • opossum
          opossum @saeft_2003 last edited by

          Hallo,

          ich habe mir dieses Thema durchgelesen, hatte aber immer wieder Errors im Log. Habe nun das Script ein wenig angepasst. Bei mir wird beim Einschalten des TV ein Raspberry Pi gestartet, der an einer schaltbaren HomativIP-Steckdose hängt. Der PI fährt dann hoch und startet Hyperion zum Steuern des LED-Stripes als Ambilight. Funktioniert. Beim Ausschalten des TV wollte ich dem Raspberry nicht hart die Spannung wegschalten. Daher fahre ich ihn mit dem Script herunter und schalte dann nach 30 Sekunden auch die Steckdose wieder aus. Anbei mein Script:

          on({id: 'harmony.0.Harmony_Hub.activities.currentStatus', change: "any"}, function (obj) {
           var value = obj.state.val;
           var oldValue = obj.oldState.val;
           if (getState("harmony.0.Harmony_Hub.activities.currentStatus").val == 1) {
             setState("hm-rpc.2.00021BE9959B0E.3.STATE"/*HMIP-PS 00021BE9959B0E:3 Weihnachtsbaum WoZi.STATE*/, true);
           console.log('Hyperion wird gestartet');
           } 
           else if (getState("harmony.0.Harmony_Hub.activities.currentStatus").val == 0) {
           // SSH fährt Raspberry PI herunter
             console.log('Hyperion wird heruntergefahren');
             const node_ssh = require('node-ssh').NodeSSH;
             const ssh = new node_ssh();
             ssh.connect({
             host: '192.168.1.85',
             username: 'xxxx',
             password: 'xxxxx'
             }).then(() => {
             ssh.execCommand("sudo shutdown -h now");
             wait(30000);
             setState("hm-rpc.2.00021BE9959B0E.3.STATE"/*HMIP-PS 00021BE9959B0E:3 Weihnachtsbaum WoZi.STATE*/, false);
          });
          };
          });
          

          Nicht wundern, die Steckdose war ursprünglich für das Zu- und Abschalten der Weihnachtsbaumbeleuchtung in Verwendung.

          S 1 Reply Last reply Reply Quote 0
          • S
            saeft_2003 Most Active @opossum last edited by

            @opossum

            Nutzt du schon admin 5 und die neuste js version? Weil seitdem ich umgestellt habe, kann ich das Zusatzmodul node-ssh nicht mehr installieren es geht nur simple-ssh.

            opossum 1 Reply Last reply Reply Quote 0
            • opossum
              opossum @saeft_2003 last edited by opossum

              Hallo, @saeft_2003,

              ja, habe eine komplette Neuinstallation gemacht. Hatte immer gyp-Warnungen im Log. Nach dem ich das Script umgestellt habe, läuft es und ich habe auch keine Fehler mehr. Hatte auch simple-ssh. Das hat bei mir Fehler gebracht.

              Hier meine Einstellungen zum js-Adapter:

              16100805-d9eb-4e65-8aa1-3df6dc3e868e-image.png

              1 Reply Last reply Reply Quote 0
              • Basti97
                Basti97 Most Active last edited by

                Ich suche auch ein Script in dem ich mein Rpi herunterfahren kann. Seit den letzten JS Update funktoniert es nicht mehr. So sieht das aus.

                //Media 03 Ein/ Aus ist kleiner als letztes 
                on({id:'0_userdata.0.virtuelle_Datenpunkte.HIFI_Wohnzimmer.Raspberry_Media03_Ein/_Aus'/*Raspberry Media03 Ein/ Aus*/ , change: "lt"}, function (obj) {
                  var value = obj.state.val;
                  var oldValue = obj.oldState.val;
                 
                
                    node_ssh = require('node-ssh');
                
                 
                
                    ssh = new node_ssh();
                
                 
                
                    ssh.connect({
                
                 
                
                    host: '192.168.1.33',
                
                 
                
                    username: 'volumio',
                
                 
                
                    password: 'volumio'
                
                 
                
                    }).then(() => {
                
                 
                
                    ssh.execCommand("sudo shutdown -h 0");
                
                 
                
                })
                
                 
                
                });
                
                falke69 1 Reply Last reply Reply Quote 0
                • falke69
                  falke69 @Basti97 last edited by

                  @basti97

                  bei mir läuft dieses Script

                  on({id: '0_userdata.0.CCU.Reboot', change: "any"}, function (obj) {
                  
                     const node_ssh = require('node-ssh').NodeSSH;
                     const ssh = new node_ssh();
                  
                     ssh.connect({
                  
                     host: '192.168.178.xxx',
                     username: 'blub',
                     password: 'blub'
                  
                     }).then(() => {
                  
                     ssh.execCommand("reboot");
                  
                  });
                  
                  });
                  
                  
                  Basti97 1 Reply Last reply Reply Quote 0
                  • Basti97
                    Basti97 Most Active @falke69 last edited by

                    @falke69 Danke ich teste mal dein Script aus 🙂

                    1 Reply Last reply Reply Quote 0
                    • P
                      padi0-000 last edited by

                      Hallo zusammen,

                      kann mir jemand Helfen ? Ich habe nun schon 2 Tage damit verbracht das Script zum laufen zu bringen.
                      Wenn ich das Script in Java einfüge ist mir aufgefallen, dass gesagt wird :node-ssh ist nicht zu finden.

                      Habe es im den Einstelllungen aber eingetragen.
                      Node SSh.PNG

                      habe alles versucht shutdown und zum test auch mal reeboot usw.

                      Java.PNG

                      Möchte meinen Raspberry im Wohnzimmer runterfahren.
                      Iobroker läuft auf einem anderm Raspberry

                      falke69 1 Reply Last reply Reply Quote 0
                      • falke69
                        falke69 @padi0-000 last edited by

                        @padi0-000

                        Das einzigste, was mir in den Sinn kommt, wäre mal die javascript Instanz neu zu starten, falls Du das noch nicht getan hast.

                        Ich habe aktuell die v6.0.0 und das Script läuft wie am ersten Tag.

                        P 1 Reply Last reply Reply Quote 0
                        • P
                          padi0-000 @falke69 last edited by

                          @falke69
                          mit dem update und neustart auf v6.0.0 läuft alles.

                          Danke

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          Support us

                          ioBroker
                          Community Adapters
                          Donate
                          FAQ Cloud / IOT
                          HowTo: Node.js-Update
                          HowTo: Backup/Restore
                          Downloads
                          BLOG

                          442
                          Online

                          31.6k
                          Users

                          79.6k
                          Topics

                          1.3m
                          Posts

                          netzwerk reboot remote shutdown
                          7
                          46
                          4095
                          Loading More Posts
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes
                          Reply
                          • Reply as topic
                          Log in to reply
                          Community
                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                          The ioBroker Community 2014-2023
                          logo