Skip to content
  • Home
  • 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
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. JavaScript
  5. Output in verschiedene Datenpunkte

NEWS

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    17
    1
    4.0k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.2k

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    25
    1
    2.5k

Output in verschiedene Datenpunkte

Scheduled Pinned Locked Moved JavaScript
6 Posts 2 Posters 403 Views 1 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.
  • JB1985J Offline
    JB1985J Offline
    JB1985
    wrote on last edited by
    #1

    Hallo zusammen,

    ich habe ein Python Script, welches ich per exec aufrufe. Allerdings möchte ich gerne das der Outpunkt nicht in einem Datenpunkt gespeichert wird, sondern in verschiedene.

    Output vom Script:

    2904.02
    93%
    -2123.66
    
    

    Jetzt möchte ich gerne das 2904.02 in Datenpunkt1, 93% in Datenpunkt2 und -2123.66 in Datenpunkt3 gespeichert wird.

    Der Output ist variabel.

    Bisher mache ich das so, allerdings wird es alles in einem Datenpunkt gespeichert:

    exec('/home/pi/scripts/pla.py', function (error, stdout, stderr) { setState('Datenpunkte.0.PV-Anlage.DATENPUNKT',stdout); }); 
    
    

    Jemand eine Idee wie man das umsetzt?

    paul53P 1 Reply Last reply
    0
    • JB1985J JB1985

      Hallo zusammen,

      ich habe ein Python Script, welches ich per exec aufrufe. Allerdings möchte ich gerne das der Outpunkt nicht in einem Datenpunkt gespeichert wird, sondern in verschiedene.

      Output vom Script:

      2904.02
      93%
      -2123.66
      
      

      Jetzt möchte ich gerne das 2904.02 in Datenpunkt1, 93% in Datenpunkt2 und -2123.66 in Datenpunkt3 gespeichert wird.

      Der Output ist variabel.

      Bisher mache ich das so, allerdings wird es alles in einem Datenpunkt gespeichert:

      exec('/home/pi/scripts/pla.py', function (error, stdout, stderr) { setState('Datenpunkte.0.PV-Anlage.DATENPUNKT',stdout); }); 
      
      

      Jemand eine Idee wie man das umsetzt?

      paul53P Offline
      paul53P Offline
      paul53
      wrote on last edited by
      #2

      @JB1985 sagte:

      wird es alles in einem Datenpunkt gespeichert:

      Wenn Zeilenschaltungen zwischen den einzelnen Werten sind:

      exec('/home/pi/scripts/pla.py', function (error, stdout, stderr) {
         let arr = stdout.split('\n');
         setState('Datenpunkte.0.PV-Anlage.DP1', arr[0], true); 
         setState('Datenpunkte.0.PV-Anlage.DP2', arr[1], true); 
         setState('Datenpunkte.0.PV-Anlage.DP3', arr[2], true); 
      }); 
      

      Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
      Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

      1 Reply Last reply
      0
      • JB1985J Offline
        JB1985J Offline
        JB1985
        wrote on last edited by
        #3

        @paul53 sagte in Output in verschiedene Datenpunkte:

                                                                                                                                    exec('/home/pi/scripts/pla.py', function (error, stdout, stderr) {                                                                                                                                                                               let arr = stdout.split('\n');                                                                                                                                                                               setState('Datenpunkte.0.PV-Anlage.DP1', arr[0], true);                                                                                                                                                                                setState('Datenpunkte.0.PV-Anlage.DP2', arr[1], true);                                                                                                                                                                                setState('Datenpunkte.0.PV-Anlage.DP3', arr[2], true);                                                                                                                                                                             }); 
        

        Hallo @paul53

        Danke für deine Hilfe.

        Ich erhalte folgende Fehlermeldung:

        13:34:09.175	error	javascript.0 (9529) script.js.PV_Anlage.Skript_1: TypeError: Cannot read property 'split' of undefined
        13:34:09.176	error	javascript.0 (9529) at script.js.PV_Anlage.Skript_1:3:21
        
        paul53P 1 Reply Last reply
        0
        • JB1985J JB1985

          @paul53 sagte in Output in verschiedene Datenpunkte:

                                                                                                                                      exec('/home/pi/scripts/pla.py', function (error, stdout, stderr) {                                                                                                                                                                               let arr = stdout.split('\n');                                                                                                                                                                               setState('Datenpunkte.0.PV-Anlage.DP1', arr[0], true);                                                                                                                                                                                setState('Datenpunkte.0.PV-Anlage.DP2', arr[1], true);                                                                                                                                                                                setState('Datenpunkte.0.PV-Anlage.DP3', arr[2], true);                                                                                                                                                                             }); 
          

          Hallo @paul53

          Danke für deine Hilfe.

          Ich erhalte folgende Fehlermeldung:

          13:34:09.175	error	javascript.0 (9529) script.js.PV_Anlage.Skript_1: TypeError: Cannot read property 'split' of undefined
          13:34:09.176	error	javascript.0 (9529) at script.js.PV_Anlage.Skript_1:3:21
          
          paul53P Offline
          paul53P Offline
          paul53
          wrote on last edited by
          #4

          @JB1985 sagte:

          Cannot read property 'split' of undefined

          Dann hat stdout keinen Inhalt. Vielleicht mit Check von error abfangen.

          exec('/home/pi/scripts/pla.py', function (error, stdout, stderr) {
             if(error) log('Fehler Python: ' + stderr, 'warn');
             else if(stdout) {
                let arr = stdout.split('\n');
                setState('Datenpunkte.0.PV-Anlage.DP1', arr[0], true); 
                setState('Datenpunkte.0.PV-Anlage.DP2', arr[1], true); 
                setState('Datenpunkte.0.PV-Anlage.DP3', arr[2], true);
             }
          }); 
          

          Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
          Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

          1 Reply Last reply
          1
          • JB1985J Offline
            JB1985J Offline
            JB1985
            wrote on last edited by
            #5

            Hey! Danke, es funktioniert jetzt.

            Weißt du zufällig noch wie ich diese WARN Meldung aus dem Log bekomme?

            javascript.0	2020-06-19 13:43:53.349	warn	(9529) at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
            javascript.0	2020-06-19 13:43:53.349	warn	(9529) at maybeClose (internal/child_process.js:1021:16)
            javascript.0	2020-06-19 13:43:53.349	warn	(9529) at ChildProcess.emit (events.js:315:20)
            javascript.0	2020-06-19 13:43:53.349	warn	(9529) at ChildProcess.exithandler (child_process.js:294:7)
            javascript.0	2020-06-19 13:43:53.349	warn	(9529) at script.js.PV_Anlage.Skript_1:8:4
            javascript.0	2020-06-19 13:43:53.348	warn	(9529) at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1355:20)
            javascript.0	2020-06-19 13:43:53.347	warn	(9529) You are assigning a string to the state "Datenpunkte.0.PV-Anlage.PV_Batterie_Ladung" which expects a boolean. Please fix your code to use a boolean or change the state type to string. This war
            
            paul53P 1 Reply Last reply
            0
            • JB1985J JB1985

              Hey! Danke, es funktioniert jetzt.

              Weißt du zufällig noch wie ich diese WARN Meldung aus dem Log bekomme?

              javascript.0	2020-06-19 13:43:53.349	warn	(9529) at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
              javascript.0	2020-06-19 13:43:53.349	warn	(9529) at maybeClose (internal/child_process.js:1021:16)
              javascript.0	2020-06-19 13:43:53.349	warn	(9529) at ChildProcess.emit (events.js:315:20)
              javascript.0	2020-06-19 13:43:53.349	warn	(9529) at ChildProcess.exithandler (child_process.js:294:7)
              javascript.0	2020-06-19 13:43:53.349	warn	(9529) at script.js.PV_Anlage.Skript_1:8:4
              javascript.0	2020-06-19 13:43:53.348	warn	(9529) at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1355:20)
              javascript.0	2020-06-19 13:43:53.347	warn	(9529) You are assigning a string to the state "Datenpunkte.0.PV-Anlage.PV_Batterie_Ladung" which expects a boolean. Please fix your code to use a boolean or change the state type to string. This war
              
              paul53P Offline
              paul53P Offline
              paul53
              wrote on last edited by paul53
              #6

              @JB1985 sagte:

              WARN Meldung aus dem Log bekomme?

              Die Werte sind Strings. Ändere den Datenpunkt-Typ von "boolean" auf "string".

              Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
              Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

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


              Support us

              ioBroker
              Community Adapters
              Donate

              594

              Online

              32.7k

              Users

              82.4k

              Topics

              1.3m

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

              • Don't have an account? Register

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