Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Einsteigerfragen
    4. Automatisierung
    5. Daten zeitweise addieren

    NEWS

    • 15. 05. Wartungsarbeiten am ioBroker Forum

    • Monatsrückblick - April 2025

    • Minor js-controller 7.0.7 Update in latest repo

    UNSOLVED Daten zeitweise addieren

    This topic has been deleted. Only users with topic management privileges can see it.
    • mickym
      mickym Most Active @Jonny 0 last edited by mickym

      @jonny-0 sagte in Daten zeitweise addieren:

      @mickym
      So in etwa könnte es bei mir auch funktionieren.

      Es kommt alle 3 sekunden ein Wert, den sammeln und nach 30 secunden den mittelwert aller auf die WB schieben.
      Dann sammeln wir wieder 30 sekunden, und addieren den neuen Mittelwert auf den vorigen auf.

      Das zusammenzählen von den Payloadwerten, habe ich realisiert, leider zählt er unendlich weiter.
      Wenn ich das Ding irgendwie um 0.00 auf Neuanfang setzen könnte wäre schon das Ziel.

      msg.payload = (flow.get("import") || 0) + msg.payload;
      //msg.payload = msg.payload ;
      flow.set("import", msg.payload);
      return msg;

      Du speist einfach ein msg.reset = true ein und setzt auf 0.

      msg.payload = (context.get("import") || 0) + msg.payload;
      //msg.payload = msg.payload ;
      if (msg.reset) msg.payload = 0;
      context.set("import", msg.payload);
      return msg;
      

      Dazu könntest Du eine Inject Node bemühen:

      e17d5bd1-28c0-470d-a866-5a4d7b9fe4ca-image.png
      04ecef71-f044-4670-a678-433a427a4e44-image.png

      Das kannst aber im context machen, da brauchst den Flow nicht.

      Homoran J 2 Replies Last reply Reply Quote 0
      • Homoran
        Homoran Global Moderator Administrators @mickym last edited by

        @mickym oder soll das ein Schieberegister für einen gleitenden Mittelwert werden?

        mickym 1 Reply Last reply Reply Quote 0
        • mickym
          mickym Most Active @Homoran last edited by mickym

          @homoran Na das gleitende ist das Problem. Dann musst Du wirklich mit festen Zeitintervallen die Werte einspeisen und dann hast Du eine festdefinierte Arraygröße. Wenn diese erreicht wird, wird oben ein Wert hinzugefügt und unten einer entfernt. da war ich selbst dabei, die aggregator Node zu nehmen und die entsprechend zu erweitern - dann hab ich aber die Lust verloren. 😉

          1 Reply Last reply Reply Quote 0
          • J
            Jonny 0 @Homoran last edited by

            @homoran said in Daten zeitweise addieren:

            @jonny-0 sagte in Daten zeitweise addieren:

            ich bin leider nicht sehr gut im erklären.

            das habe ich gemerkt 😊

            @jonny-0 sagte in Daten zeitweise addieren:

            vielleicht ist es durch den obigen post verständlicher.

            leider nein.

            also schritt für Schritt:

            Vielleicht versteckt sich hier etwas wichtiges
            @jonny-0 sagte in Daten zeitweise addieren:

            Es kommt alle 3 sekunden ein Wert, den sammeln und nach 30 secunden den mittelwert aller auf die WB schieben.

            was hat die Wallbox mit der Batterie zu tun? --> Die Wallbox verwaltet hier das ganze Smarthome.
            und wovon der Mittelwert der letzten 3 Sekunden?--> von dem import und dem export.
            WENN die Batterie bereits maximal entlädt ergibt es doch keinen Sinn die gleiche Menge noch ins Auto zu laden 🤔

            Warum nicht ? Es kann doch auch sein das von der PV 10 KW kommen und ich mit 13 laden tu. ( max entladen Speicher)

            Homoran 1 Reply Last reply Reply Quote 0
            • mickym
              mickym Most Active @Jonny 0 last edited by mickym

              @jonny-0 sagte in Daten zeitweise addieren:

              Es kommt alle 3 sekunden ein Wert, den sammeln und nach 30 secunden den mittelwert aller auf die WB schieben.
              Dann sammeln wir wieder 30 sekunden, und addieren den neuen Mittelwert auf den vorigen auf.

              Das mit den 30s sammeln und den Mittelwert zu bilden, das würde ich dann aber der Aggregator Node überlassen und dann hast Du auch definierte Zeitintervalle.

              Bei Tageswerten wäre das Array dann 2880 Elemente (24x60x2) groß und dann kann man es füllen und hätte einen gleitenden Tageswert. Dann wäre es streng genommen auch kein Tageswert sondern die letzten 24 Std. 😉

              1 Reply Last reply Reply Quote 0
              • J
                Jonny 0 @mickym last edited by

                @mickym

                Das könnte echt funktionieren.....

                Werde das versuchen.
                Addiert mir alle payloads auf, und setzt es um 0.00 Uhr zurück auf 0.

                Das wäre die allereinfachste Lösung......

                Ich berichte....👏 👏 👏 👏

                1 Reply Last reply Reply Quote 0
                • Homoran
                  Homoran Global Moderator Administrators @Jonny 0 last edited by

                  @jonny-0 sagte in Daten zeitweise addieren:

                  Warum nicht ? Es kann doch auch sein das von der PV 10 KW kommen und ich mit 13 laden tu. ( max entladen Speicher)

                  aber das regelt doch dann die Batteriesteuerung.
                  ich raff es nicht was du willst.

                  dann ist abends die Batterie leer und du kannst dann in der Nacht Strom kaufen.

                  und jetzt OT
                  @jonny-0 sagte in Daten zeitweise addieren:

                  Ich habe einen Varta Elements

                  die dürfen/können doch höchstens 5kW abgeben.

                  J 1 Reply Last reply Reply Quote 0
                  • J
                    Jonny 0 @Homoran last edited by Jonny 0

                    @homoran

                    warum ist der Akku dann abend leer wenn er sich nach dem entladen wieder aufladen kann.
                    Egal. Ich bekomme jetzt noch einen 100 KW Speicher dazu, der 250kw abgeben kann also auch dc schnellladen möglich.
                    Auch bekomme ich noch eine weitere PV Anlage hinzu.
                    Dies ist bzw. wir eine Anschauanlage von einem Startup unternehmen.
                    (Habe ja nicht im Lotto gewonnen)

                    Wie gesagt muss ich diesen umweg gehen, da die jetzige Version der WB nicht mehr als 1 Speicher und auch eine PV kann.

                    Bei mir regelt die Batteriesteuerung nichts. die gibt ab wenn gefordert wird und nimmt auf wenn ich übrig lasse, was ich auch in der WB einstellen kann.

                    Homoran 1 Reply Last reply Reply Quote 0
                    • Homoran
                      Homoran Global Moderator Administrators @Jonny 0 last edited by Homoran

                      @jonny-0 sagte in Daten zeitweise addieren:

                      warum ist der Akku dann abend leer wenn er sich nach dem entladen wieder aufladen kann.

                      weil das Auto erst bei Sonnenuntergang voll ist 🙂

                      @jonny-0 sagte in Daten zeitweise addieren:

                      Ich bekomme jetzt noch einen 100 KW Speicher dazu, der 250kw abgeben kann also auch dc schnellladen möglich.

                      100 kWh?
                      mit 250 kW Leistungsabgabe? also 2.5C? sicher? Aber dann definitiv nicht von Varta., die dürfen nur mit 0.25C belastet werden. Sonst können die ihre Spezifikationen (Kapazität/Zyklenzahl) nicht garantieren.
                      und ich kenne nur eine Batterie die so hohe Leistungsabgabe und trotzdem hohe Zyklenzahlen erreicht. Und die wird nur von Bastlern verbaut.
                      Üblich sind deshalb im Moment 0.5C als Kompromiss

                      @jonny-0 sagte in Daten zeitweise addieren:

                      Bei mir regelt die Batteriesteuerung nichts. die gibt ab wenn gefordert wird und nimmt auf wenn ich übrig lasse

                      naja, das ist die Regelung

                      aber genug OT

                      J 1 Reply Last reply Reply Quote 0
                      • J
                        Jonny 0 @Homoran last edited by

                        @homoran

                        Ich berichte gerne über den neuen Speicher wenn gewünscht.
                        Nein es ist kein Varta.
                        Ja, meine Daten oben mit 250KW laden und auch entladen sind richtig.
                        Weshalb ich ja auch einen 90 DC Schnelllader bekomme....

                        Ich teste jetzt ob das so einfach funktioniert mit einem Inject Node.
                        Wäre genial gelöst.

                        Ich berichte..

                        Danke an alle und noch einen schönen Restabend...

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

                          Also ich habe meinen alten Flow gefunden - der würde Dir aber nichts helfen, da Du ja glaub ohne den iobroker arbeitest. Ich bin mir auch nicht mehr ganz sicher, ob es wirklich fehlerfrei gearbeitet hat, aber der Vollständigkeit will ich ihn mal posten:

                          Wie @Homoran schrieb ist das nicht banal:

                          31851e08-8fab-4662-a868-f3bc7316f646-image.png

                          Allerdings müsste ich mir das genau wieder anschauen, wie es funktioniert. 😉

                          Wenn man den Baum so gebaut hatte - wurde die gesamte Datenpunkte so erstellt, wenn man reset auf true gesetzt hatte:

                          c145044b-8111-4382-b1d8-1b30c1e6bd52-image.png

                          932c0882-d09b-4390-b258-80088220fe40-image.png

                          Das Herzstück war den Momentanverbrauch halt auf Wh umzurechnen, wie

                          @homoran sagte in Daten zeitweise addieren:

                          @mickym ich hab immer noch nicht verstanden was er will!
                          wenn der interne Zähler um Mitternacht nullt hat man doch am Tagesende die insgesamt eingeladene und insgesamt entnommene Menge (in kWh).
                          was fehlt denn dann? Ladezustand ist doch auch da. die Entlade-/Ladeleistung in kW?

                          das wäre in (blockly) (aktueller Wert-vorheriger Wert):(Timestamp-vorheriger Timestamp)

                          hier erwähnte.

                          Das war damals im Topic des Kontextes ermittelt in der Node Aktuelle Wh

                          var lasttime = context.get(msg.topic);
                          var timespan;
                          
                          if (lasttime === undefined) {
                              lasttime = msg.timestamp;
                              context.set(msg.topic,lasttime);
                              return null;
                          }
                          
                          timespan = msg.timestamp - lasttime;
                          lasttime = msg.timestamp;
                          context.set(msg.topic,lasttime);
                          msg.Wh=msg.power*(timespan/1000/60/60);
                          
                          return msg;
                          

                          Im Prinzip wurden dann die aktuellen Wh in alle Datenpunkte addiert. Sobald eine Zeitperiode beendet war (wurde genullt und der Wert in die vorherige Periode kopiert.

                          da war der trigger - das war damals auch in einer function Node gemacht:

                          const sec = 1000;
                          const min = sec * 60;
                          const hour = min * 60;
                          const day = hour * 24;
                          const week = day * 7;
                          const month = day * 30.4375;
                          const year = month * 12;
                          var ts = new Date().getTime();
                          var bUpdate = false;
                          // msg.topic = msg.topic.replace(/(.*)\.use_time_date/,"$1");
                          // var device = msg.topic.replace(/.*shellies\.(.*)/,"$1");
                          var device = msg.device;
                          
                          var timespan = context.get(device)
                          if (timespan === undefined) {
                              
                              // node.warn ('device: ' + device);
                              // node.warn ('msg.start.timespan: ' + JSON.stringify(msg.start.timespan));
                              timespan = msg.start.timespan;
                              context.set(device,timespan); 
                              // node.warn ('timespan = defined');
                              return [null,null]
                              
                          }
                          
                          var addValues = [];
                          // var resetValues = [];
                          var msgStart = {topic: msg.topic + '.start', payload: msg.start}
                          
                          var topiclist="hour,month,today,total,week,year";
                          var topics = topiclist.split(",");
                          
                          // node.warn ('device: ' + device);
                          for (var w in topics) {
                              var diff = 0;
                              switch(topics[w]) {
                                  case 'hour':
                                      // code block
                                      diff= Math.trunc((ts - msg.start.ts) / hour);
                                      // node.warn ('const hour: ' + hour);
                                      // hours: timespan.hour
                                      if (diff > timespan.hour){
                                          bUpdate = true;
                                          timespan.hour=diff;
                          
                                          addValues.push({topic: msg.topic + '.hour', payload: 0 , newTopic: msg.topic + '.hour_before' , start: msg.start.ts , ts: ts , hours: diff, comment: diff + ' hours since start' });
                                      }
                                      break;
                                  case 'month':
                                      // code block
                                      diff= Math.trunc((ts - msg.start.ts) / month);
                                      // node.warn ('const month: ' + month);
                                      // months: timespan.month
                                      if (diff > timespan.month){
                                          bUpdate = true;
                                          timespan.month=diff;
                          
                                          addValues.push({topic: msg.topic + '.month', payload: 0 , newTopic: msg.topic + '.month_before', start: msg.start.ts , ts: ts , months: diff, comment: diff + ' months since start' });
                                      }
                                      break;
                                  case 'today':
                                      // code block
                                      diff= Math.trunc((ts - msg.start.ts) / day);
                                      // node.warn ('const day: ' + day);
                                      // days: timespan.day
                                      if (diff > timespan.day){
                                          bUpdate = true;
                                          timespan.day=diff;
                          
                                          addValues.push({topic: msg.topic + '.today', payload: 0 , newTopic: msg.topic + '.yesterday' , start: msg.start.ts , ts: ts , days: diff, comment: diff + ' days since start'});
                                      }
                                      break;
                                  case 'total':
                                      // code block - nichts machen - gibt nichts zum Zurücksetzen
                                      break;
                                  case 'week':
                                      // code block
                                      diff= Math.trunc((ts - msg.start.ts) / week);
                                      // node.warn ('const week: ' + week);
                                      // weeks: timespan.week
                                      if (diff > timespan.week){
                                          bUpdate = true;
                                          timespan.week=diff;
                          
                                          addValues.push({topic: msg.topic + '.week', payload: 0 , newTopic: msg.topic + '.week_before' , start: msg.start.ts , ts: ts , weeks: diff, comment: diff + ' weeks since start' });
                                      }
                                      break;
                                  case 'year':
                                      // code block
                                      diff= Math.trunc((ts - msg.start.ts) / year);
                                      // if (diff > 0 ) { node.warn(' -> ts: ' + ts + ' -> msg.start.ts: ' + msg.start.ts + ' -> (ts - msg.start.ts) / year: ' + ((ts - msg.start.ts) / year))}
                                      // node.warn ('const year: ' + year);
                                      // years: timespan.hour
                                      if (diff > timespan.year){
                                          bUpdate = true;
                                          timespan.year=diff;
                          
                                          addValues.push({topic: msg.topic + '.year', payload: 0 , newTopic: msg.topic + '.year_before', start: msg.start.ts , ts: ts , years: diff, comment: diff + ' years since start'});
                                      }
                                      break;
                                      
                                  default:
                                      // code block
                              }   
                          }
                          
                          // bUpdate = true;
                          
                          if (bUpdate){
                              context.set(device,timespan);
                              msgStart.payload.timespan = timespan;
                              return [ addValues,  msgStart ];
                          }
                          
                          
                          // outputMsgs.push({topic:msg.topic + '/' + topics[w], Wh: msg.Wh});
                          

                          Ich hab den Flow mal exportiert - aber wie gesagt, da muss man sich wieder reinfuchsen. In den power Datenpunkt muss der Momentanverbrauch aus der Originalquelle kopiert werden. Im Detail müsste man sich gerade die function Node nochmal anschauen. Ursprünglich wollte ich das sowohl für DAUER als auch für KALENDER also bei Tageswechsel machen. Im Moment wird es wirklich nach DAUER gemacht und nicht nach Kalender. Sprich der Tag zählt genau bei Start 24 Std. Die 2. Option ist eigentlich einfacher - aber wie gesagt, ich hab mich dann nicht mehr damit beschäftigt. Manchmal vergeht einem die Lust - obwohl es sicherlich ein gutes Projekt geworden wäre - aber halt redundant zum sourceanalytics. Im Prinzip kann man den Flow aber auch für NodeRed Standalone Installationen verwenden, wenn man als Datenbank einen mqtt Broker nimmt. Muss ggf. die topics anpassen, allerdings kann man mit den Wildcards schon ziemlich universell arbeiten.

                          [
                             {
                                 "id": "35850f3.22dd0f",
                                 "type": "inject",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "props": [
                                     {
                                         "p": "payload"
                                     },
                                     {
                                         "p": "topic",
                                         "vt": "str"
                                     }
                                 ],
                                 "repeat": "",
                                 "crontab": "",
                                 "once": false,
                                 "onceDelay": 0.1,
                                 "topic": "0_userdata/0/stromverbrauch/shellies/shelly-dummy/reset",
                                 "payload": "true",
                                 "payloadType": "bool",
                                 "x": 310,
                                 "y": 180,
                                 "wires": [
                                     [
                                         "80f66656.38dec8"
                                     ]
                                 ]
                             },
                             {
                                 "id": "80f66656.38dec8",
                                 "type": "switch",
                                 "z": "2c7d577a.9b4378",
                                 "name": "reset = true?",
                                 "property": "payload",
                                 "propertyType": "msg",
                                 "rules": [
                                     {
                                         "t": "true"
                                     }
                                 ],
                                 "checkall": "true",
                                 "repair": false,
                                 "outputs": 1,
                                 "x": 510,
                                 "y": 220,
                                 "wires": [
                                     [
                                         "98ce503d.77b81"
                                     ]
                                 ]
                             },
                             {
                                 "id": "5a848615.797c98",
                                 "type": "change",
                                 "z": "2c7d577a.9b4378",
                                 "name": "define and reset topics",
                                 "rules": [
                                     {
                                         "t": "set",
                                         "p": "payload",
                                         "pt": "msg",
                                         "to": "[{\"common\":{\"name\":\"total\",\"desc\":\"Created by Node-Red\",\"role\":\"state\",\"type\":\"number\",\"unit\":\"kWh\",\"read\":true,\"write\":false,\"def\":0},\"type\":\"state\"},{\"common\":{\"name\":\"yesterday\",\"desc\":\"Created by Node-Red\",\"role\":\"state\",\"type\":\"number\",\"unit\":\"Wh\",\"read\":true,\"write\":false,\"def\":0},\"type\":\"state\"},{\"common\":{\"name\":\"today\",\"desc\":\"Created by Node-Red\",\"role\":\"state\",\"type\":\"number\",\"unit\":\"Wh\",\"read\":true,\"write\":false,\"def\":0},\"type\":\"state\"},{\"common\":{\"name\":\"year\",\"desc\":\"Created by Node-Red\",\"role\":\"state\",\"type\":\"number\",\"unit\":\"kWh\",\"read\":true,\"write\":false,\"def\":0},\"type\":\"state\"},{\"common\":{\"name\":\"month\",\"desc\":\"Created by Node-Red\",\"role\":\"state\",\"type\":\"number\",\"unit\":\"kWh\",\"read\":true,\"write\":false,\"def\":0},\"type\":\"state\"},{\"common\":{\"name\":\"power\",\"desc\":\"Created by Node-Red\",\"role\":\"state\",\"type\":\"number\",\"unit\":\"Wh\",\"read\":true,\"write\":false,\"def\":0},\"type\":\"state\"},{\"common\":{\"name\":\"hour\",\"desc\":\"Created by Node-Red\",\"role\":\"state\",\"type\":\"number\",\"unit\":\"Wh\",\"read\":true,\"write\":false,\"def\":0},\"type\":\"state\"},{\"common\":{\"name\":\"hour_before\",\"desc\":\"Created by Node-Red\",\"role\":\"state\",\"type\":\"number\",\"unit\":\"Wh\",\"read\":true,\"write\":false,\"def\":0},\"type\":\"state\"},{\"common\":{\"name\":\"year_before\",\"desc\":\"Created by Node-Red\",\"role\":\"state\",\"type\":\"number\",\"unit\":\"kWh\",\"read\":true,\"write\":false,\"def\":0},\"type\":\"state\"},{\"common\":{\"name\":\"month_before\",\"desc\":\"Created by Node-Red\",\"role\":\"state\",\"type\":\"number\",\"unit\":\"kWh\",\"read\":true,\"write\":false,\"def\":0},\"type\":\"state\"},{\"common\":{\"name\":\"week_before\",\"desc\":\"Created by Node-Red\",\"role\":\"state\",\"type\":\"number\",\"unit\":\"Wh\",\"read\":true,\"write\":false,\"def\":0},\"type\":\"state\"},{\"common\":{\"name\":\"week\",\"desc\":\"Created by Node-Red\",\"role\":\"state\",\"type\":\"number\",\"unit\":\"Wh\",\"read\":true,\"write\":false,\"def\":0},\"type\":\"state\"},{\"common\":{\"name\":\"start\",\"desc\":\"Created by Node-Red\",\"role\":\"state\",\"type\":\"string\",\"read\":true,\"write\":false,\"def\":\"\"},\"type\":\"state\"},{\"common\":{\"name\":\"reset\",\"desc\":\"Created by Node-Red\",\"role\":\"state\",\"type\":\"boolean\",\"read\":true,\"write\":true,\"def\":false},\"type\":\"state\"},{\"common\":{\"name\":\"use_time_date\",\"desc\":\"Created by Node-Red\",\"role\":\"state\",\"type\":\"boolean\",\"read\":true,\"write\":true,\"def\":false},\"type\":\"state\"},{\"common\":{\"name\":\"flot\",\"role\":\"\",\"type\":\"string\",\"desc\":\"Created by Node-Red\",\"def\":\"\",\"read\":true,\"write\":true},\"type\":\"state\"}]",
                                         "tot": "json"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 1100,
                                 "y": 220,
                                 "wires": [
                                     [
                                         "85d30229.134d7"
                                     ]
                                 ]
                             },
                             {
                                 "id": "85d30229.134d7",
                                 "type": "split",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "splt": "\\n",
                                 "spltType": "str",
                                 "arraySplt": 1,
                                 "arraySpltType": "len",
                                 "stream": false,
                                 "addname": "",
                                 "x": 1280,
                                 "y": 220,
                                 "wires": [
                                     [
                                         "14273608.84409a"
                                     ]
                                 ]
                             },
                             {
                                 "id": "98ce503d.77b81",
                                 "type": "change",
                                 "z": "2c7d577a.9b4378",
                                 "name": "get parent topic",
                                 "rules": [
                                     {
                                         "t": "change",
                                         "p": "topic",
                                         "pt": "msg",
                                         "from": "(.*)[\\.,\\/]reset$",
                                         "fromt": "re",
                                         "to": "$1",
                                         "tot": "str"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 800,
                                 "y": 220,
                                 "wires": [
                                     [
                                         "5a848615.797c98"
                                     ]
                                 ]
                             },
                             {
                                 "id": "14273608.84409a",
                                 "type": "change",
                                 "z": "2c7d577a.9b4378",
                                 "name": "set new topic",
                                 "rules": [
                                     {
                                         "t": "change",
                                         "p": "topic",
                                         "pt": "msg",
                                         "from": "/",
                                         "fromt": "str",
                                         "to": ".",
                                         "tot": "str"
                                     },
                                     {
                                         "t": "set",
                                         "p": "topic",
                                         "pt": "msg",
                                         "to": "topic & '.' & payload.common.name",
                                         "tot": "jsonata"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 1430,
                                 "y": 220,
                                 "wires": [
                                     [
                                         "c26782ba.6d0cb"
                                     ]
                                 ]
                             },
                             {
                                 "id": "a066a4b2.bffac8",
                                 "type": "switch",
                                 "z": "2c7d577a.9b4378",
                                 "name": "reset to default?",
                                 "property": "payload.common.def",
                                 "propertyType": "msg",
                                 "rules": [
                                     {
                                         "t": "null"
                                     },
                                     {
                                         "t": "nnull"
                                     }
                                 ],
                                 "checkall": "true",
                                 "repair": false,
                                 "outputs": 2,
                                 "x": 2280,
                                 "y": 220,
                                 "wires": [
                                     [
                                         "aaaf4f8e.09af2"
                                     ],
                                     [
                                         "8c7b3b16.005078"
                                     ]
                                 ]
                             },
                             {
                                 "id": "c26782ba.6d0cb",
                                 "type": "change",
                                 "z": "2c7d577a.9b4378",
                                 "name": "translate definition",
                                 "rules": [
                                     {
                                         "t": "set",
                                         "p": "stateName",
                                         "pt": "msg",
                                         "to": "payload.common.name",
                                         "tot": "msg"
                                     },
                                     {
                                         "t": "set",
                                         "p": "stateType",
                                         "pt": "msg",
                                         "to": "payload.common.type",
                                         "tot": "msg"
                                     },
                                     {
                                         "t": "set",
                                         "p": "stateReadonly",
                                         "pt": "msg",
                                         "to": "payload.common.write",
                                         "tot": "msg"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 1610,
                                 "y": 220,
                                 "wires": [
                                     [
                                         "edec84c8.29ee98"
                                     ]
                                 ]
                             },
                             {
                                 "id": "edec84c8.29ee98",
                                 "type": "switch",
                                 "z": "2c7d577a.9b4378",
                                 "name": "unit available?",
                                 "property": "payload.common.unit",
                                 "propertyType": "msg",
                                 "rules": [
                                     {
                                         "t": "nnull"
                                     },
                                     {
                                         "t": "null"
                                     }
                                 ],
                                 "checkall": "true",
                                 "repair": false,
                                 "outputs": 2,
                                 "x": 1820,
                                 "y": 220,
                                 "wires": [
                                     [
                                         "7b7016cb.ac10c8"
                                     ],
                                     [
                                         "1f3da0b6.9e766f"
                                     ]
                                 ]
                             },
                             {
                                 "id": "1f3da0b6.9e766f",
                                 "type": "function",
                                 "z": "2c7d577a.9b4378",
                                 "name": "do nothing",
                                 "func": "\nreturn msg;",
                                 "outputs": 1,
                                 "noerr": 0,
                                 "initialize": "",
                                 "finalize": "",
                                 "x": 2050,
                                 "y": 240,
                                 "wires": [
                                     [
                                         "a066a4b2.bffac8"
                                     ]
                                 ]
                             },
                             {
                                 "id": "7b7016cb.ac10c8",
                                 "type": "change",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "rules": [
                                     {
                                         "t": "set",
                                         "p": "stateUnit",
                                         "pt": "msg",
                                         "to": "payload.common.unit",
                                         "tot": "msg"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 2050,
                                 "y": 200,
                                 "wires": [
                                     [
                                         "a066a4b2.bffac8"
                                     ]
                                 ]
                             },
                             {
                                 "id": "cc84166f.06b778",
                                 "type": "ioBroker out",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "topic": "",
                                 "ack": "false",
                                 "autoCreate": "true",
                                 "stateName": "",
                                 "role": "",
                                 "payloadType": "",
                                 "readonly": "",
                                 "stateUnit": "",
                                 "stateMin": "",
                                 "stateMax": "",
                                 "x": 2720,
                                 "y": 220,
                                 "wires": []
                             },
                             {
                                 "id": "aaaf4f8e.09af2",
                                 "type": "change",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "rules": [
                                     {
                                         "t": "delete",
                                         "p": "payload",
                                         "pt": "msg"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 2500,
                                 "y": 180,
                                 "wires": [
                                     [
                                         "cc84166f.06b778"
                                     ]
                                 ]
                             },
                             {
                                 "id": "8c7b3b16.005078",
                                 "type": "change",
                                 "z": "2c7d577a.9b4378",
                                 "name": "set defaults",
                                 "rules": [
                                     {
                                         "t": "set",
                                         "p": "default",
                                         "pt": "msg",
                                         "to": "payload.common.def",
                                         "tot": "msg"
                                     },
                                     {
                                         "t": "delete",
                                         "p": "payload",
                                         "pt": "msg"
                                     },
                                     {
                                         "t": "move",
                                         "p": "default",
                                         "pt": "msg",
                                         "to": "payload",
                                         "tot": "msg"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 2470,
                                 "y": 260,
                                 "wires": [
                                     [
                                         "cc84166f.06b778"
                                     ]
                                 ]
                             },
                             {
                                 "id": "cc6771bb.13f14",
                                 "type": "switch",
                                 "z": "2c7d577a.9b4378",
                                 "name": "start without object",
                                 "property": "payload",
                                 "propertyType": "msg",
                                 "rules": [
                                     {
                                         "t": "eq",
                                         "v": "",
                                         "vt": "str"
                                     }
                                 ],
                                 "checkall": "true",
                                 "repair": false,
                                 "outputs": 1,
                                 "x": 790,
                                 "y": 280,
                                 "wires": [
                                     [
                                         "ce0be96b.5c5fa8"
                                     ]
                                 ]
                             },
                             {
                                 "id": "ce0be96b.5c5fa8",
                                 "type": "change",
                                 "z": "2c7d577a.9b4378",
                                 "name": "Initialisiere start",
                                 "rules": [
                                     {
                                         "t": "set",
                                         "p": "payload",
                                         "pt": "msg",
                                         "to": "{}",
                                         "tot": "json"
                                     },
                                     {
                                         "t": "set",
                                         "p": "payload.ts",
                                         "pt": "msg",
                                         "to": "",
                                         "tot": "date"
                                     },
                                     {
                                         "t": "set",
                                         "p": "payload.date",
                                         "pt": "msg",
                                         "to": " $moment(payload.ts).locale(\"de\").tz('Europe/Berlin').format('YYYY-MM-DD HH:mm:ss')",
                                         "tot": "jsonata"
                                     },
                                     {
                                         "t": "set",
                                         "p": "payload.timespan",
                                         "pt": "msg",
                                         "to": "{\"hour\":0,\"day\":0,\"week\":0,\"month\":0,\"year\":0}",
                                         "tot": "json"
                                     },
                                     {
                                         "t": "change",
                                         "p": "topic",
                                         "pt": "msg",
                                         "from": "/",
                                         "fromt": "str",
                                         "to": ".",
                                         "tot": "str"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 1060,
                                 "y": 280,
                                 "wires": [
                                     [
                                         "450761a2.575e",
                                         "d9135ecb.c5bef"
                                     ]
                                 ]
                             },
                             {
                                 "id": "729a31f7.1f0d",
                                 "type": "change",
                                 "z": "2c7d577a.9b4378",
                                 "name": "set msg.topic & msg.power",
                                 "rules": [
                                     {
                                         "t": "change",
                                         "p": "topic",
                                         "pt": "msg",
                                         "from": "(.*)\\/power",
                                         "fromt": "re",
                                         "to": "$1",
                                         "tot": "str"
                                     },
                                     {
                                         "t": "move",
                                         "p": "payload",
                                         "pt": "msg",
                                         "to": "power",
                                         "tot": "msg"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 560,
                                 "y": 560,
                                 "wires": [
                                     [
                                         "257ceae5.2dbc16"
                                     ]
                                 ]
                             },
                             {
                                 "id": "257ceae5.2dbc16",
                                 "type": "function",
                                 "z": "2c7d577a.9b4378",
                                 "name": "Aktuelle Wh",
                                 "func": "var lasttime = context.get(msg.topic);\nvar timespan;\n\nif (lasttime === undefined) {\n    lasttime = msg.timestamp;\n    context.set(msg.topic,lasttime);\n    return null;\n}\n\ntimespan = msg.timestamp - lasttime;\nlasttime = msg.timestamp;\ncontext.set(msg.topic,lasttime);\nmsg.Wh=msg.power*(timespan/1000/60/60);\n\nreturn msg;",
                                 "outputs": 1,
                                 "noerr": 0,
                                 "initialize": "",
                                 "finalize": "",
                                 "libs": [],
                                 "x": 910,
                                 "y": 560,
                                 "wires": [
                                     [
                                         "7b7a6cd4.f05704"
                                     ]
                                 ]
                             },
                             {
                                 "id": "d9135ecb.c5bef",
                                 "type": "json",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "property": "payload",
                                 "action": "",
                                 "pretty": false,
                                 "x": 1230,
                                 "y": 280,
                                 "wires": [
                                     [
                                         "ffaaaca9.31ecf"
                                     ]
                                 ]
                             },
                             {
                                 "id": "ffaaaca9.31ecf",
                                 "type": "ioBroker out",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "topic": "",
                                 "ack": "true",
                                 "autoCreate": "false",
                                 "stateName": "",
                                 "role": "",
                                 "payloadType": "",
                                 "readonly": "",
                                 "stateUnit": "",
                                 "stateMin": "",
                                 "stateMax": "",
                                 "x": 1410,
                                 "y": 280,
                                 "wires": []
                             },
                             {
                                 "id": "7b7a6cd4.f05704",
                                 "type": "function",
                                 "z": "2c7d577a.9b4378",
                                 "name": "add topics",
                                 "func": "var outputMsgs = [];\nvar topiclist=\"hour,month,today,total,week,year,start\";\n\nvar topics = topiclist.split(\",\");\n\nfor (var w in topics) {\n    outputMsgs.push({topic:msg.topic + '/' + topics[w], Wh: msg.Wh});\n}\nreturn [ outputMsgs ];\n",
                                 "outputs": 1,
                                 "noerr": 0,
                                 "initialize": "",
                                 "finalize": "",
                                 "x": 1090,
                                 "y": 560,
                                 "wires": [
                                     [
                                         "7e64ff11.4278"
                                     ]
                                 ]
                             },
                             {
                                 "id": "1de3c97e.1a0bf7",
                                 "type": "ioBroker get",
                                 "z": "2c7d577a.9b4378",
                                 "name": "hour",
                                 "topic": "",
                                 "attrname": "payload",
                                 "payloadType": "value",
                                 "x": 1410,
                                 "y": 380,
                                 "wires": [
                                     [
                                         "9d1bc133.e80b7"
                                     ]
                                 ]
                             },
                             {
                                 "id": "21dc8345.7618bc",
                                 "type": "ioBroker get",
                                 "z": "2c7d577a.9b4378",
                                 "name": "today",
                                 "topic": "",
                                 "attrname": "payload",
                                 "payloadType": "value",
                                 "x": 1410,
                                 "y": 440,
                                 "wires": [
                                     [
                                         "9d1bc133.e80b7"
                                     ]
                                 ]
                             },
                             {
                                 "id": "70288298.bf84dc",
                                 "type": "ioBroker get",
                                 "z": "2c7d577a.9b4378",
                                 "name": "month",
                                 "topic": "",
                                 "attrname": "payload",
                                 "payloadType": "value",
                                 "x": 1410,
                                 "y": 560,
                                 "wires": [
                                     [
                                         "dea3c66b.907df8"
                                     ]
                                 ]
                             },
                             {
                                 "id": "b9db5bd0.a50a78",
                                 "type": "ioBroker get",
                                 "z": "2c7d577a.9b4378",
                                 "name": "total",
                                 "topic": "",
                                 "attrname": "payload",
                                 "payloadType": "value",
                                 "x": 1410,
                                 "y": 680,
                                 "wires": [
                                     [
                                         "dea3c66b.907df8"
                                     ]
                                 ]
                             },
                             {
                                 "id": "6e65954f.bdec0c",
                                 "type": "ioBroker get",
                                 "z": "2c7d577a.9b4378",
                                 "name": "week",
                                 "topic": "",
                                 "attrname": "payload",
                                 "payloadType": "value",
                                 "x": 1410,
                                 "y": 500,
                                 "wires": [
                                     [
                                         "9d1bc133.e80b7"
                                     ]
                                 ]
                             },
                             {
                                 "id": "44b9db26.ca4314",
                                 "type": "ioBroker get",
                                 "z": "2c7d577a.9b4378",
                                 "name": "year",
                                 "topic": "",
                                 "attrname": "payload",
                                 "payloadType": "value",
                                 "x": 1410,
                                 "y": 620,
                                 "wires": [
                                     [
                                         "dea3c66b.907df8"
                                     ]
                                 ]
                             },
                             {
                                 "id": "9d1bc133.e80b7",
                                 "type": "change",
                                 "z": "2c7d577a.9b4378",
                                 "name": "Addiere Wh",
                                 "rules": [
                                     {
                                         "t": "set",
                                         "p": "payload",
                                         "pt": "msg",
                                         "to": "payload + Wh",
                                         "tot": "jsonata"
                                     },
                                     {
                                         "t": "change",
                                         "p": "topic",
                                         "pt": "msg",
                                         "from": "/",
                                         "fromt": "str",
                                         "to": ".",
                                         "tot": "str"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 1600,
                                 "y": 440,
                                 "wires": [
                                     [
                                         "4bca099e.ca1e88"
                                     ]
                                 ]
                             },
                             {
                                 "id": "dea3c66b.907df8",
                                 "type": "change",
                                 "z": "2c7d577a.9b4378",
                                 "name": "Addiere kWh",
                                 "rules": [
                                     {
                                         "t": "set",
                                         "p": "payload",
                                         "pt": "msg",
                                         "to": "payload + (Wh/1000)",
                                         "tot": "jsonata"
                                     },
                                     {
                                         "t": "change",
                                         "p": "topic",
                                         "pt": "msg",
                                         "from": "/",
                                         "fromt": "str",
                                         "to": ".",
                                         "tot": "str"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 1590,
                                 "y": 620,
                                 "wires": [
                                     [
                                         "4bca099e.ca1e88"
                                     ]
                                 ]
                             },
                             {
                                 "id": "4bca099e.ca1e88",
                                 "type": "ioBroker out",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "topic": "",
                                 "ack": "true",
                                 "autoCreate": "false",
                                 "stateName": "",
                                 "role": "",
                                 "payloadType": "",
                                 "readonly": "",
                                 "stateUnit": "",
                                 "stateMin": "",
                                 "stateMax": "",
                                 "x": 1820,
                                 "y": 520,
                                 "wires": []
                             },
                             {
                                 "id": "7e64ff11.4278",
                                 "type": "switch",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "property": "topic",
                                 "propertyType": "msg",
                                 "rules": [
                                     {
                                         "t": "regex",
                                         "v": ".*[\\/,\\.]hour$",
                                         "vt": "str",
                                         "case": false
                                     },
                                     {
                                         "t": "regex",
                                         "v": ".*[\\/,\\.]today$",
                                         "vt": "str",
                                         "case": false
                                     },
                                     {
                                         "t": "regex",
                                         "v": ".*[\\/,\\.]week$",
                                         "vt": "str",
                                         "case": false
                                     },
                                     {
                                         "t": "regex",
                                         "v": ".*[\\/,\\.]month$",
                                         "vt": "str",
                                         "case": false
                                     },
                                     {
                                         "t": "regex",
                                         "v": ".*[\\/,\\.]year$",
                                         "vt": "str",
                                         "case": false
                                     },
                                     {
                                         "t": "regex",
                                         "v": ".*[\\/,\\.]total$",
                                         "vt": "str",
                                         "case": false
                                     },
                                     {
                                         "t": "regex",
                                         "v": ".*[\\/,\\.]start$",
                                         "vt": "str",
                                         "case": false
                                     }
                                 ],
                                 "checkall": "true",
                                 "repair": false,
                                 "outputs": 7,
                                 "x": 1250,
                                 "y": 560,
                                 "wires": [
                                     [
                                         "1de3c97e.1a0bf7"
                                     ],
                                     [
                                         "21dc8345.7618bc"
                                     ],
                                     [
                                         "6e65954f.bdec0c"
                                     ],
                                     [
                                         "70288298.bf84dc"
                                     ],
                                     [
                                         "44b9db26.ca4314"
                                     ],
                                     [
                                         "b9db5bd0.a50a78"
                                     ],
                                     [
                                         "93fdc929.570df8"
                                     ]
                                 ]
                             },
                             {
                                 "id": "93fdc929.570df8",
                                 "type": "ioBroker get",
                                 "z": "2c7d577a.9b4378",
                                 "name": "start",
                                 "topic": "",
                                 "attrname": "payload",
                                 "payloadType": "value",
                                 "x": 1410,
                                 "y": 780,
                                 "wires": [
                                     [
                                         "107973e8.2fdc3c"
                                     ]
                                 ]
                             },
                             {
                                 "id": "97f2d9d1.1420f8",
                                 "type": "change",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "rules": [
                                     {
                                         "t": "change",
                                         "p": "topic",
                                         "pt": "msg",
                                         "from": "(.*)\\/start",
                                         "fromt": "re",
                                         "to": "$1",
                                         "tot": "str"
                                     },
                                     {
                                         "t": "move",
                                         "p": "payload",
                                         "pt": "msg",
                                         "to": "start",
                                         "tot": "msg"
                                     },
                                     {
                                         "t": "change",
                                         "p": "topic",
                                         "pt": "msg",
                                         "from": "/",
                                         "fromt": "str",
                                         "to": ".",
                                         "tot": "str"
                                     },
                                     {
                                         "t": "set",
                                         "p": "topic",
                                         "pt": "msg",
                                         "to": "topic & '.use_time_date'",
                                         "tot": "jsonata"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 1900,
                                 "y": 780,
                                 "wires": [
                                     [
                                         "18019d9a.2b8552"
                                     ]
                                 ]
                             },
                             {
                                 "id": "18019d9a.2b8552",
                                 "type": "ioBroker get",
                                 "z": "2c7d577a.9b4378",
                                 "name": "use_time_date",
                                 "topic": "",
                                 "attrname": "payload",
                                 "payloadType": "value",
                                 "x": 2100,
                                 "y": 780,
                                 "wires": [
                                     [
                                         "7f7e5f9f.41f46"
                                     ]
                                 ]
                             },
                             {
                                 "id": "453a7a8d.9c72f4",
                                 "type": "switch",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "property": "payload",
                                 "propertyType": "msg",
                                 "rules": [
                                     {
                                         "t": "true"
                                     },
                                     {
                                         "t": "false"
                                     }
                                 ],
                                 "checkall": "true",
                                 "repair": false,
                                 "outputs": 2,
                                 "x": 2470,
                                 "y": 780,
                                 "wires": [
                                     [],
                                     [
                                         "fc7f508d.c986d",
                                         "fc2c5159.6e28"
                                     ]
                                 ]
                             },
                             {
                                 "id": "fc2c5159.6e28",
                                 "type": "function",
                                 "z": "2c7d577a.9b4378",
                                 "name": "trigger nach Dauer",
                                 "func": "const sec = 1000;\nconst min = sec * 60;\nconst hour = min * 60;\nconst day = hour * 24;\nconst week = day * 7;\nconst month = day * 30.4375;\nconst year = month * 12;\nvar ts = new Date().getTime();\nvar bUpdate = false;\n// msg.topic = msg.topic.replace(/(.*)\\.use_time_date/,\"$1\");\n// var device = msg.topic.replace(/.*shellies\\.(.*)/,\"$1\");\nvar device = msg.device;\n\nvar timespan = context.get(device)\nif (timespan === undefined) {\n    \n    // node.warn ('device: ' + device);\n    // node.warn ('msg.start.timespan: ' + JSON.stringify(msg.start.timespan));\n    timespan = msg.start.timespan;\n    context.set(device,timespan); \n    // node.warn ('timespan = defined');\n    return [null,null]\n    \n}\n\nvar addValues = [];\n// var resetValues = [];\nvar msgStart = {topic: msg.topic + '.start', payload: msg.start}\n\nvar topiclist=\"hour,month,today,total,week,year\";\nvar topics = topiclist.split(\",\");\n\n// node.warn ('device: ' + device);\nfor (var w in topics) {\n    var diff = 0;\n    switch(topics[w]) {\n        case 'hour':\n            // code block\n            diff= Math.trunc((ts - msg.start.ts) / hour);\n            // node.warn ('const hour: ' + hour);\n            // hours: timespan.hour\n            if (diff > timespan.hour){\n                bUpdate = true;\n                timespan.hour=diff;\n\n                addValues.push({topic: msg.topic + '.hour', payload: 0 , newTopic: msg.topic + '.hour_before' , start: msg.start.ts , ts: ts , hours: diff, comment: diff + ' hours since start' });\n            }\n            break;\n        case 'month':\n            // code block\n            diff= Math.trunc((ts - msg.start.ts) / month);\n            // node.warn ('const month: ' + month);\n            // months: timespan.month\n            if (diff > timespan.month){\n                bUpdate = true;\n                timespan.month=diff;\n\n                addValues.push({topic: msg.topic + '.month', payload: 0 , newTopic: msg.topic + '.month_before', start: msg.start.ts , ts: ts , months: diff, comment: diff + ' months since start' });\n            }\n            break;\n        case 'today':\n            // code block\n            diff= Math.trunc((ts - msg.start.ts) / day);\n            // node.warn ('const day: ' + day);\n            // days: timespan.day\n            if (diff > timespan.day){\n                bUpdate = true;\n                timespan.day=diff;\n\n                addValues.push({topic: msg.topic + '.today', payload: 0 , newTopic: msg.topic + '.yesterday' , start: msg.start.ts , ts: ts , days: diff, comment: diff + ' days since start'});\n            }\n            break;\n        case 'total':\n            // code block - nichts machen - gibt nichts zum Zurücksetzen\n            break;\n        case 'week':\n            // code block\n            diff= Math.trunc((ts - msg.start.ts) / week);\n            // node.warn ('const week: ' + week);\n            // weeks: timespan.week\n            if (diff > timespan.week){\n                bUpdate = true;\n                timespan.week=diff;\n\n                addValues.push({topic: msg.topic + '.week', payload: 0 , newTopic: msg.topic + '.week_before' , start: msg.start.ts , ts: ts , weeks: diff, comment: diff + ' weeks since start' });\n            }\n            break;\n        case 'year':\n            // code block\n            diff= Math.trunc((ts - msg.start.ts) / year);\n            // if (diff > 0 ) { node.warn(' -> ts: ' + ts + ' -> msg.start.ts: ' + msg.start.ts + ' -> (ts - msg.start.ts) / year: ' + ((ts - msg.start.ts) / year))}\n            // node.warn ('const year: ' + year);\n            // years: timespan.hour\n            if (diff > timespan.year){\n                bUpdate = true;\n                timespan.year=diff;\n\n                addValues.push({topic: msg.topic + '.year', payload: 0 , newTopic: msg.topic + '.year_before', start: msg.start.ts , ts: ts , years: diff, comment: diff + ' years since start'});\n            }\n            break;\n            \n        default:\n            // code block\n    }   \n}\n\n// bUpdate = true;\n\nif (bUpdate){\n    context.set(device,timespan);\n    msgStart.payload.timespan = timespan;\n    return [ addValues,  msgStart ];\n}\n\n\n// outputMsgs.push({topic:msg.topic + '/' + topics[w], Wh: msg.Wh});",
                                 "outputs": 2,
                                 "noerr": 0,
                                 "initialize": "",
                                 "finalize": "",
                                 "libs": [],
                                 "x": 2690,
                                 "y": 860,
                                 "wires": [
                                     [
                                         "4b61812.853d08",
                                         "990a6d1c.e33ae"
                                     ],
                                     [
                                         "4cdfe1c1.22b5e",
                                         "fc7e7f82.b40bc"
                                     ]
                                 ],
                                 "outputLabels": [
                                     "add",
                                     "start"
                                 ]
                             },
                             {
                                 "id": "4cdfe1c1.22b5e",
                                 "type": "debug",
                                 "z": "2c7d577a.9b4378",
                                 "name": "start",
                                 "active": false,
                                 "tosidebar": true,
                                 "console": false,
                                 "tostatus": true,
                                 "complete": "true",
                                 "targetType": "full",
                                 "statusVal": "payload.timespan",
                                 "statusType": "msg",
                                 "x": 2890,
                                 "y": 980,
                                 "wires": []
                             },
                             {
                                 "id": "4b61812.853d08",
                                 "type": "ioBroker get",
                                 "z": "2c7d577a.9b4378",
                                 "name": "save value",
                                 "topic": "",
                                 "attrname": "set",
                                 "payloadType": "value",
                                 "x": 2890,
                                 "y": 820,
                                 "wires": [
                                     [
                                         "48de049c.55a6cc",
                                         "2f65897a.e15036"
                                     ]
                                 ]
                             },
                             {
                                 "id": "2f65897a.e15036",
                                 "type": "change",
                                 "z": "2c7d577a.9b4378",
                                 "name": "set previous",
                                 "rules": [
                                     {
                                         "t": "set",
                                         "p": "topic",
                                         "pt": "msg",
                                         "to": "newTopic",
                                         "tot": "msg"
                                     },
                                     {
                                         "t": "set",
                                         "p": "payload",
                                         "pt": "msg",
                                         "to": "set",
                                         "tot": "msg"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 3070,
                                 "y": 860,
                                 "wires": [
                                     [
                                         "d5922114.e3edb"
                                     ]
                                 ]
                             },
                             {
                                 "id": "d5922114.e3edb",
                                 "type": "ioBroker out",
                                 "z": "2c7d577a.9b4378",
                                 "name": "set previous period",
                                 "topic": "",
                                 "ack": "true",
                                 "autoCreate": "false",
                                 "stateName": "",
                                 "role": "",
                                 "payloadType": "",
                                 "readonly": "",
                                 "stateUnit": "",
                                 "stateMin": "",
                                 "stateMax": "",
                                 "x": 3280,
                                 "y": 860,
                                 "wires": []
                             },
                             {
                                 "id": "48de049c.55a6cc",
                                 "type": "ioBroker out",
                                 "z": "2c7d577a.9b4378",
                                 "name": "reset current period",
                                 "topic": "",
                                 "ack": "true",
                                 "autoCreate": "false",
                                 "stateName": "",
                                 "role": "",
                                 "payloadType": "",
                                 "readonly": "",
                                 "stateUnit": "",
                                 "stateMin": "",
                                 "stateMax": "",
                                 "x": 3090,
                                 "y": 800,
                                 "wires": []
                             },
                             {
                                 "id": "afcbed60.a3b52",
                                 "type": "ioBroker out",
                                 "z": "2c7d577a.9b4378",
                                 "name": "update start.timespan",
                                 "topic": "",
                                 "ack": "true",
                                 "autoCreate": "false",
                                 "stateName": "",
                                 "role": "",
                                 "payloadType": "",
                                 "readonly": "",
                                 "stateUnit": "",
                                 "stateMin": "",
                                 "stateMax": "",
                                 "x": 3080,
                                 "y": 920,
                                 "wires": []
                             },
                             {
                                 "id": "fc7e7f82.b40bc",
                                 "type": "json",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "property": "payload",
                                 "action": "",
                                 "pretty": false,
                                 "x": 2880,
                                 "y": 920,
                                 "wires": [
                                     [
                                         "afcbed60.a3b52"
                                     ]
                                 ]
                             },
                             {
                                 "id": "990a6d1c.e33ae",
                                 "type": "debug",
                                 "z": "2c7d577a.9b4378",
                                 "name": "add",
                                 "active": false,
                                 "tosidebar": true,
                                 "console": false,
                                 "tostatus": false,
                                 "complete": "payload",
                                 "targetType": "msg",
                                 "statusVal": "",
                                 "statusType": "auto",
                                 "x": 2870,
                                 "y": 760,
                                 "wires": []
                             },
                             {
                                 "id": "fc7f508d.c986d",
                                 "type": "debug",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "active": false,
                                 "tosidebar": true,
                                 "console": false,
                                 "tostatus": false,
                                 "complete": "true",
                                 "targetType": "full",
                                 "statusVal": "",
                                 "statusType": "auto",
                                 "x": 2670,
                                 "y": 800,
                                 "wires": []
                             },
                             {
                                 "id": "8e9e06fd.870a08",
                                 "type": "json",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "property": "payload",
                                 "action": "",
                                 "pretty": false,
                                 "x": 1730,
                                 "y": 780,
                                 "wires": [
                                     [
                                         "97f2d9d1.1420f8"
                                     ]
                                 ]
                             },
                             {
                                 "id": "107973e8.2fdc3c",
                                 "type": "switch",
                                 "z": "2c7d577a.9b4378",
                                 "name": "JSON string?",
                                 "property": "payload",
                                 "propertyType": "msg",
                                 "rules": [
                                     {
                                         "t": "istype",
                                         "v": "json",
                                         "vt": "json"
                                     }
                                 ],
                                 "checkall": "true",
                                 "repair": false,
                                 "outputs": 1,
                                 "x": 1570,
                                 "y": 780,
                                 "wires": [
                                     [
                                         "8e9e06fd.870a08"
                                     ]
                                 ]
                             },
                             {
                                 "id": "450761a2.575e",
                                 "type": "debug",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "active": false,
                                 "tosidebar": true,
                                 "console": false,
                                 "tostatus": false,
                                 "complete": "true",
                                 "targetType": "full",
                                 "statusVal": "",
                                 "statusType": "auto",
                                 "x": 1240,
                                 "y": 340,
                                 "wires": []
                             },
                             {
                                 "id": "13719db3.07a702",
                                 "type": "ioBroker in",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "topic": "0_userdata.0.stromverbrauch.*.*.reset",
                                 "payloadType": "value",
                                 "onlyack": "",
                                 "func": "all",
                                 "gap": "",
                                 "fireOnStart": "false",
                                 "x": 210,
                                 "y": 220,
                                 "wires": [
                                     [
                                         "80f66656.38dec8"
                                     ]
                                 ]
                             },
                             {
                                 "id": "7f7e5f9f.41f46",
                                 "type": "change",
                                 "z": "2c7d577a.9b4378",
                                 "name": "topic & device",
                                 "rules": [
                                     {
                                         "t": "change",
                                         "p": "topic",
                                         "pt": "msg",
                                         "from": "(.*)\\.use_time_date",
                                         "fromt": "re",
                                         "to": "$1",
                                         "tot": "str"
                                     },
                                     {
                                         "t": "set",
                                         "p": "device",
                                         "pt": "msg",
                                         "to": "topic",
                                         "tot": "msg"
                                     },
                                     {
                                         "t": "change",
                                         "p": "device",
                                         "pt": "msg",
                                         "from": ".*[\\.,\\/](.*)",
                                         "fromt": "re",
                                         "to": "$1",
                                         "tot": "str"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 2300,
                                 "y": 780,
                                 "wires": [
                                     [
                                         "453a7a8d.9c72f4"
                                     ]
                                 ]
                             },
                             {
                                 "id": "c208dc2e.5880a",
                                 "type": "ioBroker in",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "topic": "0_userdata.0.stromverbrauch.*.*.power",
                                 "payloadType": "value",
                                 "onlyack": "",
                                 "func": "all",
                                 "gap": "",
                                 "fireOnStart": "false",
                                 "x": 210,
                                 "y": 560,
                                 "wires": [
                                     [
                                         "729a31f7.1f0d"
                                     ]
                                 ]
                             },
                             {
                                 "id": "ec03eb7f.ecf038",
                                 "type": "ioBroker in",
                                 "z": "2c7d577a.9b4378",
                                 "name": "",
                                 "topic": "0_userdata.0.stromverbrauch.*.*.start",
                                 "payloadType": "value",
                                 "onlyack": "",
                                 "func": "all",
                                 "gap": "",
                                 "fireOnStart": "false",
                                 "x": 210,
                                 "y": 280,
                                 "wires": [
                                     [
                                         "cc6771bb.13f14"
                                     ]
                                 ]
                             }
                          ]
                          

                          Ich bin jetzt ja auch faul und nutze den sourceanlytics.

                          J 1 Reply Last reply Reply Quote 1
                          • J
                            Jonny 0 @mickym last edited by

                            @mickym

                            Der einfachste Weg wie oben angesprochen wurde war der zielführende.
                            Ich habe sogar festgestellt, das die Reset funktion nicht nötig ist.
                            Die WB stellt automatisch den Wert zurück und fängt um 0.00 Uhr neu mit zählen an.

                            Danke an alle.

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

                            Support us

                            ioBroker
                            Community Adapters
                            Donate

                            975
                            Online

                            31.6k
                            Users

                            79.4k
                            Topics

                            1.3m
                            Posts

                            4
                            54
                            1965
                            Loading More Posts
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes
                            Reply
                            • Reply as topic
                            Log in to reply
                            Community
                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                            The ioBroker Community 2014-2023
                            logo