Skip to content
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Logo
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. JavaScript
  5. gelöst: exec geht nicht?

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.1k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    1.8k

  • Neues Video "KI im Smart Home" - ioBroker plus n8n
    BluefoxB
    Bluefox
    15
    1
    2.1k

gelöst: exec geht nicht?

Scheduled Pinned Locked Moved JavaScript
6 Posts 3 Posters 171 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    derrapf
    wrote on last edited by derrapf
    #1

    Hallo alle
    Ich versuche meine WLAN Steckdose zu schalten wenn der Batterielevel unter oder über einen bestimmten Wert geht (wird vom fully kiosk Browser geliefert)
    Die Steckdose schalte ich mit einem Exec Befehl der auf der Commandline im Putty funktioniert (user root).
    Wenn ich das aber über das Script starte wird nicht geschaltet.

    on('fullybrowser.0.192_168_111_79.Info.batteryLevel'/*batteryLevel*/, function (obj){ 
        CheckBatteryLevel(); }
    );
    
    function CheckBatteryLevel() {
      var level = getState('fullybrowser.0.192_168_111_79.Info.batteryLevel'/*batteryLevel*/).val; 
      log ("akt. Batterielevel = "+level);
      if ( level < 30 ) { 
        exec("python /root/tplink-smartplug.py  -t 192.168.111.30 -c on", function(err, stdout, stderr) {});
        log("Level < 30, muss geladen werden: python /root/tplink-smartplug.py  -t 192.168.111.30 -c on");
      }  else if (level > 95) {
        exec("python /root/tplink-smartplug.py  -t 192.168.111.30 -c off", function(err, stdout, stderr) {});
        log("Level > 95, muss nicht mehr geladen werden: python /root/tplink-smartplug.py  -t 192.168.111.30 -c off");
      } else {
        log ("Level ok. Nichts zu tun");
      }
    } 
    
    

    Gruss Ralf

    BananaJoeB Thomas BraunT 2 Replies Last reply
    0
    • D derrapf

      Hallo alle
      Ich versuche meine WLAN Steckdose zu schalten wenn der Batterielevel unter oder über einen bestimmten Wert geht (wird vom fully kiosk Browser geliefert)
      Die Steckdose schalte ich mit einem Exec Befehl der auf der Commandline im Putty funktioniert (user root).
      Wenn ich das aber über das Script starte wird nicht geschaltet.

      on('fullybrowser.0.192_168_111_79.Info.batteryLevel'/*batteryLevel*/, function (obj){ 
          CheckBatteryLevel(); }
      );
      
      function CheckBatteryLevel() {
        var level = getState('fullybrowser.0.192_168_111_79.Info.batteryLevel'/*batteryLevel*/).val; 
        log ("akt. Batterielevel = "+level);
        if ( level < 30 ) { 
          exec("python /root/tplink-smartplug.py  -t 192.168.111.30 -c on", function(err, stdout, stderr) {});
          log("Level < 30, muss geladen werden: python /root/tplink-smartplug.py  -t 192.168.111.30 -c on");
        }  else if (level > 95) {
          exec("python /root/tplink-smartplug.py  -t 192.168.111.30 -c off", function(err, stdout, stderr) {});
          log("Level > 95, muss nicht mehr geladen werden: python /root/tplink-smartplug.py  -t 192.168.111.30 -c off");
        } else {
          log ("Level ok. Nichts zu tun");
        }
      } 
      
      

      Gruss Ralf

      BananaJoeB Offline
      BananaJoeB Offline
      BananaJoe
      Most Active
      wrote on last edited by
      #2

      @derrapf Versuch mal auch für python die vollen Pfade zu nehmen

      /usr/bin/python /root/tplink-smartplug.py  -t 192.168.111.30 -c off
      

      Und prüfe dabei auch ob es die gewünschte Python Version ist

      ABER!

      bei mir läuft ioBroker als Benutzer iobroker - ich bezweifle der das Zugriff auf /root/ hat

      ioBroker@Ubuntu 24.04 LTS (VMware) für: >260 Geräte, 5 Switche, 7 AP, 9 IP-Cam, 1 NAS 42TB, 1 ESXi 15TB, 4 Proxmox 1TB, 1 Hyper-V 44TB, 14 x Echo, 5x FireTV, 5 x Tablett/Handy VIS || >=157 Tasmota/Shelly || >=88 ZigBee || PV 8.1kW / Akku 14kWh || 2x USV 900/750W kaskadiert || Creality CR-10 SE 3D-Drucker

      1 Reply Last reply
      0
      • D derrapf

        Hallo alle
        Ich versuche meine WLAN Steckdose zu schalten wenn der Batterielevel unter oder über einen bestimmten Wert geht (wird vom fully kiosk Browser geliefert)
        Die Steckdose schalte ich mit einem Exec Befehl der auf der Commandline im Putty funktioniert (user root).
        Wenn ich das aber über das Script starte wird nicht geschaltet.

        on('fullybrowser.0.192_168_111_79.Info.batteryLevel'/*batteryLevel*/, function (obj){ 
            CheckBatteryLevel(); }
        );
        
        function CheckBatteryLevel() {
          var level = getState('fullybrowser.0.192_168_111_79.Info.batteryLevel'/*batteryLevel*/).val; 
          log ("akt. Batterielevel = "+level);
          if ( level < 30 ) { 
            exec("python /root/tplink-smartplug.py  -t 192.168.111.30 -c on", function(err, stdout, stderr) {});
            log("Level < 30, muss geladen werden: python /root/tplink-smartplug.py  -t 192.168.111.30 -c on");
          }  else if (level > 95) {
            exec("python /root/tplink-smartplug.py  -t 192.168.111.30 -c off", function(err, stdout, stderr) {});
            log("Level > 95, muss nicht mehr geladen werden: python /root/tplink-smartplug.py  -t 192.168.111.30 -c off");
          } else {
            log ("Level ok. Nichts zu tun");
          }
        } 
        
        

        Gruss Ralf

        Thomas BraunT Online
        Thomas BraunT Online
        Thomas Braun
        Most Active
        wrote on last edited by
        #3

        @derrapf

        In /root hat sowas ja auch nix zu suchen.

        Linux-Werkzeugkasten:
        https://forum.iobroker.net/topic/42952/der-kleine-iobroker-linux-werkzeugkasten
        NodeJS Fixer Skript:
        https://forum.iobroker.net/topic/68035/iob-node-fix-skript
        iob_diag: curl -sLf -o diag.sh https://iobroker.net/diag.sh && bash diag.sh

        D 1 Reply Last reply
        0
        • Thomas BraunT Thomas Braun

          @derrapf

          In /root hat sowas ja auch nix zu suchen.

          D Offline
          D Offline
          derrapf
          wrote on last edited by derrapf
          #4

          @thomas-braun Ich kann das Script gerne woanders hin tun. Wo muss es denn hin? Nach /home/iobroker ?
          Python ist übrigens 2.7.13

          D 1 Reply Last reply
          0
          • D derrapf

            @thomas-braun Ich kann das Script gerne woanders hin tun. Wo muss es denn hin? Nach /home/iobroker ?
            Python ist übrigens 2.7.13

            D Offline
            D Offline
            derrapf
            wrote on last edited by
            #5

            @derrapf Nachtrag
            Unter /home/iobroker funktioniert das Script! Danke an Euch.

            Gruss Ralf

            Thomas BraunT 1 Reply Last reply
            0
            • D derrapf

              @derrapf Nachtrag
              Unter /home/iobroker funktioniert das Script! Danke an Euch.

              Gruss Ralf

              Thomas BraunT Online
              Thomas BraunT Online
              Thomas Braun
              Most Active
              wrote on last edited by
              #6

              @derrapf Klar, da hat der User ja auch die Rechte.

              Linux-Werkzeugkasten:
              https://forum.iobroker.net/topic/42952/der-kleine-iobroker-linux-werkzeugkasten
              NodeJS Fixer Skript:
              https://forum.iobroker.net/topic/68035/iob-node-fix-skript
              iob_diag: curl -sLf -o diag.sh https://iobroker.net/diag.sh && bash diag.sh

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              Support us

              ioBroker
              Community Adapters
              Donate

              279

              Online

              32.4k

              Users

              81.4k

              Topics

              1.3m

              Posts
              Community
              Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
              ioBroker Community 2014-2025
              logo
              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Recent
              • Tags
              • Unread 0
              • Categories
              • Unreplied
              • Popular
              • GitHub
              • Docu
              • Hilfe