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. ioBroker Allgemein
  4. Forecast.solar mit dem Systeminfo Adapter

NEWS

  • Monatsrückblick Januar/Februar 2026 ist online!
    BluefoxB
    Bluefox
    18
    1
    671

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

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

Forecast.solar mit dem Systeminfo Adapter

Scheduled Pinned Locked Moved ioBroker Allgemein
systeminfosolarjson
188 Posts 15 Posters 29.3k Views 16 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.
  • GarganoG Gargano

    @JB_Sullivan So, jetzt gibts es ein Objekt JSONTable für beide Ausrichtungen
    Bitte unter options1 und options2 die enstprechenden Werte eintragen
    Unter SolarJSONTable ist dann das Objekt mit beiden Ausrichtungen

    
    const SolarJSON1        = "javascript.0.SolarForecast.JSON1";
    const SolarJSON2        = "javascript.0.SolarForecast.JSON2";
    const SolarJSONTable    = "javascript.0.SolarForecast.JSONTable";
    
    const creatStateList = [
        {name :SolarJSON1, type:"string", role : "value"},
        {name :SolarJSON2, type:"string", role : "value"},
        {name :SolarJSONTable, type:"string", role : "value"}
    ]
    
    creatStateList.forEach (function(item) {
        createState(item.name, { 
            type: item.type,
            min: 0,
            def: 0,
            role: item.role
        });
    });
    
    var request = require('request');
    var options1 = {url: 'https://api.forecast.solar/estimate/lat1/lon1/45/45/1', method: 'GET', headers: { 'User-Agent': 'request' }};
    var options2 = {url: 'https://api.forecast.solar/estimate/lat2/lon2/45/-45/1', method: 'GET', headers: { 'User-Agent': 'request' }};
    
    var urls = [
      {myUrl:options1,mySolarJSON:SolarJSON1},
      {myUrl:options2,mySolarJSON:SolarJSON2}
    ]
    
    var promises = urls.map(myAsyncRequest);
    
    schedule({hour: 00, minute: 30}, getSolar );
    getSolar();
    
    function myAsyncRequest(myUrl) {
      log('Request '+myUrl.myUrl.url);
      return new Promise((resolve, reject) => {
         request(myUrl.myUrl.url, function(error, response, body) {
            if (!error && response.statusCode == 200) {
      
                let today = formatDate(new Date(), 'YYYY-MM-DD');
                let watts = JSON.parse(body).result.watts;  
                let table = [];
                for(let time in watts) {
                    let pos = time.indexOf(':00:00');
                    if(time.includes(today) && pos != -1) {
                        let entry = {};
                        entry.Uhrzeit = time.substr(pos - 2, 5);
                        entry.Leistung = watts[time];
                        table.push(entry);
                    }
                }  
                log ('JSON: '+myUrl.mySolarJSON);
                setState(myUrl.mySolarJSON, JSON.stringify(table), true);
    
                resolve (body);
            }
        });  
      })
    }
    
    
    function makeTable () {
        log ('MakeTable');
        let watts1 = JSON.parse(getState(SolarJSON1).val);
        let watts2 = JSON.parse(getState(SolarJSON2).val); 
        log ('Items: '+watts1.length);
        let table = [];
        for(var n=0;n<watts1.length;n++) {
                let entry = {};
                entry.Uhrzeit = watts1[n].Uhrzeit;
                entry.Leistung1 = watts1[n].Leistung;
                entry.Leistung2 = watts2[n].Leistung;
                table.push(entry);
        }  
        setState(SolarJSONTable, JSON.stringify(table), true);
    }
    
    
    function getSolar() {
     
      Promise.all(promises)
      .then(function(bodys) {
        console.log("All url loaded");
        makeTable();
      })
    
    }
    
    
    
    
    
    
    H Online
    H Online
    holgerwolf
    wrote on last edited by
    #35

    Klappt prima (bis auf die Sonne ;-)

    3f57cc3c-eec6-439a-a9e7-d4ea6dff2554-grafik.png

    1 Reply Last reply
    0
    • GarganoG Gargano

      @JB_Sullivan So, jetzt gibts es ein Objekt JSONTable für beide Ausrichtungen
      Bitte unter options1 und options2 die enstprechenden Werte eintragen
      Unter SolarJSONTable ist dann das Objekt mit beiden Ausrichtungen

      
      const SolarJSON1        = "javascript.0.SolarForecast.JSON1";
      const SolarJSON2        = "javascript.0.SolarForecast.JSON2";
      const SolarJSONTable    = "javascript.0.SolarForecast.JSONTable";
      
      const creatStateList = [
          {name :SolarJSON1, type:"string", role : "value"},
          {name :SolarJSON2, type:"string", role : "value"},
          {name :SolarJSONTable, type:"string", role : "value"}
      ]
      
      creatStateList.forEach (function(item) {
          createState(item.name, { 
              type: item.type,
              min: 0,
              def: 0,
              role: item.role
          });
      });
      
      var request = require('request');
      var options1 = {url: 'https://api.forecast.solar/estimate/lat1/lon1/45/45/1', method: 'GET', headers: { 'User-Agent': 'request' }};
      var options2 = {url: 'https://api.forecast.solar/estimate/lat2/lon2/45/-45/1', method: 'GET', headers: { 'User-Agent': 'request' }};
      
      var urls = [
        {myUrl:options1,mySolarJSON:SolarJSON1},
        {myUrl:options2,mySolarJSON:SolarJSON2}
      ]
      
      var promises = urls.map(myAsyncRequest);
      
      schedule({hour: 00, minute: 30}, getSolar );
      getSolar();
      
      function myAsyncRequest(myUrl) {
        log('Request '+myUrl.myUrl.url);
        return new Promise((resolve, reject) => {
           request(myUrl.myUrl.url, function(error, response, body) {
              if (!error && response.statusCode == 200) {
        
                  let today = formatDate(new Date(), 'YYYY-MM-DD');
                  let watts = JSON.parse(body).result.watts;  
                  let table = [];
                  for(let time in watts) {
                      let pos = time.indexOf(':00:00');
                      if(time.includes(today) && pos != -1) {
                          let entry = {};
                          entry.Uhrzeit = time.substr(pos - 2, 5);
                          entry.Leistung = watts[time];
                          table.push(entry);
                      }
                  }  
                  log ('JSON: '+myUrl.mySolarJSON);
                  setState(myUrl.mySolarJSON, JSON.stringify(table), true);
      
                  resolve (body);
              }
          });  
        })
      }
      
      
      function makeTable () {
          log ('MakeTable');
          let watts1 = JSON.parse(getState(SolarJSON1).val);
          let watts2 = JSON.parse(getState(SolarJSON2).val); 
          log ('Items: '+watts1.length);
          let table = [];
          for(var n=0;n<watts1.length;n++) {
                  let entry = {};
                  entry.Uhrzeit = watts1[n].Uhrzeit;
                  entry.Leistung1 = watts1[n].Leistung;
                  entry.Leistung2 = watts2[n].Leistung;
                  table.push(entry);
          }  
          setState(SolarJSONTable, JSON.stringify(table), true);
      }
      
      
      function getSolar() {
       
        Promise.all(promises)
        .then(function(bodys) {
          console.log("All url loaded");
          makeTable();
        })
      
      }
      
      
      
      
      
      
      paul53P Offline
      paul53P Offline
      paul53
      wrote on last edited by
      #36

      @Gargano sagte:

      JSONTable für beide Ausrichtungen

      Die Lösung setzt voraus, dass beide Ausrichtungen mit der selben Uhrzeit beginnen und die gleiche Anzahl an Einträgen haben.

      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

      GarganoG 1 Reply Last reply
      0
      • paul53P paul53

        @Gargano sagte:

        JSONTable für beide Ausrichtungen

        Die Lösung setzt voraus, dass beide Ausrichtungen mit der selben Uhrzeit beginnen und die gleiche Anzahl an Einträgen haben.

        GarganoG Offline
        GarganoG Offline
        Gargano
        wrote on last edited by
        #37

        @paul53 Richtig, da aber die beiden Abfragen zur gleichen Zeit sind , wird dies wohl immer so sein

        paul53P 1 Reply Last reply
        0
        • GarganoG Gargano

          @paul53 Richtig, da aber die beiden Abfragen zur gleichen Zeit sind , wird dies wohl immer so sein

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

          @Gargano sagte:

          da aber die beiden Abfragen zur gleichen Zeit sind , wird dies wohl immer so sein

          Das glaube ich nicht bei Ausrichtung Ost/West.

          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

          GarganoG 1 Reply Last reply
          0
          • paul53P paul53

            @Gargano sagte:

            da aber die beiden Abfragen zur gleichen Zeit sind , wird dies wohl immer so sein

            Das glaube ich nicht bei Ausrichtung Ost/West.

            GarganoG Offline
            GarganoG Offline
            Gargano
            wrote on last edited by
            #39

            @paul53 Kannst ja mal einen genialen Algorithmus in der Funktion makeTable einfügen, der dies berücksichtigt.

            1 Reply Last reply
            0
            • GarganoG Gargano

              @JB_Sullivan So, jetzt gibts es ein Objekt JSONTable für beide Ausrichtungen
              Bitte unter options1 und options2 die enstprechenden Werte eintragen
              Unter SolarJSONTable ist dann das Objekt mit beiden Ausrichtungen

              
              const SolarJSON1        = "javascript.0.SolarForecast.JSON1";
              const SolarJSON2        = "javascript.0.SolarForecast.JSON2";
              const SolarJSONTable    = "javascript.0.SolarForecast.JSONTable";
              
              const creatStateList = [
                  {name :SolarJSON1, type:"string", role : "value"},
                  {name :SolarJSON2, type:"string", role : "value"},
                  {name :SolarJSONTable, type:"string", role : "value"}
              ]
              
              creatStateList.forEach (function(item) {
                  createState(item.name, { 
                      type: item.type,
                      min: 0,
                      def: 0,
                      role: item.role
                  });
              });
              
              var request = require('request');
              var options1 = {url: 'https://api.forecast.solar/estimate/lat1/lon1/45/45/1', method: 'GET', headers: { 'User-Agent': 'request' }};
              var options2 = {url: 'https://api.forecast.solar/estimate/lat2/lon2/45/-45/1', method: 'GET', headers: { 'User-Agent': 'request' }};
              
              var urls = [
                {myUrl:options1,mySolarJSON:SolarJSON1},
                {myUrl:options2,mySolarJSON:SolarJSON2}
              ]
              
              var promises = urls.map(myAsyncRequest);
              
              schedule({hour: 00, minute: 30}, getSolar );
              getSolar();
              
              function myAsyncRequest(myUrl) {
                log('Request '+myUrl.myUrl.url);
                return new Promise((resolve, reject) => {
                   request(myUrl.myUrl.url, function(error, response, body) {
                      if (!error && response.statusCode == 200) {
                
                          let today = formatDate(new Date(), 'YYYY-MM-DD');
                          let watts = JSON.parse(body).result.watts;  
                          let table = [];
                          for(let time in watts) {
                              let pos = time.indexOf(':00:00');
                              if(time.includes(today) && pos != -1) {
                                  let entry = {};
                                  entry.Uhrzeit = time.substr(pos - 2, 5);
                                  entry.Leistung = watts[time];
                                  table.push(entry);
                              }
                          }  
                          log ('JSON: '+myUrl.mySolarJSON);
                          setState(myUrl.mySolarJSON, JSON.stringify(table), true);
              
                          resolve (body);
                      }
                  });  
                })
              }
              
              
              function makeTable () {
                  log ('MakeTable');
                  let watts1 = JSON.parse(getState(SolarJSON1).val);
                  let watts2 = JSON.parse(getState(SolarJSON2).val); 
                  log ('Items: '+watts1.length);
                  let table = [];
                  for(var n=0;n<watts1.length;n++) {
                          let entry = {};
                          entry.Uhrzeit = watts1[n].Uhrzeit;
                          entry.Leistung1 = watts1[n].Leistung;
                          entry.Leistung2 = watts2[n].Leistung;
                          table.push(entry);
                  }  
                  setState(SolarJSONTable, JSON.stringify(table), true);
              }
              
              
              function getSolar() {
               
                Promise.all(promises)
                .then(function(bodys) {
                  console.log("All url loaded");
                  makeTable();
                })
              
              }
              
              
              
              
              
              
              JB_SullivanJ Offline
              JB_SullivanJ Offline
              JB_Sullivan
              wrote on last edited by JB_Sullivan
              #40

              @Gargano

              Sieht gut aus - kannst du ggf. Noch eine Summen Bildung von Leistung 1 & 2 mit in die Tabelle aufnehmen?

              e5061836-c812-4deb-8d19-e2600ddda9ff-image.png

              Der Hammer ist, das dass ziehmlich gut passt - 13:00 Uhr lt. Forecast 1952 Watt.

              Real guckst du: Um die ~ 150 Watt wollen wir uns jetzt nicht streiten ;)

              08aabdd3-e97d-4b64-96ab-9a6695cc0b32-image.png

              Auch die Aufteilung OST / WEST ist dicht an den prognostiziereten Werten.

              63338181-2867-403e-98ac-461d82e93e67-image.png

              ioBroker (since 2018) auf Intel Core i3-5005U NUC und Windwos10 Pro

              paul53P GarganoG 2 Replies Last reply
              0
              • JB_SullivanJ JB_Sullivan

                @Gargano

                Sieht gut aus - kannst du ggf. Noch eine Summen Bildung von Leistung 1 & 2 mit in die Tabelle aufnehmen?

                e5061836-c812-4deb-8d19-e2600ddda9ff-image.png

                Der Hammer ist, das dass ziehmlich gut passt - 13:00 Uhr lt. Forecast 1952 Watt.

                Real guckst du: Um die ~ 150 Watt wollen wir uns jetzt nicht streiten ;)

                08aabdd3-e97d-4b64-96ab-9a6695cc0b32-image.png

                Auch die Aufteilung OST / WEST ist dicht an den prognostiziereten Werten.

                63338181-2867-403e-98ac-461d82e93e67-image.png

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

                @JB_Sullivan sagte:

                Sieht gut aus

                Wie sieht es aus, wenn für options1 die Westausrichtung gewählt wird ?

                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

                JB_SullivanJ 1 Reply Last reply
                0
                • paul53P paul53

                  @JB_Sullivan sagte:

                  Sieht gut aus

                  Wie sieht es aus, wenn für options1 die Westausrichtung gewählt wird ?

                  JB_SullivanJ Offline
                  JB_SullivanJ Offline
                  JB_Sullivan
                  wrote on last edited by
                  #42

                  @paul53

                  Interessant - dann sieht es anderes aus - allerdings habe ich auch unterschiedlich starke Belegungen auf OST und West

                  86ef6199-e6ab-4677-9735-ecdd0dd7b107-image.png

                  https://api.forecast.solar/estimate/52.xx/10.xx/40/90/7.26
                  https://api.forecast.solar/estimate/52.xx/10.xx/40/-90/2.64

                  ioBroker (since 2018) auf Intel Core i3-5005U NUC und Windwos10 Pro

                  1 Reply Last reply
                  0
                  • JB_SullivanJ JB_Sullivan

                    @Gargano

                    Sieht gut aus - kannst du ggf. Noch eine Summen Bildung von Leistung 1 & 2 mit in die Tabelle aufnehmen?

                    e5061836-c812-4deb-8d19-e2600ddda9ff-image.png

                    Der Hammer ist, das dass ziehmlich gut passt - 13:00 Uhr lt. Forecast 1952 Watt.

                    Real guckst du: Um die ~ 150 Watt wollen wir uns jetzt nicht streiten ;)

                    08aabdd3-e97d-4b64-96ab-9a6695cc0b32-image.png

                    Auch die Aufteilung OST / WEST ist dicht an den prognostiziereten Werten.

                    63338181-2867-403e-98ac-461d82e93e67-image.png

                    GarganoG Offline
                    GarganoG Offline
                    Gargano
                    wrote on last edited by
                    #43

                    @JB_Sullivan Summenbildung:

                    function makeTable () {
                        log ('MakeTable');
                        let watts1 = JSON.parse(getState(SolarJSON1).val);
                        let watts2 = JSON.parse(getState(SolarJSON2).val); 
                        log ('Items: '+watts1.length);
                        let table = [];
                        let sum1=0;
                        let sum2=0;
                        for(var n=0;n<watts1.length;n++) {
                                let entry = {};
                                entry.Uhrzeit = watts1[n].Uhrzeit;
                                entry.Leistung1 = watts1[n].Leistung;
                                entry.Leistung2 = watts2[n].Leistung;
                                sum1+=watts1[n].Leistung;
                                sum2+=watts2[n].Leistung;
                                table.push(entry);
                        }  
                        let entry = {};
                        entry.Uhrzeit = "Summe";
                        entry.Leistung1 = sum1;
                        entry.Leistung2 = sum2;
                        table.push(entry);
                        setState(SolarJSONTable, JSON.stringify(table), true);
                    }
                    
                    
                    paul53P JB_SullivanJ 2 Replies Last reply
                    0
                    • GarganoG Gargano

                      @JB_Sullivan Summenbildung:

                      function makeTable () {
                          log ('MakeTable');
                          let watts1 = JSON.parse(getState(SolarJSON1).val);
                          let watts2 = JSON.parse(getState(SolarJSON2).val); 
                          log ('Items: '+watts1.length);
                          let table = [];
                          let sum1=0;
                          let sum2=0;
                          for(var n=0;n<watts1.length;n++) {
                                  let entry = {};
                                  entry.Uhrzeit = watts1[n].Uhrzeit;
                                  entry.Leistung1 = watts1[n].Leistung;
                                  entry.Leistung2 = watts2[n].Leistung;
                                  sum1+=watts1[n].Leistung;
                                  sum2+=watts2[n].Leistung;
                                  table.push(entry);
                          }  
                          let entry = {};
                          entry.Uhrzeit = "Summe";
                          entry.Leistung1 = sum1;
                          entry.Leistung2 = sum2;
                          table.push(entry);
                          setState(SolarJSONTable, JSON.stringify(table), true);
                      }
                      
                      
                      paul53P Offline
                      paul53P Offline
                      paul53
                      wrote on last edited by
                      #44

                      @Gargano sagte:

                      Summenbildung:

                          for(var n=0;n<watts1.length;n++) {
                                  let entry = {};
                                  entry.Uhrzeit = watts1[n].Uhrzeit;
                                  entry.OST = watts1[n].Leistung;
                                  entry.WEST = watts2[n].Leistung;
                                  entry.Summe = watts1[n].Leistung + watts2[n].Leistung;
                                  table.push(entry);
                          }  
                      

                      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
                      • GarganoG Gargano

                        @JB_Sullivan Summenbildung:

                        function makeTable () {
                            log ('MakeTable');
                            let watts1 = JSON.parse(getState(SolarJSON1).val);
                            let watts2 = JSON.parse(getState(SolarJSON2).val); 
                            log ('Items: '+watts1.length);
                            let table = [];
                            let sum1=0;
                            let sum2=0;
                            for(var n=0;n<watts1.length;n++) {
                                    let entry = {};
                                    entry.Uhrzeit = watts1[n].Uhrzeit;
                                    entry.Leistung1 = watts1[n].Leistung;
                                    entry.Leistung2 = watts2[n].Leistung;
                                    sum1+=watts1[n].Leistung;
                                    sum2+=watts2[n].Leistung;
                                    table.push(entry);
                            }  
                            let entry = {};
                            entry.Uhrzeit = "Summe";
                            entry.Leistung1 = sum1;
                            entry.Leistung2 = sum2;
                            table.push(entry);
                            setState(SolarJSONTable, JSON.stringify(table), true);
                        }
                        
                        
                        JB_SullivanJ Offline
                        JB_SullivanJ Offline
                        JB_Sullivan
                        wrote on last edited by JB_Sullivan
                        #45

                        @Gargano

                        OK, da habe ich mich wohl falsch ausgedrückt - also Summenbildung von OST + WEST pro Stunde (4. Spalte).

                        Du hast jetzt die Summen gebildet aus komplett OST und komplett WEST ;)

                        7162af84-89df-4315-ba26-218ba3f1faab-image.png

                        Zum entscheiden ob die Waschmaschine laufen soll, wäre es halt wichtig, wieviel Energie mir z.B. um 13:00 in Summe zur Verfügung steht (1952 W)

                        ioBroker (since 2018) auf Intel Core i3-5005U NUC und Windwos10 Pro

                        GarganoG 1 Reply Last reply
                        0
                        • JB_SullivanJ JB_Sullivan

                          @Gargano

                          OK, da habe ich mich wohl falsch ausgedrückt - also Summenbildung von OST + WEST pro Stunde (4. Spalte).

                          Du hast jetzt die Summen gebildet aus komplett OST und komplett WEST ;)

                          7162af84-89df-4315-ba26-218ba3f1faab-image.png

                          Zum entscheiden ob die Waschmaschine laufen soll, wäre es halt wichtig, wieviel Energie mir z.B. um 13:00 in Summe zur Verfügung steht (1952 W)

                          GarganoG Offline
                          GarganoG Offline
                          Gargano
                          wrote on last edited by Gargano
                          #46

                          @JB_Sullivan Dann nimm das von Paul

                          function makeTable () {
                              log ('MakeTable');
                              let watts1 = JSON.parse(getState(SolarJSON1).val);
                              let watts2 = JSON.parse(getState(SolarJSON2).val); 
                              log ('Items: '+watts1.length);
                              let table = [];
                             
                              for(var n=0;n<watts1.length;n++) {
                                      let entry = {};
                                      entry.Uhrzeit = watts1[n].Uhrzeit;
                                      entry.Leistung1 = watts1[n].Leistung;
                                      entry.Leistung2 = watts2[n].Leistung;
                                      entry.Summe = watts1[n].Leistung + watts2[n].Leistung;
                                      table.push(entry);
                              }  
                              setState(SolarJSONTable, JSON.stringify(table), true);
                          }
                          
                          
                          JB_SullivanJ 1 Reply Last reply
                          0
                          • GarganoG Gargano

                            @JB_Sullivan Dann nimm das von Paul

                            function makeTable () {
                                log ('MakeTable');
                                let watts1 = JSON.parse(getState(SolarJSON1).val);
                                let watts2 = JSON.parse(getState(SolarJSON2).val); 
                                log ('Items: '+watts1.length);
                                let table = [];
                               
                                for(var n=0;n<watts1.length;n++) {
                                        let entry = {};
                                        entry.Uhrzeit = watts1[n].Uhrzeit;
                                        entry.Leistung1 = watts1[n].Leistung;
                                        entry.Leistung2 = watts2[n].Leistung;
                                        entry.Summe = watts1[n].Leistung + watts2[n].Leistung;
                                        table.push(entry);
                                }  
                                setState(SolarJSONTable, JSON.stringify(table), true);
                            }
                            
                            
                            JB_SullivanJ Offline
                            JB_SullivanJ Offline
                            JB_Sullivan
                            wrote on last edited by JB_Sullivan
                            #47

                            @Gargano

                            Perfekt 👍 👍 👍 👍

                            4ccba6b8-f21c-41e4-8a66-ca5e8121f785-image.png

                            Ich kenne mich mit javaskript nicht aus, aber wäre das so richtig, wenn man die Vorhersage in Intervallen abholen will?

                            schedule({rule: '*/1 * * * * *'}, getSolar );
                            getSolar();
                            

                            Ändert sich da dann überhaupt etwas? Ich weiß ehrlich gesagt gar nicht wie häufig die Vorhersage dort auf der Webseite aktualisiert wird - aber das Wetter ist ja auch nicht statisch und unterliegt ja über den Tag hinweg auch durchaus diversen Veränderungen.

                            ioBroker (since 2018) auf Intel Core i3-5005U NUC und Windwos10 Pro

                            GarganoG paul53P 3 Replies Last reply
                            0
                            • JB_SullivanJ JB_Sullivan

                              @Gargano

                              Perfekt 👍 👍 👍 👍

                              4ccba6b8-f21c-41e4-8a66-ca5e8121f785-image.png

                              Ich kenne mich mit javaskript nicht aus, aber wäre das so richtig, wenn man die Vorhersage in Intervallen abholen will?

                              schedule({rule: '*/1 * * * * *'}, getSolar );
                              getSolar();
                              

                              Ändert sich da dann überhaupt etwas? Ich weiß ehrlich gesagt gar nicht wie häufig die Vorhersage dort auf der Webseite aktualisiert wird - aber das Wetter ist ja auch nicht statisch und unterliegt ja über den Tag hinweg auch durchaus diversen Veränderungen.

                              GarganoG Offline
                              GarganoG Offline
                              Gargano
                              wrote on last edited by Gargano
                              #48

                              @JB_Sullivan Wer auch noch Grafik haben will :

                              f02ff37a-00cc-4a04-9519-f521cd17bdb7-grafik.png

                              Widget ist JSON Chart vom Scrounger.
                              Als Datenpunk javascript.0.SolarForecast.JSONGraph auswählen

                              Die Änderungen sind :

                              const SolarJSON1        = "javascript.0.SolarForecast.JSON1";
                              const SolarJSON2        = "javascript.0.SolarForecast.JSON2";
                              const SolarJSONTable    = "javascript.0.SolarForecast.JSONTable";
                              const SolarJSONGraph    = "javascript.0.SolarForecast.JSONGraph";
                              
                              const creatStateList = [
                                  {name :SolarJSON1, type:"string", role : "value"},
                                  {name :SolarJSON2, type:"string", role : "value"},
                                  {name :SolarJSONTable, type:"string", role : "value"},
                                  {name :SolarJSONGraph, type:"string", role : "value"}
                              ]
                              

                              und

                              function makeTable () {
                                  log ('MakeTable');
                                  let watts1 = JSON.parse(getState(SolarJSON1).val);
                                  let watts2 = JSON.parse(getState(SolarJSON2).val); 
                                  log ('Items: '+watts1.length);
                                  let today = formatDate(new Date(), 'YYYY-MM-DD');
                                  let table = [];
                                  let graphTimeData = [];
                                  
                                  for(var n=0;n<watts1.length;n++) {
                                          let entry = {};
                                          let graphEntry ={};
                                          let thisTime = today +' '+ watts1[n].Uhrzeit;
                                          log (thisTime);
                                          entry.Uhrzeit = watts1[n].Uhrzeit;
                                          entry.Leistung1 = watts1[n].Leistung;
                                          entry.Leistung2 = watts2[n].Leistung;
                                          entry.Summe = watts1[n].Leistung + watts2[n].Leistung;
                                          table.push(entry);
                              
                                          graphEntry.t = Date.parse(thisTime);
                                          graphEntry.y = watts1[n].Leistung + watts2[n].Leistung;
                                          graphTimeData.push(graphEntry);
                                  } 
                              
                                  var graph = {};
                                  var graphData ={};
                                  var graphAllData = [];
                                  graphData.data = graphTimeData;
                                  graphAllData.push(graphData);
                                  graph.graphs=graphAllData;
                                  setState(SolarJSONTable, JSON.stringify(table), true);
                                  setState(SolarJSONGraph, JSON.stringify(graph), true);
                              
                              }
                              
                              

                              Hier der ganze Code :

                              
                              const SolarJSON1        = "javascript.0.SolarForecast.JSON1";
                              const SolarJSON2        = "javascript.0.SolarForecast.JSON2";
                              const SolarJSONTable    = "javascript.0.SolarForecast.JSONTable";
                              const SolarJSONGraph    = "javascript.0.SolarForecast.JSONGraph";
                              
                              const creatStateList = [
                                  {name :SolarJSON1, type:"string", role : "value"},
                                  {name :SolarJSON2, type:"string", role : "value"},
                                  {name :SolarJSONTable, type:"string", role : "value"},
                                  {name :SolarJSONGraph, type:"string", role : "value"}
                              ]
                              
                              creatStateList.forEach (function(item) {
                                  createState(item.name, { 
                                      type: item.type,
                                      min: 0,
                                      def: 0,
                                      role: item.role
                                  });
                              });
                              
                              var request = require('request');
                              var options1 = {url: 'https://api.forecast.solar/estimate/xxx/yyy/45/45/1', method: 'GET', headers: { 'User-Agent': 'request' }};
                              var options2 = {url: 'https://api.forecast.solar/estimate/xxx/yyy/45/-45/1', method: 'GET', headers: { 'User-Agent': 'request' }};
                              
                              var urls = [
                                {myUrl:options1,mySolarJSON:SolarJSON1},
                                {myUrl:options2,mySolarJSON:SolarJSON2}
                              ]
                              
                              var promises = urls.map(myAsyncRequest);
                              
                              schedule({hour: 00, minute: 30}, getSolar );
                              getSolar();
                              
                              function myAsyncRequest(myUrl) {
                                log('Request '+myUrl.myUrl.url);
                                return new Promise((resolve, reject) => {
                                   request(myUrl.myUrl.url, function(error, response, body) {
                                      if (!error && response.statusCode == 200) {
                                
                                          let today = formatDate(new Date(), 'YYYY-MM-DD');
                                          let watts = JSON.parse(body).result.watts;  
                                          let table = [];
                                          for(let time in watts) {
                                              let pos = time.indexOf(':00:00');
                                              if(time.includes(today) && pos != -1) {
                                                  let entry = {};
                                                  entry.Uhrzeit = time.substr(pos - 2, 5);
                                                  entry.Leistung = watts[time];
                                                  table.push(entry);
                                              }
                                          }  
                                          log ('JSON: '+myUrl.mySolarJSON);
                                          setState(myUrl.mySolarJSON, JSON.stringify(table), true);
                              
                                          resolve (body);
                                      }
                                  });  
                                })
                              }
                              
                              
                              function makeTable () {
                                  log ('MakeTable');
                                  let watts1 = JSON.parse(getState(SolarJSON1).val);
                                  let watts2 = JSON.parse(getState(SolarJSON2).val); 
                                  log ('Items: '+watts1.length);
                                  let today = formatDate(new Date(), 'YYYY-MM-DD');
                                  let table = [];
                                  let graphTimeData = [];
                                  
                                  for(var n=0;n<watts1.length;n++) {
                                          let entry = {};
                                          let graphEntry ={};
                                          let thisTime = today +' '+ watts1[n].Uhrzeit;
                                          log (thisTime);
                                          entry.Uhrzeit = watts1[n].Uhrzeit;
                                          entry.Leistung1 = watts1[n].Leistung;
                                          entry.Leistung2 = watts2[n].Leistung;
                                          entry.Summe = watts1[n].Leistung + watts2[n].Leistung;
                                          table.push(entry);
                              
                                          graphEntry.t = Date.parse(thisTime);
                                          graphEntry.y = watts1[n].Leistung + watts2[n].Leistung;
                                          graphTimeData.push(graphEntry);
                                  } 
                              
                                  var graph = {};
                                  var graphData ={};
                                  var graphAllData = [];
                                  graphData.data = graphTimeData;
                                  graphAllData.push(graphData);
                                  graph.graphs=graphAllData;
                                  setState(SolarJSONTable, JSON.stringify(table), true);
                                  setState(SolarJSONGraph, JSON.stringify(graph), true);
                              
                              }
                              
                              
                              function getSolar() {
                               
                                Promise.all(promises)
                                .then(function(bodys) {
                                  console.log("All url loaded");
                                  makeTable();
                                })
                              
                              }
                              
                              
                              
                              
                              
                              
                              1 Reply Last reply
                              0
                              • JB_SullivanJ JB_Sullivan

                                @Gargano

                                Perfekt 👍 👍 👍 👍

                                4ccba6b8-f21c-41e4-8a66-ca5e8121f785-image.png

                                Ich kenne mich mit javaskript nicht aus, aber wäre das so richtig, wenn man die Vorhersage in Intervallen abholen will?

                                schedule({rule: '*/1 * * * * *'}, getSolar );
                                getSolar();
                                

                                Ändert sich da dann überhaupt etwas? Ich weiß ehrlich gesagt gar nicht wie häufig die Vorhersage dort auf der Webseite aktualisiert wird - aber das Wetter ist ja auch nicht statisch und unterliegt ja über den Tag hinweg auch durchaus diversen Veränderungen.

                                GarganoG Offline
                                GarganoG Offline
                                Gargano
                                wrote on last edited by
                                #49

                                @JB_Sullivan Jede Minute ist evtl. zu oft:
                                Du kannst im JS Editor oben rechts mit der Uhr die Syntax für den schedule einstellen
                                78f6a29c-1e24-4868-b0da-05d7baf81aa2-grafik.png

                                1 Reply Last reply
                                0
                                • JB_SullivanJ JB_Sullivan

                                  @Gargano

                                  Perfekt 👍 👍 👍 👍

                                  4ccba6b8-f21c-41e4-8a66-ca5e8121f785-image.png

                                  Ich kenne mich mit javaskript nicht aus, aber wäre das so richtig, wenn man die Vorhersage in Intervallen abholen will?

                                  schedule({rule: '*/1 * * * * *'}, getSolar );
                                  getSolar();
                                  

                                  Ändert sich da dann überhaupt etwas? Ich weiß ehrlich gesagt gar nicht wie häufig die Vorhersage dort auf der Webseite aktualisiert wird - aber das Wetter ist ja auch nicht statisch und unterliegt ja über den Tag hinweg auch durchaus diversen Veränderungen.

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

                                  @JB_Sullivan sagte:

                                  wie häufig die Vorhersage dort auf der Webseite aktualisiert wird

                                  Sicherlich nicht öfter als jede Stunde.

                                  schedule('6 6-18 * * *', getSolar); 
                                  

                                  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
                                  • JB_SullivanJ Offline
                                    JB_SullivanJ Offline
                                    JB_Sullivan
                                    wrote on last edited by JB_Sullivan
                                    #51

                                    Guten Morgen zusammen,
                                    kann es sein, das dass js-skript nicht ganz "sauber" programmiert ist?

                                    Wenn das Skript läuft, funktioniert der deconz Adpter extrem langsam und nach kurzer Zeit erscheint dann die Meldung, das die js-skript Instanz gestoppt ist.

                                    Der "güne Punkt" von js-Instanz ist dann auch wirklich Grau, aber der Play Button ist noch grün.

                                    Stoppe ich das Forecast Skript, läuft alles normal und auch deconz funktioniert so schnell wie immer.

                                    const SolarJSON1        = "javascript.0.SolarForecast.JSON1";
                                    const SolarJSON2        = "javascript.0.SolarForecast.JSON2";
                                    const SolarJSONTable    = "javascript.0.SolarForecast.JSONTable";
                                    const SolarJSONGraph    = "javascript.0.SolarForecast.JSONGraph";
                                     
                                    const creatStateList = [
                                        {name :SolarJSON1, type:"string", role : "value"},
                                        {name :SolarJSON2, type:"string", role : "value"},
                                        {name :SolarJSONTable, type:"string", role : "value"},
                                        {name :SolarJSONGraph, type:"string", role : "value"}
                                    ]
                                     
                                    creatStateList.forEach (function(item) {
                                        createState(item.name, { 
                                            type: item.type,
                                            min: 0,
                                            def: 0,
                                            role: item.role
                                        });
                                    });
                                     
                                    var request = require('request');
                                    var options1 = {url: 'https://api.forecast.solar/estimate/52.xx/10.xx/40/90/7.26', method: 'GET', headers: { 'User-Agent': 'request' }};
                                    var options2 = {url: 'https://api.forecast.solar/estimate/52.xx/10.xx/40/-90/2.64', method: 'GET', headers: { 'User-Agent': 'request' }};
                                     
                                    var urls = [
                                      {myUrl:options1,mySolarJSON:SolarJSON1},
                                      {myUrl:options2,mySolarJSON:SolarJSON2}
                                    ]
                                     
                                    var promises = urls.map(myAsyncRequest);
                                     
                                    schedule('6 6-22 * * *', getSolar);
                                    getSolar();
                                     
                                    function myAsyncRequest(myUrl) {
                                      log('Request '+myUrl.myUrl.url);
                                      return new Promise((resolve, reject) => {
                                         request(myUrl.myUrl.url, function(error, response, body) {
                                            if (!error && response.statusCode == 200) {
                                      
                                                let today = formatDate(new Date(), 'YYYY-MM-DD');
                                                let watts = JSON.parse(body).result.watts;  
                                                let table = [];
                                                for(let time in watts) {
                                                    let pos = time.indexOf(':00:00');
                                                    if(time.includes(today) && pos != -1) {
                                                        let entry = {};
                                                        entry.Uhrzeit = time.substr(pos - 2, 5);
                                                        entry.Leistung = watts[time];
                                                        table.push(entry);
                                                    }
                                                }  
                                                log ('JSON: '+myUrl.mySolarJSON);
                                                setState(myUrl.mySolarJSON, JSON.stringify(table), true);
                                     
                                                resolve (body);
                                            }
                                        });  
                                      })
                                    }
                                     
                                     
                                    function makeTable () {
                                        log ('MakeTable');
                                        let watts1 = JSON.parse(getState(SolarJSON1).val);
                                        let watts2 = JSON.parse(getState(SolarJSON2).val); 
                                        log ('Items: '+watts1.length);
                                        let today = formatDate(new Date(), 'YYYY-MM-DD');
                                        let table = [];
                                        let graphTimeData = [];
                                        
                                        for(var n=0;n<watts1.length;n++) {
                                                let entry = {};
                                                let graphEntry ={};
                                                let thisTime = today +' '+ watts1[n].Uhrzeit;
                                                log (thisTime);
                                                entry.Uhrzeit = watts1[n].Uhrzeit;
                                                entry.Leistung1 = watts1[n].Leistung;
                                                entry.Leistung2 = watts2[n].Leistung;
                                                entry.Summe = watts1[n].Leistung + watts2[n].Leistung;
                                                table.push(entry);
                                     
                                                graphEntry.t = Date.parse(thisTime);
                                                graphEntry.y = watts1[n].Leistung + watts2[n].Leistung;
                                                graphTimeData.push(graphEntry);
                                        } 
                                     
                                        var graph = {};
                                        var graphData ={};
                                        var graphAllData = [];
                                        graphData.data = graphTimeData;
                                        graphAllData.push(graphData);
                                        graph.graphs=graphAllData;
                                        setState(SolarJSONTable, JSON.stringify(table), true);
                                        setState(SolarJSONGraph, JSON.stringify(graph), true);
                                     
                                    }
                                     
                                     
                                    function getSolar() {
                                     
                                      Promise.all(promises)
                                      .then(function(bodys) {
                                        console.log("All url loaded");
                                        makeTable();
                                      })
                                    

                                    ioBroker (since 2018) auf Intel Core i3-5005U NUC und Windwos10 Pro

                                    GarganoG 1 Reply Last reply
                                    0
                                    • JB_SullivanJ JB_Sullivan

                                      Guten Morgen zusammen,
                                      kann es sein, das dass js-skript nicht ganz "sauber" programmiert ist?

                                      Wenn das Skript läuft, funktioniert der deconz Adpter extrem langsam und nach kurzer Zeit erscheint dann die Meldung, das die js-skript Instanz gestoppt ist.

                                      Der "güne Punkt" von js-Instanz ist dann auch wirklich Grau, aber der Play Button ist noch grün.

                                      Stoppe ich das Forecast Skript, läuft alles normal und auch deconz funktioniert so schnell wie immer.

                                      const SolarJSON1        = "javascript.0.SolarForecast.JSON1";
                                      const SolarJSON2        = "javascript.0.SolarForecast.JSON2";
                                      const SolarJSONTable    = "javascript.0.SolarForecast.JSONTable";
                                      const SolarJSONGraph    = "javascript.0.SolarForecast.JSONGraph";
                                       
                                      const creatStateList = [
                                          {name :SolarJSON1, type:"string", role : "value"},
                                          {name :SolarJSON2, type:"string", role : "value"},
                                          {name :SolarJSONTable, type:"string", role : "value"},
                                          {name :SolarJSONGraph, type:"string", role : "value"}
                                      ]
                                       
                                      creatStateList.forEach (function(item) {
                                          createState(item.name, { 
                                              type: item.type,
                                              min: 0,
                                              def: 0,
                                              role: item.role
                                          });
                                      });
                                       
                                      var request = require('request');
                                      var options1 = {url: 'https://api.forecast.solar/estimate/52.xx/10.xx/40/90/7.26', method: 'GET', headers: { 'User-Agent': 'request' }};
                                      var options2 = {url: 'https://api.forecast.solar/estimate/52.xx/10.xx/40/-90/2.64', method: 'GET', headers: { 'User-Agent': 'request' }};
                                       
                                      var urls = [
                                        {myUrl:options1,mySolarJSON:SolarJSON1},
                                        {myUrl:options2,mySolarJSON:SolarJSON2}
                                      ]
                                       
                                      var promises = urls.map(myAsyncRequest);
                                       
                                      schedule('6 6-22 * * *', getSolar);
                                      getSolar();
                                       
                                      function myAsyncRequest(myUrl) {
                                        log('Request '+myUrl.myUrl.url);
                                        return new Promise((resolve, reject) => {
                                           request(myUrl.myUrl.url, function(error, response, body) {
                                              if (!error && response.statusCode == 200) {
                                        
                                                  let today = formatDate(new Date(), 'YYYY-MM-DD');
                                                  let watts = JSON.parse(body).result.watts;  
                                                  let table = [];
                                                  for(let time in watts) {
                                                      let pos = time.indexOf(':00:00');
                                                      if(time.includes(today) && pos != -1) {
                                                          let entry = {};
                                                          entry.Uhrzeit = time.substr(pos - 2, 5);
                                                          entry.Leistung = watts[time];
                                                          table.push(entry);
                                                      }
                                                  }  
                                                  log ('JSON: '+myUrl.mySolarJSON);
                                                  setState(myUrl.mySolarJSON, JSON.stringify(table), true);
                                       
                                                  resolve (body);
                                              }
                                          });  
                                        })
                                      }
                                       
                                       
                                      function makeTable () {
                                          log ('MakeTable');
                                          let watts1 = JSON.parse(getState(SolarJSON1).val);
                                          let watts2 = JSON.parse(getState(SolarJSON2).val); 
                                          log ('Items: '+watts1.length);
                                          let today = formatDate(new Date(), 'YYYY-MM-DD');
                                          let table = [];
                                          let graphTimeData = [];
                                          
                                          for(var n=0;n<watts1.length;n++) {
                                                  let entry = {};
                                                  let graphEntry ={};
                                                  let thisTime = today +' '+ watts1[n].Uhrzeit;
                                                  log (thisTime);
                                                  entry.Uhrzeit = watts1[n].Uhrzeit;
                                                  entry.Leistung1 = watts1[n].Leistung;
                                                  entry.Leistung2 = watts2[n].Leistung;
                                                  entry.Summe = watts1[n].Leistung + watts2[n].Leistung;
                                                  table.push(entry);
                                       
                                                  graphEntry.t = Date.parse(thisTime);
                                                  graphEntry.y = watts1[n].Leistung + watts2[n].Leistung;
                                                  graphTimeData.push(graphEntry);
                                          } 
                                       
                                          var graph = {};
                                          var graphData ={};
                                          var graphAllData = [];
                                          graphData.data = graphTimeData;
                                          graphAllData.push(graphData);
                                          graph.graphs=graphAllData;
                                          setState(SolarJSONTable, JSON.stringify(table), true);
                                          setState(SolarJSONGraph, JSON.stringify(graph), true);
                                       
                                      }
                                       
                                       
                                      function getSolar() {
                                       
                                        Promise.all(promises)
                                        .then(function(bodys) {
                                          console.log("All url loaded");
                                          makeTable();
                                        })
                                      
                                      GarganoG Offline
                                      GarganoG Offline
                                      Gargano
                                      wrote on last edited by
                                      #52

                                      @JB_Sullivan Welche Version JS Adapter hast Du ? Was sagt denn der Log ?

                                      JB_SullivanJ 1 Reply Last reply
                                      0
                                      • GarganoG Gargano

                                        @JB_Sullivan Welche Version JS Adapter hast Du ? Was sagt denn der Log ?

                                        JB_SullivanJ Offline
                                        JB_SullivanJ Offline
                                        JB_Sullivan
                                        wrote on last edited by
                                        #53

                                        @Gargano Ich bin dem kompletten ioB System im latest unterwegs - also alles Top Aktuell. Das Log sagt bis auf ein js-skript Instanz "stopped" gar nichts weiter.

                                        ioBroker (since 2018) auf Intel Core i3-5005U NUC und Windwos10 Pro

                                        GarganoG 1 Reply Last reply
                                        0
                                        • JB_SullivanJ JB_Sullivan

                                          @Gargano Ich bin dem kompletten ioB System im latest unterwegs - also alles Top Aktuell. Das Log sagt bis auf ein js-skript Instanz "stopped" gar nichts weiter.

                                          GarganoG Offline
                                          GarganoG Offline
                                          Gargano
                                          wrote on last edited by Gargano
                                          #54

                                          @JB_Sullivan Steht Deine Log-Stufe vom JS auf Debug ?

                                          Ich habe noch eine Fehlerbehandlung dazu gebaut, aber ich fürchte daß es das nicht ist :

                                          
                                          const SolarJSON1        = "javascript.0.SolarForecast.JSON1";
                                          const SolarJSON2        = "javascript.0.SolarForecast.JSON2";
                                          const SolarJSONTable    = "javascript.0.SolarForecast.JSONTable";
                                          const SolarJSONGraph    = "javascript.0.SolarForecast.JSONGraph";
                                          
                                          const creatStateList = [
                                              {name :SolarJSON1, type:"string", role : "value"},
                                              {name :SolarJSON2, type:"string", role : "value"},
                                              {name :SolarJSONTable, type:"string", role : "value"},
                                              {name :SolarJSONGraph, type:"string", role : "value"}
                                          ]
                                          
                                          creatStateList.forEach (function(item) {
                                              createState(item.name, { 
                                                  type: item.type,
                                                  min: 0,
                                                  def: 0,
                                                  role: item.role
                                              });
                                          });
                                          
                                          var request = require('request');
                                          var options1 = {url: 'https://api.forecast.solar/estimate/xx/yy/45/45/1', method: 'GET', headers: { 'User-Agent': 'request' }};
                                          var options2 = {url: 'https://api.forecast.solar/estimate/xx/yy/45/-45/1', method: 'GET', headers: { 'User-Agent': 'request' }};
                                          
                                          var urls = [
                                            {myUrl:options1,mySolarJSON:SolarJSON1},
                                            {myUrl:options2,mySolarJSON:SolarJSON2}
                                          ]
                                          
                                          var promises = urls.map(myAsyncRequest);
                                          
                                          schedule('6 6-18 * * *', getSolar);
                                          getSolar();
                                          
                                          function myAsyncRequest(myUrl) {
                                            log('Request '+myUrl.myUrl.url);
                                            return new Promise((resolve, reject) => {
                                               request(myUrl.myUrl.url, function(error, response, body) {
                                                  if (!error && response.statusCode == 200) {
                                            
                                                      let today = formatDate(new Date(), 'YYYY-MM-DD');
                                                      let watts = JSON.parse(body).result.watts;  
                                                      let table = [];
                                                      for(let time in watts) {
                                                          let pos = time.indexOf(':00:00');
                                                          if(time.includes(today) && pos != -1) {
                                                              let entry = {};
                                                              entry.Uhrzeit = time.substr(pos - 2, 5);
                                                              entry.Leistung = watts[time];
                                                              table.push(entry);
                                                          }
                                                      }  
                                                      setState(myUrl.mySolarJSON, JSON.stringify(table), true);
                                                      resolve (body);
                                                  } else {
                                                      reject(new Error("Could not load " + myUrl.myUrl.url))
                                                  }
                                              });  
                                            })
                                          }
                                          
                                          
                                          function makeTable () {
                                              log ('MakeTable');
                                              let watts1 = JSON.parse(getState(SolarJSON1).val);
                                              let watts2 = JSON.parse(getState(SolarJSON2).val); 
                                              log ('Items: '+watts1.length);
                                              let today = formatDate(new Date(), 'YYYY-MM-DD');
                                              let table = [];
                                              let graphTimeData = [];
                                              
                                              for(var n=0;n<watts1.length;n++) {
                                                      let entry = {};
                                                      let graphEntry ={};
                                                      let thisTime = today +' '+ watts1[n].Uhrzeit;
                                                      entry.Uhrzeit = watts1[n].Uhrzeit;
                                                      entry.Leistung1 = watts1[n].Leistung;
                                                      entry.Leistung2 = watts2[n].Leistung;
                                                      entry.Summe = watts1[n].Leistung + watts2[n].Leistung;
                                                      table.push(entry);
                                          
                                                      graphEntry.t = Date.parse(thisTime);
                                                      graphEntry.y = watts1[n].Leistung + watts2[n].Leistung;
                                                      graphTimeData.push(graphEntry);
                                              } 
                                          
                                              var graph = {};
                                              var graphData ={};
                                              var graphAllData = [];
                                              graphData.data = graphTimeData;
                                              graphAllData.push(graphData);
                                              graph.graphs=graphAllData;
                                              setState(SolarJSONTable, JSON.stringify(table), true);
                                              setState(SolarJSONGraph, JSON.stringify(graph), true);
                                          
                                          }
                                          
                                          
                                          function getSolar() {
                                            Promise.all(promises)
                                            .then(function() {
                                              console.log("All url loaded");
                                              makeTable();
                                            })
                                            .catch(error => {
                                              console.log(error)
                                            })  
                                          }
                                          
                                          
                                          
                                          
                                          
                                          
                                          1 Reply Last reply
                                          0

                                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                          With your input, this post could be even better 💗

                                          Register Login
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          Support us

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

                                          543

                                          Online

                                          32.7k

                                          Users

                                          82.6k

                                          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