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

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Tester
  4. Test PV Forecast Adapter

NEWS

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

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

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

Test PV Forecast Adapter

Geplant Angeheftet Gesperrt Verschoben Tester
forecastphotovoltaik
881 Beiträge 114 Kommentatoren 286.9k Aufrufe 108 Watching
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • DiginixD Diginix

    @Meistertr

    Heute morgen 1 Uhr hatte ich folgende Fehler im Log:

    2022-03-02 01:00:03.720 - warn: pvforecast.0 (1873535) State "pvforecast.0.1.everyhour_kw.00:30:00" has no existing object, this might lead to an error in future versions
    2022-03-02 01:00:03.724 - warn: pvforecast.0 (1873535) State "pvforecast.0.1.everyhour_kw.01:00:00" has no existing object, this might lead to an error in future versions
    2022-03-02 01:00:03.725 - warn: pvforecast.0 (1873535) State "pvforecast.0.1.everyhour_kw.01:30:00" has no existing object, this might lead to an error in future versions
    2022-03-02 01:00:03.725 - warn: pvforecast.0 (1873535) State "pvforecast.0.1.everyhour_kw.02:00:00" has no existing object, this might lead to an error in future versions
    2022-03-02 01:00:03.725 - warn: pvforecast.0 (1873535) State "pvforecast.0.1.everyhour_kw.02:30:00" has no existing object, this might lead to an error in future versions
    2022-03-02 01:00:03.726 - warn: pvforecast.0 (1873535) State "pvforecast.0.1.everyhour_kw.03:00:00" has no existing object, this might lead to an error in future versions
    2022-03-02 01:00:03.726 - warn: pvforecast.0 (1873535) State "pvforecast.0.1.everyhour_kw.03:30:00" has no existing object, this might lead to an error in future versions
    2022-03-02 01:00:03.726 - warn: pvforecast.0 (1873535) State "pvforecast.0.1.everyhour_kw.04:00:00" has no existing object, this might lead to an error in future versions
    2022-03-02 01:00:03.727 - warn: pvforecast.0 (1873535) State "pvforecast.0.1.everyhour_kw.04:30:00" has no existing object, this might lead to an error in future versions
    

    Die gleichen Meldungen kamen gestern nach der Erstinst. von 0.2.5. Da könnte ich es verstehen, aber täglich sollte das doch nicht passieren?
    Unterhalb von pvforecast.0.1.everyhour_kw fängt es aber auch erst mit 5 Uhr an.
    d2952aa4-e7d7-462c-89a3-68a90aff30a0-image.png

    MeistertrM Offline
    MeistertrM Offline
    Meistertr
    Developer
    schrieb am zuletzt editiert von
    #296

    @diginix fixed on git

    1 Antwort Letzte Antwort
    1
    • P PatrickWalther
      Test PV Forecast Adapter 0.2.5
      Veröffentlichungsdatum 01.03.2022
      Github Link https://github.com/iobroker-community-adapters/ioBroker.pvforecast

      Guten Tag,

      seit gestern gibt es die neue Version und der Adapter ist in der Iobroker community(bitte beachtet den neuen Link). Der Antrag für die offizielle Liste ist gestellt.

      Grüße
      Patrick

      DiginixD Offline
      DiginixD Offline
      Diginix
      schrieb am zuletzt editiert von
      #297

      @patrickwalther sagte in Test PV Forecast Adapter:

      Test PV Forecast Adapter 0.2.5
      Veröffentlichungsdatum 01.03.2022
      Github Link https://github.com/iobroker-community-adapters/ioBroker.pvforecast

      Guten Tag,

      seit gestern gibt es die neue Version und der Adapter ist in der Iobroker community(bitte beachtet den neuen Link). Der Antrag für die offizielle Liste ist gestellt.

      Grüße
      Patrick

      Bitte auch den Link im OP auf den offiziellen umstellen.

      ..:: So long! Tom ::..

      NUC7i3 (Ubuntu Proxmox VM) | Echo Dots 2+3. Gen | Xiaomi Sensoren | Mi Robot 1S | Yeelight | Sonoff | Shelly | H801 RGB | Gosund SP1 | NodeMCU+ESP32 | Kostal Plenticore PV+BYD | openWB

      P 1 Antwort Letzte Antwort
      0
      • DiginixD Diginix

        @patrickwalther sagte in Test PV Forecast Adapter:

        Test PV Forecast Adapter 0.2.5
        Veröffentlichungsdatum 01.03.2022
        Github Link https://github.com/iobroker-community-adapters/ioBroker.pvforecast

        Guten Tag,

        seit gestern gibt es die neue Version und der Adapter ist in der Iobroker community(bitte beachtet den neuen Link). Der Antrag für die offizielle Liste ist gestellt.

        Grüße
        Patrick

        Bitte auch den Link im OP auf den offiziellen umstellen.

        P Offline
        P Offline
        PatrickWalther
        Developer
        schrieb am zuletzt editiert von
        #298

        @diginix was meinst du mit OP?

        Erster Beitrag wurde geändert

        DiginixD 1 Antwort Letzte Antwort
        1
        • P PatrickWalther

          @diginix was meinst du mit OP?

          Erster Beitrag wurde geändert

          DiginixD Offline
          DiginixD Offline
          Diginix
          schrieb am zuletzt editiert von
          #299

          @patrickwalther sagte in Test PV Forecast Adapter:

          @diginix was meinst du mit OP?

          Opening Post. Passt. Danke!

          ..:: So long! Tom ::..

          NUC7i3 (Ubuntu Proxmox VM) | Echo Dots 2+3. Gen | Xiaomi Sensoren | Mi Robot 1S | Yeelight | Sonoff | Shelly | H801 RGB | Gosund SP1 | NodeMCU+ESP32 | Kostal Plenticore PV+BYD | openWB

          1 Antwort Letzte Antwort
          0
          • MeistertrM Meistertr

            @bastian-m das wäre möglich, aber im scipt würde ich sowieso den json datenpunkt nutzen weil er einfacher zu verarbeiten ist als die Objekte

            B Offline
            B Offline
            bastian-m
            schrieb am zuletzt editiert von
            #300

            @meistertr Wenn ich ernsthaft programmieren könnte bestimmt. ;-) Vielleicht hättet ihr trotzdem Lust das einzubauen, vielleicht ist es ja auch für andere in irgendeiner Form von Nutzen. Dürfte im Adaptercode ja nicht vieeeel mehr als ein bisschen Copy-Paste sein, oder?
            Patrick habe ich schonmal was gespendet, dir fehlt noch ein Donate-Link in deinem Github-Profil!

            DiginixD 1 Antwort Letzte Antwort
            0
            • B bastian-m

              @meistertr Wenn ich ernsthaft programmieren könnte bestimmt. ;-) Vielleicht hättet ihr trotzdem Lust das einzubauen, vielleicht ist es ja auch für andere in irgendeiner Form von Nutzen. Dürfte im Adaptercode ja nicht vieeeel mehr als ein bisschen Copy-Paste sein, oder?
              Patrick habe ich schonmal was gespendet, dir fehlt noch ein Donate-Link in deinem Github-Profil!

              DiginixD Offline
              DiginixD Offline
              Diginix
              schrieb am zuletzt editiert von
              #301

              @bastian-m Wie machst du denn jetzt den ganzen Vergleich in deinem Skript mit einer (unbekannten) Menge an Objekten?

              ..:: So long! Tom ::..

              NUC7i3 (Ubuntu Proxmox VM) | Echo Dots 2+3. Gen | Xiaomi Sensoren | Mi Robot 1S | Yeelight | Sonoff | Shelly | H801 RGB | Gosund SP1 | NodeMCU+ESP32 | Kostal Plenticore PV+BYD | openWB

              B 1 Antwort Letzte Antwort
              0
              • BananaJoeB Online
                BananaJoeB Online
                BananaJoe
                Most Active
                schrieb am zuletzt editiert von
                #302

                Frage zu e-Charts: Das bedingt das save to influxdv genutzt wird oder wie kann ich mir das vorstellen?

                Oder besser gesagt; kann mir das bitte jemand noch mal für ... stellen wir uns vor ich wäre 8 Jahre alt ... erklären?

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

                1 Antwort Letzte Antwort
                0
                • Bernd 0B Offline
                  Bernd 0B Offline
                  Bernd 0
                  schrieb am zuletzt editiert von
                  #303

                  Hallo zusammen,
                  erstmal vielen Dank @Meistertr für die Weiterentwicklung des Adapters.
                  Ich habe die Daten in der Vis dargestellt und was ich nicht ganz verstehe ist, dass ich bei Solcast meinen Power-Output über den Tag sehe. Maximal kann meine Anlage 9Kw und das Diagramm zeigt das sehr schön.

                  5cc23ef4-a724-4535-a187-820bcd8d065e-image.png

                  Die Daten, die ich vom Adapter erhalte kann ich nicht wirklich interpretieren.
                  Habe ich eine falsche Einstellung getätigt? Habe ich einen Denkfehler?

                  fd7d3cdb-5c9b-42a3-9b1a-49be3a475bf9-image.png

                  Es müssten doch eigentlich die gleichen Daten vom Adapter wie von der Solcast Page kommen, oder?

                  Danke und VG

                  1 Antwort Letzte Antwort
                  0
                  • Bernd 0B Offline
                    Bernd 0B Offline
                    Bernd 0
                    schrieb am zuletzt editiert von
                    #304

                    @bernd-0 Habe meinen "Fehler" gefunden. Ich habe den Azimuth von Solcast übernommen. Für den Adapter wird er aber anders berechnet.

                    1 Antwort Letzte Antwort
                    0
                    • DiginixD Offline
                      DiginixD Offline
                      Diginix
                      schrieb am zuletzt editiert von Diginix
                      #305

                      @Meistertr Da nun von solcast nur einmal 1 Uhr am Tag abgerufen wird, ist der Vorhersagewert für tomorrow im Laufe des Tages doch recht "veraltet". Wäre es denkbar/machbar nur diesen über den Tag verteilt noch weiter zu aktualisieren?
                      Oder ändert sich da bei solcast eh nichts bis zum Beginn des eigentlichen Tages?
                      Auf der solcast Seite bekomme ich über die API nur die Stundenwerte, aber habe nicht gefunden wo man den Gesamt Ertrag für heute und morgen sehen kann. Aktuell ist der Wert für morgen doch recht hoch und ich denke dass er heute im Laufe des Tages sicher schon nach unten korrigiert wäre, so denn die solcast API das hergibt.

                      Edit: Habe mir eben nochmal die Werte mit der vom Adapter verwendeten URL von solcast für morgen geholt und summiert und da kommt weiterhin der selbe Wert heraus wie der von 1 Uhr heute morgen. Also wird bei solcast tomorrow im Laufe des Tages anscheinend nicht weiter verfeinert sondert bleibt über den Tag fix.

                      ..:: So long! Tom ::..

                      NUC7i3 (Ubuntu Proxmox VM) | Echo Dots 2+3. Gen | Xiaomi Sensoren | Mi Robot 1S | Yeelight | Sonoff | Shelly | H801 RGB | Gosund SP1 | NodeMCU+ESP32 | Kostal Plenticore PV+BYD | openWB

                      MeistertrM 1 Antwort Letzte Antwort
                      0
                      • BananaJoeB Online
                        BananaJoeB Online
                        BananaJoe
                        Most Active
                        schrieb am zuletzt editiert von BananaJoe
                        #306

                        @PatrickWalther

                        So, es ist vollbracht. Zwar durch die Brust ins Auge, aber es läuft (nebenbei habe ich aber wieder einmal viel gelernt).

                        Ich habe nun die Vorhersage erfolgreich mit dem SQL-Adapter (und einer MySQL-Datenbank) und dem echarts-Adapter als Anzeige zum laufen bekommen:
                        65f1abc8-bf77-43da-9914-17be824c2dcb-image.png
                        gelb ist meine echte Tagesleistung, rot die aus diesem Adapter (auch wenn ich hier Äpfel mit Birnen vergleiche, gelb sind W und rot Wh, daran mache ich mich als nächstes).

                        Als Vorrausetzung nehme ich einen installierten und funktionsfähigen SQL-Adapter an.
                        Außerdem habt Ihr den pvforecast Adapter konfiguriert und am laufen so das es einen Datenpunkt mit der Vorhersage gibt. Meine Lösung nutzt den Datenpunkt JSONTable der Anlage. Meine Anlage heißt 600W und der Datenpunkt also

                        pvforecast.0.600W.JSONTable
                        

                        ###################################################################

                        Schritt 1: Datenpunkt erstellen, konfigurieren und initialisieren
                        Es braucht einen Datenpunkt der Daten hält, ich habe hier diesen erstellt:

                        0_userdata.0.Solaranlage.pvforecast
                        

                        Als Typ Number bzw. Nummer
                        Dann habe ich ich SQL für den Datenpunkt eingeschaltet:
                        ed032325-be5e-40ed-afdb-2da83d0824a2-image.png
                        Entprellzeit auf 0 da die Daten in einem rutsch geschrieben werden

                        Nun ist es wichtig im Objekte Explorer dort einmal einen Wert von Hand reinzuschreiben, z.B. eine 42:
                        97f71f6a-a0a7-4718-86cd-199ad63c96e5-image.png
                        Erst dann ist der Datenpunkt in der SQL-Datenbank auch angelegt. Das hat mich die ersten bestimmt 20 Minuten nerven gekostet bis ich darauf gekommen bin. Solange funktioniert nämlich das SendTo noch nicht.

                        Schritt 2: Das Blockly Skript
                        Ja ja, ich dachte ich könnte das mal eben mit Blockly zusammenklicken statt es direkt in JavaScript zu schreiben. Mach ich vielleicht noch. Nun ist es Blockly mit 3 JavaScript Funktionen weil der SendTo Block einfach nicht zu überreden war das ganze vernünftig zu senden.

                        Im Spoiler der Blockly-Export

                        <xml xmlns="https://developers.google.com/blockly/xml">
                         <variables>
                           <variable id="xr?C%:}F%HR,+baC%W8n">x</variable>
                           <variable id="d/.bOP=7VlC5/[+=8g/u">myVAL</variable>
                           <variable id="SL$d6/`ClO6iqfefh5LN">myTS</variable>
                           <variable id="B$n_|Lt?V?dltG$1=%U!">JSONTable</variable>
                           <variable id="zqSSt1.lPBrP!prtJp:[">JSONListe</variable>
                           <variable id="[,noZ+!#R([v)Vli[JAC">counter</variable>
                           <variable id="9[xS=sH).DKBS8oGN@cs">i</variable>
                           <variable id="tkH#qcE=H5/_7~OttW5(">tempDatum</variable>
                           <variable id="f=MX5bxXCe`#`$z~HXcG">tempLeistung</variable>
                         </variables>
                         <block type="procedures_defcustomreturn" id="f5+e$i!@hdFdP7[JA1^`" x="288" y="-212">
                           <mutation statements="false">
                             <arg name="x" varid="xr?C%:}F%HR,+baC%W8n"></arg>
                           </mutation>
                           <field name="NAME">ReplaceHyphen</field>
                           <field name="SCRIPT">cmV0dXJuIHgucmVwbGFjZSgiLy0vZyIsIi4iKTs=</field>
                           <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                         </block>
                         <block type="procedures_defcustomnoreturn" id="W?BjTQs!pguWw4HPwT)p" x="287" y="-162">
                           <mutation statements="false">
                             <arg name="myVAL" varid="d/.bOP=7VlC5/[+=8g/u"></arg>
                             <arg name="myTS" varid="SL$d6/`ClO6iqfefh5LN"></arg>
                           </mutation>
                           <field name="NAME">SendTo_SQL_storeState</field>
                           <field name="SCRIPT">Ly8gVW5kIHdlcnQgZXJzdGVsbGVuIHdpZSBnZXBsYW50DQpzZW5kVG8oInNxbC4wIiwgInN0b3JlU3RhdGUiLCB7DQogICAgImlkIjogJzBfdXNlcmRhdGEuMC5Tb2xhcmFubGFnZS5wdmZvcmVjYXN0JywNCiAgICAic3RhdGUiOiB7IA0KICAgICAgICAidmFsIjogbXlWQUwsIA0KICAgICAgICAidHMiOiBteVRTLA0KICAgICAgICAiYWNrIjogdHJ1ZQ0KICAgIH0NCn0sIGFzeW5jIGZ1bmN0aW9uIChyZXN1bHQpIHsNCiAgICBjb25zb2xlLmxvZyhyZXN1bHQpOw0KfSk7</field>
                           <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                         </block>
                         <block type="procedures_defcustomnoreturn" id="m.]d6DR4hIR|rhM`P3KU" x="288" y="-112">
                           <mutation statements="false"></mutation>
                           <field name="NAME">SendTo_SQL_deleteAll</field>
                           <field name="SCRIPT">Ly8gQWxsZXMgbMO2c2NoZW4NCnNlbmRUbygic3FsLjAiLCAiZGVsZXRlQWxsIiwgew0KICAgICJpZCI6ICcwX3VzZXJkYXRhLjAuU29sYXJhbmxhZ2UucHZmb3JlY2FzdCcsDQp9LCBhc3luYyBmdW5jdGlvbiAocmVzdWx0KSB7DQogICAgICBjb25zb2xlLmxvZyhyZXN1bHQpOw0KfSk7DQo=</field>
                           <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                         </block>
                         <block type="comment" id="emF90N[xA].w:e$0a5`A" x="288" y="-62">
                           <field name="COMMENT">Trigger auf den Datenpunkt JSONTable der</field>
                           <next>
                             <block type="comment" id="v|g5R@PBSlfR{}gqtWR1">
                               <field name="COMMENT">gewünschten Anlage</field>
                               <next>
                                 <block type="on_ext" id="2}81gNSPn48mxt-C32N3">
                                   <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
                                   <field name="CONDITION">ne</field>
                                   <field name="ACK_CONDITION"></field>
                                   <value name="OID0">
                                     <shadow type="field_oid" id="$fUC/kgh^7[pBZjds,[N">
                                       <field name="oid">default</field>
                                     </shadow>
                                     <block type="text" id="Q~[~L7`?jff9w0!|{R!~">
                                       <field name="TEXT">pvforecast.0.600W.JSONTable</field>
                                     </block>
                                   </value>
                                   <statement name="STATEMENT">
                                     <block type="comment" id="xipk,Q4m/$Zbq(9xP]N;">
                                       <field name="COMMENT">Den JSON in eine Variable als Objekt holen</field>
                                       <next>
                                         <block type="variables_set" id="9le8nB_}E+{=^zh:Futa" disabled="true">
                                           <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field>
                                           <value name="VALUE">
                                             <block type="convert_json2object" id="C^`)6e!W4atd.!+{(i`D">
                                               <value name="VALUE">
                                                 <block type="get_value_var" id="CX?q]Gc8j[Ks2F4.yc=c">
                                                   <field name="ATTR">val</field>
                                                   <value name="OID">
                                                     <shadow type="text" id="Y:eexHcUNi5aP`=sh5_;">
                                                       <field name="TEXT"></field>
                                                     </shadow>
                                                     <block type="text" id="2yV92%k{c@aR$t@FV|VK">
                                                       <field name="TEXT">pvforecast.0.600W.JSONTable</field>
                                                     </block>
                                                   </value>
                                                 </block>
                                               </value>
                                             </block>
                                           </value>
                                           <next>
                                             <block type="variables_set" id="y:J|yOI69aKr_]e}X})q">
                                               <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field>
                                               <value name="VALUE">
                                                 <block type="on_source" id="GDRdyJ%YUi4U{P:xhe%L">
                                                   <field name="ATTR">state.val</field>
                                                 </block>
                                               </value>
                                               <next>
                                                 <block type="comment" id="78{/(q^zo:Vm3)}YeMKs">
                                                   <field name="COMMENT">Den JSON nochmal als Liste</field>
                                                   <next>
                                                     <block type="variables_set" id="$C:;|F_ENe?Kc{f9E*tE" disabled="true">
                                                       <field name="VAR" id="zqSSt1.lPBrP!prtJp:[">JSONListe</field>
                                                       <value name="VALUE">
                                                         <block type="lists_split" id=":4[[9BsVwSu-#SFS/qp#">
                                                           <mutation mode="SPLIT"></mutation>
                                                           <field name="MODE">SPLIT</field>
                                                           <value name="INPUT">
                                                             <block type="get_value_var" id="k${_LxJlQ~Jc%^8mQ;J3">
                                                               <field name="ATTR">val</field>
                                                               <value name="OID">
                                                                 <shadow type="text">
                                                                   <field name="TEXT"></field>
                                                                 </shadow>
                                                                 <block type="text" id="@(LLEO9DcZC_107PY7e;">
                                                                   <field name="TEXT">pvforecast.0.600W.JSONTable</field>
                                                                 </block>
                                                               </value>
                                                             </block>
                                                           </value>
                                                           <value name="DELIM">
                                                             <shadow type="text" id="_=ir)--C~K.5!,@3!%@4">
                                                               <field name="TEXT">},</field>
                                                             </shadow>
                                                           </value>
                                                         </block>
                                                       </value>
                                                       <next>
                                                         <block type="variables_set" id="KTHIaej{MV5TTxsehu:h">
                                                           <field name="VAR" id="zqSSt1.lPBrP!prtJp:[">JSONListe</field>
                                                           <value name="VALUE">
                                                             <block type="lists_split" id="`#[tp]8]y!L^LEp8OL)J">
                                                               <mutation mode="SPLIT"></mutation>
                                                               <field name="MODE">SPLIT</field>
                                                               <value name="INPUT">
                                                                 <block type="on_source" id="c),q`)7dZyX)GtW;Oe0Y">
                                                                   <field name="ATTR">state.val</field>
                                                                 </block>
                                                               </value>
                                                               <value name="DELIM">
                                                                 <shadow type="text" id="koPJuBu/Hm/D7+[$DR$`">
                                                                   <field name="TEXT">},{</field>
                                                                 </shadow>
                                                               </value>
                                                             </block>
                                                           </value>
                                                           <next>
                                                             <block type="comment" id="_dDWRwqorhv|K4r20+CF">
                                                               <field name="COMMENT">Zähler für die einzelnen Werte</field>
                                                               <next>
                                                                 <block type="variables_set" id="w[HNQFZ(pKC;(LonsppG">
                                                                   <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field>
                                                                   <value name="VALUE">
                                                                     <block type="math_number" id="$YD#)Z6].!0wU8:!IFY-">
                                                                       <field name="NUM">-1</field>
                                                                     </block>
                                                                   </value>
                                                                   <next>
                                                                     <block type="comment" id="nON/.IM*.X5L7BSfqn.j">
                                                                       <field name="COMMENT">Vorherige Werte löschen</field>
                                                                       <next>
                                                                         <block type="procedures_callcustomnoreturn" id="MjjlAd,#02dH9;[91A:e">
                                                                           <mutation name="SendTo_SQL_deleteAll"></mutation>
                                                                           <next>
                                                                             <block type="comment" id="+UxP]UFX*K*Ay8@+.3D(">
                                                                               <field name="COMMENT">Kurz warten ...</field>
                                                                               <next>
                                                                                 <block type="timeouts_wait" id="b#[5BCU4#vD.+@RIgxwr">
                                                                                   <field name="DELAY">2</field>
                                                                                   <field name="UNIT">sec</field>
                                                                                   <next>
                                                                                     <block type="comment" id="?qlG@bV1nj7K%h8?`S-h">
                                                                                       <field name="COMMENT">Die Werte abarbeiten:</field>
                                                                                       <next>
                                                                                         <block type="controls_forEach" id="sZ%NhNSxC10sAg@O]Kz6">
                                                                                           <field name="VAR" id="9[xS=sH).DKBS8oGN@cs">i</field>
                                                                                           <value name="LIST">
                                                                                             <block type="variables_get" id="psB3RQ42dmHy[=aKrs!2">
                                                                                               <field name="VAR" id="zqSSt1.lPBrP!prtJp:[">JSONListe</field>
                                                                                             </block>
                                                                                           </value>
                                                                                           <statement name="DO">
                                                                                             <block type="comment" id="0i?Xu2@hUv,g4?;i5Fhl">
                                                                                               <field name="COMMENT">Wird beim ersten mal 0 sein</field>
                                                                                               <next>
                                                                                                 <block type="math_change" id="liet[5#L@~`I]t{8:/Es">
                                                                                                   <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field>
                                                                                                   <value name="DELTA">
                                                                                                     <shadow type="math_number" id="986qLvCF[J2VK^no0@Rp">
                                                                                                       <field name="NUM">1</field>
                                                                                                     </shadow>
                                                                                                   </value>
                                                                                                   <next>
                                                                                                     <block type="comment" id="}fPI/Q;fVu7V-uYuX2I+">
                                                                                                       <field name="COMMENT">Wir arbeiten die Liste ab, nutzen aber das Objekt!</field>
                                                                                                       <next>
                                                                                                         <block type="variables_set" id="^w);@i_kdtjWWf?c}BcO">
                                                                                                           <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                           <value name="VALUE">
                                                                                                             <block type="get_attr" id="jTRbW_-wI4-}.!,5V(VJ">
                                                                                                               <value name="PATH">
                                                                                                                 <shadow type="text" id="3r`W9/~ToEj{Abx:)agx">
                                                                                                                   <field name="TEXT"></field>
                                                                                                                 </shadow>
                                                                                                                 <block type="text_join" id="xoFmSb~Y+xnD;cvM|g;-">
                                                                                                                   <mutation items="2"></mutation>
                                                                                                                   <value name="ADD0">
                                                                                                                     <block type="variables_get" id="K9;4LQ$1S/`at#YY52.j">
                                                                                                                       <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field>
                                                                                                                     </block>
                                                                                                                   </value>
                                                                                                                   <value name="ADD1">
                                                                                                                     <block type="text" id="Kkt8qVr.ykp~NV;@{Uas">
                                                                                                                       <field name="TEXT">.Uhrzeit</field>
                                                                                                                     </block>
                                                                                                                   </value>
                                                                                                                 </block>
                                                                                                               </value>
                                                                                                               <value name="OBJECT">
                                                                                                                 <block type="variables_get" id="`-rw74I`kqylUWgeH*+(">
                                                                                                                   <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field>
                                                                                                                 </block>
                                                                                                               </value>
                                                                                                             </block>
                                                                                                           </value>
                                                                                                           <next>
                                                                                                             <block type="comment" id="b?]P+H9BwqfkDRv$/:j(">
                                                                                                               <field name="COMMENT">Die - in . umwandeln</field>
                                                                                                               <next>
                                                                                                                 <block type="variables_set" id="k@v15A-cYpf/vbpRa;_z">
                                                                                                                   <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                   <value name="VALUE">
                                                                                                                     <block type="procedures_callcustomreturn" id="p[kw(;yI)pXBjjzD#D)~">
                                                                                                                       <mutation name="ReplaceHyphen">
                                                                                                                         <arg name="x"></arg>
                                                                                                                       </mutation>
                                                                                                                       <value name="ARG0">
                                                                                                                         <block type="variables_get" id="N)h=(1TR`.9#96=m?A0Y">
                                                                                                                           <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                         </block>
                                                                                                                       </value>
                                                                                                                     </block>
                                                                                                                   </value>
                                                                                                                   <next>
                                                                                                                     <block type="comment" id="I-6Pjzc2in5fU|/L@xLT">
                                                                                                                       <field name="COMMENT">In ein Datum-Objekt umwandeln</field>
                                                                                                                       <next>
                                                                                                                         <block type="variables_set" id="FsILBORsaLrrazBi1L)J">
                                                                                                                           <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                           <value name="VALUE">
                                                                                                                             <block type="convert_from_date" id="4bbw}ZJhpHe}e.*nJ0`M">
                                                                                                                               <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                                                                                               <field name="OPTION">object</field>
                                                                                                                               <value name="VALUE">
                                                                                                                                 <block type="variables_get" id="RjC;=Ac;nPHFrHCNt$SG">
                                                                                                                                   <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                                 </block>
                                                                                                                               </value>
                                                                                                                             </block>
                                                                                                                           </value>
                                                                                                                           <next>
                                                                                                                             <block type="comment" id="?/.AjS+{19mE_EhC6?{%">
                                                                                                                               <field name="COMMENT">Die Leistung holen (hier in Wh statt kWh)</field>
                                                                                                                               <next>
                                                                                                                                 <block type="variables_set" id="7$e1=Z.||tt-}b}$`QUX">
                                                                                                                                   <field name="VAR" id="f=MX5bxXCe`#`$z~HXcG">tempLeistung</field>
                                                                                                                                   <value name="VALUE">
                                                                                                                                     <block type="math_arithmetic" id="czVYE)d?^hj;sB8tQW%c" inline="false">
                                                                                                                                       <field name="OP">MULTIPLY</field>
                                                                                                                                       <value name="A">
                                                                                                                                         <shadow type="math_number" id="QXXI#nb51thU(gYujO7l">
                                                                                                                                           <field name="NUM">1</field>
                                                                                                                                         </shadow>
                                                                                                                                         <block type="get_attr" id="!p(Q2{*u/U@(LdLaWO;s">
                                                                                                                                           <value name="PATH">
                                                                                                                                             <shadow type="text">
                                                                                                                                               <field name="TEXT"></field>
                                                                                                                                             </shadow>
                                                                                                                                             <block type="text_join" id="eO+Kc@J#5ncJexgCa;XG">
                                                                                                                                               <mutation items="2"></mutation>
                                                                                                                                               <value name="ADD0">
                                                                                                                                                 <block type="variables_get" id="6h@/w;v+5fJ:2k^fRu$`">
                                                                                                                                                   <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field>
                                                                                                                                                 </block>
                                                                                                                                               </value>
                                                                                                                                               <value name="ADD1">
                                                                                                                                                 <block type="text" id="u;lW,EMq1lo;0wl@^s~Z">
                                                                                                                                                   <field name="TEXT">.Leistung</field>
                                                                                                                                                 </block>
                                                                                                                                               </value>
                                                                                                                                             </block>
                                                                                                                                           </value>
                                                                                                                                           <value name="OBJECT">
                                                                                                                                             <block type="variables_get" id=":wC%m_*5#kUmjSCtRht*">
                                                                                                                                               <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field>
                                                                                                                                             </block>
                                                                                                                                           </value>
                                                                                                                                         </block>
                                                                                                                                       </value>
                                                                                                                                       <value name="B">
                                                                                                                                         <shadow type="math_number" id=".oUR!B4y8;}kLXv3HYVD">
                                                                                                                                           <field name="NUM">1000</field>
                                                                                                                                         </shadow>
                                                                                                                                       </value>
                                                                                                                                     </block>
                                                                                                                                   </value>
                                                                                                                                   <next>
                                                                                                                                     <block type="comment" id=".r}c.6$[JDf=.|#00pZj">
                                                                                                                                       <field name="COMMENT">Und in die Datenbank schreiben</field>
                                                                                                                                       <next>
                                                                                                                                         <block type="procedures_callcustomnoreturn" id="C,/_Emb0_,HXS0:;0?Cb">
                                                                                                                                           <mutation name="SendTo_SQL_storeState">
                                                                                                                                             <arg name="myVAL"></arg>
                                                                                                                                             <arg name="myTS"></arg>
                                                                                                                                           </mutation>
                                                                                                                                           <value name="ARG0">
                                                                                                                                             <block type="variables_get" id="ZX``,0~qVZ*H;d75IT!S">
                                                                                                                                               <field name="VAR" id="f=MX5bxXCe`#`$z~HXcG">tempLeistung</field>
                                                                                                                                             </block>
                                                                                                                                           </value>
                                                                                                                                           <value name="ARG1">
                                                                                                                                             <block type="variables_get" id="2rC,dvFPd3*_,1)EOdkN">
                                                                                                                                               <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                                             </block>
                                                                                                                                           </value>
                                                                                                                                         </block>
                                                                                                                                       </next>
                                                                                                                                     </block>
                                                                                                                                   </next>
                                                                                                                                 </block>
                                                                                                                               </next>
                                                                                                                             </block>
                                                                                                                           </next>
                                                                                                                         </block>
                                                                                                                       </next>
                                                                                                                     </block>
                                                                                                                   </next>
                                                                                                                 </block>
                                                                                                               </next>
                                                                                                             </block>
                                                                                                           </next>
                                                                                                         </block>
                                                                                                       </next>
                                                                                                     </block>
                                                                                                   </next>
                                                                                                 </block>
                                                                                               </next>
                                                                                             </block>
                                                                                           </statement>
                                                                                         </block>
                                                                                       </next>
                                                                                     </block>
                                                                                   </next>
                                                                                 </block>
                                                                               </next>
                                                                             </block>
                                                                           </next>
                                                                         </block>
                                                                       </next>
                                                                     </block>
                                                                   </next>
                                                                 </block>
                                                               </next>
                                                             </block>
                                                           </next>
                                                         </block>
                                                       </next>
                                                     </block>
                                                   </next>
                                                 </block>
                                               </next>
                                             </block>
                                           </next>
                                         </block>
                                       </next>
                                     </block>
                                   </statement>
                                 </block>
                               </next>
                             </block>
                           </next>
                         </block>
                        </xml>
                        

                        Anpassen müsst Ihr:

                        In der JavaScript-Funktion SendTo_SQL_storeState den Namen des Ziel-Datenpunktes:
                        40558805-14b2-4080-9681-84d67524a428-image.png
                        gelb markiert:
                        84a72c5c-f34e-4793-8174-a9eb2ee5e8ad-image.png

                        Das gleiche in der JavaScript-Funktion SendTo_SQL_DeleteAll
                        91c29379-c885-4fef-b5b4-c710f95d35ff-image.png

                        Und im Kopf den Quellpfad zu eurer Anlage:
                        46235a8d-a6ad-44ff-8668-09fe532644d5-image.png

                        Und ob Ihr es in kWh oder Wh haben wollt:
                        cdba127d-a976-408f-a313-22f6ba0d77e3-image.png
                        (die x 1000 entfernen oder durch 1 Ersetzen bei kWh)

                        Wenn Ihr das Skript startet passiert erst einmal nichts. Erst wenn neue Daten reinkämen.
                        Zum Testen könntet Ihr

                        • Im Trigger von wurde geändert auf wurde aktualisiert ändern
                        • den pvforecast Adapter einmal neu starten. Zumindest bei mir holt er dann sofort einmal neue Daten

                        und schon hat er uns die Werte schön in die Datenbank geschrieben:

                        MariaDB [iobroker]> select * from ts_number where id = '95';
                        +----+---------------+------+------+-------+------+
                        | id | ts            | val  | ack  | _from | q    |
                        +----+---------------+------+------+-------+------+
                        | 95 | 1646287082001 |    0 |    1 |     0 |    0 |
                        | 95 | 1646288940000 |   29 |    1 |     0 |    0 |
                        | 95 | 1646290802000 |  146 |    1 |     0 |    0 |
                        | 95 | 1646294400000 |  247 |    1 |     0 |    0 |
                        | 95 | 1646298000000 |  377 |    1 |     0 |    0 |
                        | 95 | 1646301600000 |  422 |    1 |     0 |    0 |
                        | 95 | 1646305200000 |  428 |    1 |     0 |    0 |
                        | 95 | 1646308800000 |  383 |    1 |     0 |    0 |
                        | 95 | 1646312400000 |  317 |    1 |     0 |    0 |
                        | 95 | 1646316000000 |  222 |    1 |     0 |    0 |
                        | 95 | 1646319600000 |  113 |    1 |     0 |    0 |
                        | 95 | 1646323200000 |   34 |    1 |     0 |    0 |
                        | 95 | 1646326800000 |    8 |    1 |     0 |    0 |
                        | 95 | 1646327160000 |    2 |    1 |     0 |    0 |
                        | 95 | 1646327460000 |    0 |    1 |     0 |    0 |
                        | 95 | 1646373360000 |    0 |    1 |     0 |    0 |
                        | 95 | 1646375280000 |   36 |    1 |     0 |    0 |
                        | 95 | 1646377200000 |  180 |    1 |     0 |    0 |
                        | 95 | 1646380800000 |  284 |    1 |     0 |    0 |
                        | 95 | 1646384400000 |  360 |    1 |     0 |    0 |
                        | 95 | 1646388000000 |  401 |    1 |     0 |    0 |
                        | 95 | 1646391600000 |  406 |    1 |     0 |    0 |
                        | 95 | 1646395200000 |  372 |    1 |     0 |    0 |
                        | 95 | 1646398800000 |  310 |    1 |     0 |    0 |
                        | 95 | 1646402400000 |  218 |    1 |     0 |    0 |
                        | 95 | 1646406000000 |  114 |    1 |     0 |    0 |
                        | 95 | 1646409600000 |   35 |    1 |     0 |    0 |
                        | 95 | 1646413200000 |    8 |    1 |     0 |    0 |
                        | 95 | 1646413620000 |    2 |    1 |     0 |    0 |
                        | 95 | 1646413980000 |    0 |    1 |     0 |    0 |
                        +----+---------------+------+------+-------+------+
                        30 rows in set (0.001 sec)
                        
                        

                        Die kann man jetzt in echarts etc. verwenden.

                        Woran ich noch verzweifle:

                        // Alles löschen
                        sendTo("sql.0", "deleteAll", {
                            "id": '0_userdata.0.Solaranlage.pvforecast',
                        }, async function (result) {
                              console.log(result);
                        });
                        

                        Wie schaffe ich es auch den Wert von id als Variable zu übergeben?
                        Daran habe ich nämlich 90% der Zeit gesessen. Zuerst habe ich es vergeblich mit dem Blockly-SendTo Block versucht (aber der hat es immer falsch formatiert gesendet) und dann wie ich die festen Werte durch Variablen ersetze.

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

                        P sonnenscheinS 3 Antworten Letzte Antwort
                        3
                        • DiginixD Diginix

                          @Meistertr Da nun von solcast nur einmal 1 Uhr am Tag abgerufen wird, ist der Vorhersagewert für tomorrow im Laufe des Tages doch recht "veraltet". Wäre es denkbar/machbar nur diesen über den Tag verteilt noch weiter zu aktualisieren?
                          Oder ändert sich da bei solcast eh nichts bis zum Beginn des eigentlichen Tages?
                          Auf der solcast Seite bekomme ich über die API nur die Stundenwerte, aber habe nicht gefunden wo man den Gesamt Ertrag für heute und morgen sehen kann. Aktuell ist der Wert für morgen doch recht hoch und ich denke dass er heute im Laufe des Tages sicher schon nach unten korrigiert wäre, so denn die solcast API das hergibt.

                          Edit: Habe mir eben nochmal die Werte mit der vom Adapter verwendeten URL von solcast für morgen geholt und summiert und da kommt weiterhin der selbe Wert heraus wie der von 1 Uhr heute morgen. Also wird bei solcast tomorrow im Laufe des Tages anscheinend nicht weiter verfeinert sondert bleibt über den Tag fix.

                          MeistertrM Offline
                          MeistertrM Offline
                          Meistertr
                          Developer
                          schrieb am zuletzt editiert von
                          #307

                          @diginix schau ich mir heute mal an, ist mir auch schon aufgefallen, dass da irgendwas nicht stimmt

                          DiginixD 1 Antwort Letzte Antwort
                          0
                          • MeistertrM Meistertr

                            @diginix schau ich mir heute mal an, ist mir auch schon aufgefallen, dass da irgendwas nicht stimmt

                            DiginixD Offline
                            DiginixD Offline
                            Diginix
                            schrieb am zuletzt editiert von Diginix
                            #308

                            @meistertr Gestern war ab 1 Uhr die Prognose für heute 36 kWh, aber auch mit den solcast Werten von gestern Abend 20 Uhr ergab sich summiert 36 kWh für heute. Heute morgen 1 Uhr ist der Wert dann auf 26 kWh reduziert worden.
                            Real erwarte ich heute keine 10 kWh. Die Prognose vom Plenticore Adapter waren gestern 7 Uhr schon nur 13 kWh für heute und heute 7 Uhr dann nur noch 8 kWh. Was auch immer @StrathCole da für wahnsinnige Formeln gebaut hat, sie passen für tomorrow deutlich besser.

                            @bastian-m Mit derart daneben liegenden Vorhersagen für tomorrow ist eine Entscheidung ob ein Verbraucher heute oder besser morgen läuft komplett sinnlos. Die Werte für den aktuellen Tag mögen z.T. noch ok sein, aber mit denen des Folgetages braucht man nicht ins Rennen gehen.

                            Edit: Für morgen sagt solcast 49 kWh und Strathcoles Berechnung 13 kWh.

                            ..:: So long! Tom ::..

                            NUC7i3 (Ubuntu Proxmox VM) | Echo Dots 2+3. Gen | Xiaomi Sensoren | Mi Robot 1S | Yeelight | Sonoff | Shelly | H801 RGB | Gosund SP1 | NodeMCU+ESP32 | Kostal Plenticore PV+BYD | openWB

                            P 1 Antwort Letzte Antwort
                            0
                            • DiginixD Diginix

                              @meistertr Gestern war ab 1 Uhr die Prognose für heute 36 kWh, aber auch mit den solcast Werten von gestern Abend 20 Uhr ergab sich summiert 36 kWh für heute. Heute morgen 1 Uhr ist der Wert dann auf 26 kWh reduziert worden.
                              Real erwarte ich heute keine 10 kWh. Die Prognose vom Plenticore Adapter waren gestern 7 Uhr schon nur 13 kWh für heute und heute 7 Uhr dann nur noch 8 kWh. Was auch immer @StrathCole da für wahnsinnige Formeln gebaut hat, sie passen für tomorrow deutlich besser.

                              @bastian-m Mit derart daneben liegenden Vorhersagen für tomorrow ist eine Entscheidung ob ein Verbraucher heute oder besser morgen läuft komplett sinnlos. Die Werte für den aktuellen Tag mögen z.T. noch ok sein, aber mit denen des Folgetages braucht man nicht ins Rennen gehen.

                              Edit: Für morgen sagt solcast 49 kWh und Strathcoles Berechnung 13 kWh.

                              P Offline
                              P Offline
                              PatrickWalther
                              Developer
                              schrieb am zuletzt editiert von
                              #309

                              @diginix welche Formel? Hast du einen Link?

                              DiginixD 1 Antwort Letzte Antwort
                              0
                              • BananaJoeB BananaJoe

                                @PatrickWalther

                                So, es ist vollbracht. Zwar durch die Brust ins Auge, aber es läuft (nebenbei habe ich aber wieder einmal viel gelernt).

                                Ich habe nun die Vorhersage erfolgreich mit dem SQL-Adapter (und einer MySQL-Datenbank) und dem echarts-Adapter als Anzeige zum laufen bekommen:
                                65f1abc8-bf77-43da-9914-17be824c2dcb-image.png
                                gelb ist meine echte Tagesleistung, rot die aus diesem Adapter (auch wenn ich hier Äpfel mit Birnen vergleiche, gelb sind W und rot Wh, daran mache ich mich als nächstes).

                                Als Vorrausetzung nehme ich einen installierten und funktionsfähigen SQL-Adapter an.
                                Außerdem habt Ihr den pvforecast Adapter konfiguriert und am laufen so das es einen Datenpunkt mit der Vorhersage gibt. Meine Lösung nutzt den Datenpunkt JSONTable der Anlage. Meine Anlage heißt 600W und der Datenpunkt also

                                pvforecast.0.600W.JSONTable
                                

                                ###################################################################

                                Schritt 1: Datenpunkt erstellen, konfigurieren und initialisieren
                                Es braucht einen Datenpunkt der Daten hält, ich habe hier diesen erstellt:

                                0_userdata.0.Solaranlage.pvforecast
                                

                                Als Typ Number bzw. Nummer
                                Dann habe ich ich SQL für den Datenpunkt eingeschaltet:
                                ed032325-be5e-40ed-afdb-2da83d0824a2-image.png
                                Entprellzeit auf 0 da die Daten in einem rutsch geschrieben werden

                                Nun ist es wichtig im Objekte Explorer dort einmal einen Wert von Hand reinzuschreiben, z.B. eine 42:
                                97f71f6a-a0a7-4718-86cd-199ad63c96e5-image.png
                                Erst dann ist der Datenpunkt in der SQL-Datenbank auch angelegt. Das hat mich die ersten bestimmt 20 Minuten nerven gekostet bis ich darauf gekommen bin. Solange funktioniert nämlich das SendTo noch nicht.

                                Schritt 2: Das Blockly Skript
                                Ja ja, ich dachte ich könnte das mal eben mit Blockly zusammenklicken statt es direkt in JavaScript zu schreiben. Mach ich vielleicht noch. Nun ist es Blockly mit 3 JavaScript Funktionen weil der SendTo Block einfach nicht zu überreden war das ganze vernünftig zu senden.

                                Im Spoiler der Blockly-Export

                                <xml xmlns="https://developers.google.com/blockly/xml">
                                 <variables>
                                   <variable id="xr?C%:}F%HR,+baC%W8n">x</variable>
                                   <variable id="d/.bOP=7VlC5/[+=8g/u">myVAL</variable>
                                   <variable id="SL$d6/`ClO6iqfefh5LN">myTS</variable>
                                   <variable id="B$n_|Lt?V?dltG$1=%U!">JSONTable</variable>
                                   <variable id="zqSSt1.lPBrP!prtJp:[">JSONListe</variable>
                                   <variable id="[,noZ+!#R([v)Vli[JAC">counter</variable>
                                   <variable id="9[xS=sH).DKBS8oGN@cs">i</variable>
                                   <variable id="tkH#qcE=H5/_7~OttW5(">tempDatum</variable>
                                   <variable id="f=MX5bxXCe`#`$z~HXcG">tempLeistung</variable>
                                 </variables>
                                 <block type="procedures_defcustomreturn" id="f5+e$i!@hdFdP7[JA1^`" x="288" y="-212">
                                   <mutation statements="false">
                                     <arg name="x" varid="xr?C%:}F%HR,+baC%W8n"></arg>
                                   </mutation>
                                   <field name="NAME">ReplaceHyphen</field>
                                   <field name="SCRIPT">cmV0dXJuIHgucmVwbGFjZSgiLy0vZyIsIi4iKTs=</field>
                                   <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                                 </block>
                                 <block type="procedures_defcustomnoreturn" id="W?BjTQs!pguWw4HPwT)p" x="287" y="-162">
                                   <mutation statements="false">
                                     <arg name="myVAL" varid="d/.bOP=7VlC5/[+=8g/u"></arg>
                                     <arg name="myTS" varid="SL$d6/`ClO6iqfefh5LN"></arg>
                                   </mutation>
                                   <field name="NAME">SendTo_SQL_storeState</field>
                                   <field name="SCRIPT">Ly8gVW5kIHdlcnQgZXJzdGVsbGVuIHdpZSBnZXBsYW50DQpzZW5kVG8oInNxbC4wIiwgInN0b3JlU3RhdGUiLCB7DQogICAgImlkIjogJzBfdXNlcmRhdGEuMC5Tb2xhcmFubGFnZS5wdmZvcmVjYXN0JywNCiAgICAic3RhdGUiOiB7IA0KICAgICAgICAidmFsIjogbXlWQUwsIA0KICAgICAgICAidHMiOiBteVRTLA0KICAgICAgICAiYWNrIjogdHJ1ZQ0KICAgIH0NCn0sIGFzeW5jIGZ1bmN0aW9uIChyZXN1bHQpIHsNCiAgICBjb25zb2xlLmxvZyhyZXN1bHQpOw0KfSk7</field>
                                   <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                                 </block>
                                 <block type="procedures_defcustomnoreturn" id="m.]d6DR4hIR|rhM`P3KU" x="288" y="-112">
                                   <mutation statements="false"></mutation>
                                   <field name="NAME">SendTo_SQL_deleteAll</field>
                                   <field name="SCRIPT">Ly8gQWxsZXMgbMO2c2NoZW4NCnNlbmRUbygic3FsLjAiLCAiZGVsZXRlQWxsIiwgew0KICAgICJpZCI6ICcwX3VzZXJkYXRhLjAuU29sYXJhbmxhZ2UucHZmb3JlY2FzdCcsDQp9LCBhc3luYyBmdW5jdGlvbiAocmVzdWx0KSB7DQogICAgICBjb25zb2xlLmxvZyhyZXN1bHQpOw0KfSk7DQo=</field>
                                   <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                                 </block>
                                 <block type="comment" id="emF90N[xA].w:e$0a5`A" x="288" y="-62">
                                   <field name="COMMENT">Trigger auf den Datenpunkt JSONTable der</field>
                                   <next>
                                     <block type="comment" id="v|g5R@PBSlfR{}gqtWR1">
                                       <field name="COMMENT">gewünschten Anlage</field>
                                       <next>
                                         <block type="on_ext" id="2}81gNSPn48mxt-C32N3">
                                           <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
                                           <field name="CONDITION">ne</field>
                                           <field name="ACK_CONDITION"></field>
                                           <value name="OID0">
                                             <shadow type="field_oid" id="$fUC/kgh^7[pBZjds,[N">
                                               <field name="oid">default</field>
                                             </shadow>
                                             <block type="text" id="Q~[~L7`?jff9w0!|{R!~">
                                               <field name="TEXT">pvforecast.0.600W.JSONTable</field>
                                             </block>
                                           </value>
                                           <statement name="STATEMENT">
                                             <block type="comment" id="xipk,Q4m/$Zbq(9xP]N;">
                                               <field name="COMMENT">Den JSON in eine Variable als Objekt holen</field>
                                               <next>
                                                 <block type="variables_set" id="9le8nB_}E+{=^zh:Futa" disabled="true">
                                                   <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field>
                                                   <value name="VALUE">
                                                     <block type="convert_json2object" id="C^`)6e!W4atd.!+{(i`D">
                                                       <value name="VALUE">
                                                         <block type="get_value_var" id="CX?q]Gc8j[Ks2F4.yc=c">
                                                           <field name="ATTR">val</field>
                                                           <value name="OID">
                                                             <shadow type="text" id="Y:eexHcUNi5aP`=sh5_;">
                                                               <field name="TEXT"></field>
                                                             </shadow>
                                                             <block type="text" id="2yV92%k{c@aR$t@FV|VK">
                                                               <field name="TEXT">pvforecast.0.600W.JSONTable</field>
                                                             </block>
                                                           </value>
                                                         </block>
                                                       </value>
                                                     </block>
                                                   </value>
                                                   <next>
                                                     <block type="variables_set" id="y:J|yOI69aKr_]e}X})q">
                                                       <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field>
                                                       <value name="VALUE">
                                                         <block type="on_source" id="GDRdyJ%YUi4U{P:xhe%L">
                                                           <field name="ATTR">state.val</field>
                                                         </block>
                                                       </value>
                                                       <next>
                                                         <block type="comment" id="78{/(q^zo:Vm3)}YeMKs">
                                                           <field name="COMMENT">Den JSON nochmal als Liste</field>
                                                           <next>
                                                             <block type="variables_set" id="$C:;|F_ENe?Kc{f9E*tE" disabled="true">
                                                               <field name="VAR" id="zqSSt1.lPBrP!prtJp:[">JSONListe</field>
                                                               <value name="VALUE">
                                                                 <block type="lists_split" id=":4[[9BsVwSu-#SFS/qp#">
                                                                   <mutation mode="SPLIT"></mutation>
                                                                   <field name="MODE">SPLIT</field>
                                                                   <value name="INPUT">
                                                                     <block type="get_value_var" id="k${_LxJlQ~Jc%^8mQ;J3">
                                                                       <field name="ATTR">val</field>
                                                                       <value name="OID">
                                                                         <shadow type="text">
                                                                           <field name="TEXT"></field>
                                                                         </shadow>
                                                                         <block type="text" id="@(LLEO9DcZC_107PY7e;">
                                                                           <field name="TEXT">pvforecast.0.600W.JSONTable</field>
                                                                         </block>
                                                                       </value>
                                                                     </block>
                                                                   </value>
                                                                   <value name="DELIM">
                                                                     <shadow type="text" id="_=ir)--C~K.5!,@3!%@4">
                                                                       <field name="TEXT">},</field>
                                                                     </shadow>
                                                                   </value>
                                                                 </block>
                                                               </value>
                                                               <next>
                                                                 <block type="variables_set" id="KTHIaej{MV5TTxsehu:h">
                                                                   <field name="VAR" id="zqSSt1.lPBrP!prtJp:[">JSONListe</field>
                                                                   <value name="VALUE">
                                                                     <block type="lists_split" id="`#[tp]8]y!L^LEp8OL)J">
                                                                       <mutation mode="SPLIT"></mutation>
                                                                       <field name="MODE">SPLIT</field>
                                                                       <value name="INPUT">
                                                                         <block type="on_source" id="c),q`)7dZyX)GtW;Oe0Y">
                                                                           <field name="ATTR">state.val</field>
                                                                         </block>
                                                                       </value>
                                                                       <value name="DELIM">
                                                                         <shadow type="text" id="koPJuBu/Hm/D7+[$DR$`">
                                                                           <field name="TEXT">},{</field>
                                                                         </shadow>
                                                                       </value>
                                                                     </block>
                                                                   </value>
                                                                   <next>
                                                                     <block type="comment" id="_dDWRwqorhv|K4r20+CF">
                                                                       <field name="COMMENT">Zähler für die einzelnen Werte</field>
                                                                       <next>
                                                                         <block type="variables_set" id="w[HNQFZ(pKC;(LonsppG">
                                                                           <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field>
                                                                           <value name="VALUE">
                                                                             <block type="math_number" id="$YD#)Z6].!0wU8:!IFY-">
                                                                               <field name="NUM">-1</field>
                                                                             </block>
                                                                           </value>
                                                                           <next>
                                                                             <block type="comment" id="nON/.IM*.X5L7BSfqn.j">
                                                                               <field name="COMMENT">Vorherige Werte löschen</field>
                                                                               <next>
                                                                                 <block type="procedures_callcustomnoreturn" id="MjjlAd,#02dH9;[91A:e">
                                                                                   <mutation name="SendTo_SQL_deleteAll"></mutation>
                                                                                   <next>
                                                                                     <block type="comment" id="+UxP]UFX*K*Ay8@+.3D(">
                                                                                       <field name="COMMENT">Kurz warten ...</field>
                                                                                       <next>
                                                                                         <block type="timeouts_wait" id="b#[5BCU4#vD.+@RIgxwr">
                                                                                           <field name="DELAY">2</field>
                                                                                           <field name="UNIT">sec</field>
                                                                                           <next>
                                                                                             <block type="comment" id="?qlG@bV1nj7K%h8?`S-h">
                                                                                               <field name="COMMENT">Die Werte abarbeiten:</field>
                                                                                               <next>
                                                                                                 <block type="controls_forEach" id="sZ%NhNSxC10sAg@O]Kz6">
                                                                                                   <field name="VAR" id="9[xS=sH).DKBS8oGN@cs">i</field>
                                                                                                   <value name="LIST">
                                                                                                     <block type="variables_get" id="psB3RQ42dmHy[=aKrs!2">
                                                                                                       <field name="VAR" id="zqSSt1.lPBrP!prtJp:[">JSONListe</field>
                                                                                                     </block>
                                                                                                   </value>
                                                                                                   <statement name="DO">
                                                                                                     <block type="comment" id="0i?Xu2@hUv,g4?;i5Fhl">
                                                                                                       <field name="COMMENT">Wird beim ersten mal 0 sein</field>
                                                                                                       <next>
                                                                                                         <block type="math_change" id="liet[5#L@~`I]t{8:/Es">
                                                                                                           <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field>
                                                                                                           <value name="DELTA">
                                                                                                             <shadow type="math_number" id="986qLvCF[J2VK^no0@Rp">
                                                                                                               <field name="NUM">1</field>
                                                                                                             </shadow>
                                                                                                           </value>
                                                                                                           <next>
                                                                                                             <block type="comment" id="}fPI/Q;fVu7V-uYuX2I+">
                                                                                                               <field name="COMMENT">Wir arbeiten die Liste ab, nutzen aber das Objekt!</field>
                                                                                                               <next>
                                                                                                                 <block type="variables_set" id="^w);@i_kdtjWWf?c}BcO">
                                                                                                                   <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                   <value name="VALUE">
                                                                                                                     <block type="get_attr" id="jTRbW_-wI4-}.!,5V(VJ">
                                                                                                                       <value name="PATH">
                                                                                                                         <shadow type="text" id="3r`W9/~ToEj{Abx:)agx">
                                                                                                                           <field name="TEXT"></field>
                                                                                                                         </shadow>
                                                                                                                         <block type="text_join" id="xoFmSb~Y+xnD;cvM|g;-">
                                                                                                                           <mutation items="2"></mutation>
                                                                                                                           <value name="ADD0">
                                                                                                                             <block type="variables_get" id="K9;4LQ$1S/`at#YY52.j">
                                                                                                                               <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field>
                                                                                                                             </block>
                                                                                                                           </value>
                                                                                                                           <value name="ADD1">
                                                                                                                             <block type="text" id="Kkt8qVr.ykp~NV;@{Uas">
                                                                                                                               <field name="TEXT">.Uhrzeit</field>
                                                                                                                             </block>
                                                                                                                           </value>
                                                                                                                         </block>
                                                                                                                       </value>
                                                                                                                       <value name="OBJECT">
                                                                                                                         <block type="variables_get" id="`-rw74I`kqylUWgeH*+(">
                                                                                                                           <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field>
                                                                                                                         </block>
                                                                                                                       </value>
                                                                                                                     </block>
                                                                                                                   </value>
                                                                                                                   <next>
                                                                                                                     <block type="comment" id="b?]P+H9BwqfkDRv$/:j(">
                                                                                                                       <field name="COMMENT">Die - in . umwandeln</field>
                                                                                                                       <next>
                                                                                                                         <block type="variables_set" id="k@v15A-cYpf/vbpRa;_z">
                                                                                                                           <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                           <value name="VALUE">
                                                                                                                             <block type="procedures_callcustomreturn" id="p[kw(;yI)pXBjjzD#D)~">
                                                                                                                               <mutation name="ReplaceHyphen">
                                                                                                                                 <arg name="x"></arg>
                                                                                                                               </mutation>
                                                                                                                               <value name="ARG0">
                                                                                                                                 <block type="variables_get" id="N)h=(1TR`.9#96=m?A0Y">
                                                                                                                                   <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                                 </block>
                                                                                                                               </value>
                                                                                                                             </block>
                                                                                                                           </value>
                                                                                                                           <next>
                                                                                                                             <block type="comment" id="I-6Pjzc2in5fU|/L@xLT">
                                                                                                                               <field name="COMMENT">In ein Datum-Objekt umwandeln</field>
                                                                                                                               <next>
                                                                                                                                 <block type="variables_set" id="FsILBORsaLrrazBi1L)J">
                                                                                                                                   <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                                   <value name="VALUE">
                                                                                                                                     <block type="convert_from_date" id="4bbw}ZJhpHe}e.*nJ0`M">
                                                                                                                                       <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                                                                                                       <field name="OPTION">object</field>
                                                                                                                                       <value name="VALUE">
                                                                                                                                         <block type="variables_get" id="RjC;=Ac;nPHFrHCNt$SG">
                                                                                                                                           <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                                         </block>
                                                                                                                                       </value>
                                                                                                                                     </block>
                                                                                                                                   </value>
                                                                                                                                   <next>
                                                                                                                                     <block type="comment" id="?/.AjS+{19mE_EhC6?{%">
                                                                                                                                       <field name="COMMENT">Die Leistung holen (hier in Wh statt kWh)</field>
                                                                                                                                       <next>
                                                                                                                                         <block type="variables_set" id="7$e1=Z.||tt-}b}$`QUX">
                                                                                                                                           <field name="VAR" id="f=MX5bxXCe`#`$z~HXcG">tempLeistung</field>
                                                                                                                                           <value name="VALUE">
                                                                                                                                             <block type="math_arithmetic" id="czVYE)d?^hj;sB8tQW%c" inline="false">
                                                                                                                                               <field name="OP">MULTIPLY</field>
                                                                                                                                               <value name="A">
                                                                                                                                                 <shadow type="math_number" id="QXXI#nb51thU(gYujO7l">
                                                                                                                                                   <field name="NUM">1</field>
                                                                                                                                                 </shadow>
                                                                                                                                                 <block type="get_attr" id="!p(Q2{*u/U@(LdLaWO;s">
                                                                                                                                                   <value name="PATH">
                                                                                                                                                     <shadow type="text">
                                                                                                                                                       <field name="TEXT"></field>
                                                                                                                                                     </shadow>
                                                                                                                                                     <block type="text_join" id="eO+Kc@J#5ncJexgCa;XG">
                                                                                                                                                       <mutation items="2"></mutation>
                                                                                                                                                       <value name="ADD0">
                                                                                                                                                         <block type="variables_get" id="6h@/w;v+5fJ:2k^fRu$`">
                                                                                                                                                           <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field>
                                                                                                                                                         </block>
                                                                                                                                                       </value>
                                                                                                                                                       <value name="ADD1">
                                                                                                                                                         <block type="text" id="u;lW,EMq1lo;0wl@^s~Z">
                                                                                                                                                           <field name="TEXT">.Leistung</field>
                                                                                                                                                         </block>
                                                                                                                                                       </value>
                                                                                                                                                     </block>
                                                                                                                                                   </value>
                                                                                                                                                   <value name="OBJECT">
                                                                                                                                                     <block type="variables_get" id=":wC%m_*5#kUmjSCtRht*">
                                                                                                                                                       <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field>
                                                                                                                                                     </block>
                                                                                                                                                   </value>
                                                                                                                                                 </block>
                                                                                                                                               </value>
                                                                                                                                               <value name="B">
                                                                                                                                                 <shadow type="math_number" id=".oUR!B4y8;}kLXv3HYVD">
                                                                                                                                                   <field name="NUM">1000</field>
                                                                                                                                                 </shadow>
                                                                                                                                               </value>
                                                                                                                                             </block>
                                                                                                                                           </value>
                                                                                                                                           <next>
                                                                                                                                             <block type="comment" id=".r}c.6$[JDf=.|#00pZj">
                                                                                                                                               <field name="COMMENT">Und in die Datenbank schreiben</field>
                                                                                                                                               <next>
                                                                                                                                                 <block type="procedures_callcustomnoreturn" id="C,/_Emb0_,HXS0:;0?Cb">
                                                                                                                                                   <mutation name="SendTo_SQL_storeState">
                                                                                                                                                     <arg name="myVAL"></arg>
                                                                                                                                                     <arg name="myTS"></arg>
                                                                                                                                                   </mutation>
                                                                                                                                                   <value name="ARG0">
                                                                                                                                                     <block type="variables_get" id="ZX``,0~qVZ*H;d75IT!S">
                                                                                                                                                       <field name="VAR" id="f=MX5bxXCe`#`$z~HXcG">tempLeistung</field>
                                                                                                                                                     </block>
                                                                                                                                                   </value>
                                                                                                                                                   <value name="ARG1">
                                                                                                                                                     <block type="variables_get" id="2rC,dvFPd3*_,1)EOdkN">
                                                                                                                                                       <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                                                     </block>
                                                                                                                                                   </value>
                                                                                                                                                 </block>
                                                                                                                                               </next>
                                                                                                                                             </block>
                                                                                                                                           </next>
                                                                                                                                         </block>
                                                                                                                                       </next>
                                                                                                                                     </block>
                                                                                                                                   </next>
                                                                                                                                 </block>
                                                                                                                               </next>
                                                                                                                             </block>
                                                                                                                           </next>
                                                                                                                         </block>
                                                                                                                       </next>
                                                                                                                     </block>
                                                                                                                   </next>
                                                                                                                 </block>
                                                                                                               </next>
                                                                                                             </block>
                                                                                                           </next>
                                                                                                         </block>
                                                                                                       </next>
                                                                                                     </block>
                                                                                                   </statement>
                                                                                                 </block>
                                                                                               </next>
                                                                                             </block>
                                                                                           </next>
                                                                                         </block>
                                                                                       </next>
                                                                                     </block>
                                                                                   </next>
                                                                                 </block>
                                                                               </next>
                                                                             </block>
                                                                           </next>
                                                                         </block>
                                                                       </next>
                                                                     </block>
                                                                   </next>
                                                                 </block>
                                                               </next>
                                                             </block>
                                                           </next>
                                                         </block>
                                                       </next>
                                                     </block>
                                                   </next>
                                                 </block>
                                               </next>
                                             </block>
                                           </statement>
                                         </block>
                                       </next>
                                     </block>
                                   </next>
                                 </block>
                                </xml>
                                

                                Anpassen müsst Ihr:

                                In der JavaScript-Funktion SendTo_SQL_storeState den Namen des Ziel-Datenpunktes:
                                40558805-14b2-4080-9681-84d67524a428-image.png
                                gelb markiert:
                                84a72c5c-f34e-4793-8174-a9eb2ee5e8ad-image.png

                                Das gleiche in der JavaScript-Funktion SendTo_SQL_DeleteAll
                                91c29379-c885-4fef-b5b4-c710f95d35ff-image.png

                                Und im Kopf den Quellpfad zu eurer Anlage:
                                46235a8d-a6ad-44ff-8668-09fe532644d5-image.png

                                Und ob Ihr es in kWh oder Wh haben wollt:
                                cdba127d-a976-408f-a313-22f6ba0d77e3-image.png
                                (die x 1000 entfernen oder durch 1 Ersetzen bei kWh)

                                Wenn Ihr das Skript startet passiert erst einmal nichts. Erst wenn neue Daten reinkämen.
                                Zum Testen könntet Ihr

                                • Im Trigger von wurde geändert auf wurde aktualisiert ändern
                                • den pvforecast Adapter einmal neu starten. Zumindest bei mir holt er dann sofort einmal neue Daten

                                und schon hat er uns die Werte schön in die Datenbank geschrieben:

                                MariaDB [iobroker]> select * from ts_number where id = '95';
                                +----+---------------+------+------+-------+------+
                                | id | ts            | val  | ack  | _from | q    |
                                +----+---------------+------+------+-------+------+
                                | 95 | 1646287082001 |    0 |    1 |     0 |    0 |
                                | 95 | 1646288940000 |   29 |    1 |     0 |    0 |
                                | 95 | 1646290802000 |  146 |    1 |     0 |    0 |
                                | 95 | 1646294400000 |  247 |    1 |     0 |    0 |
                                | 95 | 1646298000000 |  377 |    1 |     0 |    0 |
                                | 95 | 1646301600000 |  422 |    1 |     0 |    0 |
                                | 95 | 1646305200000 |  428 |    1 |     0 |    0 |
                                | 95 | 1646308800000 |  383 |    1 |     0 |    0 |
                                | 95 | 1646312400000 |  317 |    1 |     0 |    0 |
                                | 95 | 1646316000000 |  222 |    1 |     0 |    0 |
                                | 95 | 1646319600000 |  113 |    1 |     0 |    0 |
                                | 95 | 1646323200000 |   34 |    1 |     0 |    0 |
                                | 95 | 1646326800000 |    8 |    1 |     0 |    0 |
                                | 95 | 1646327160000 |    2 |    1 |     0 |    0 |
                                | 95 | 1646327460000 |    0 |    1 |     0 |    0 |
                                | 95 | 1646373360000 |    0 |    1 |     0 |    0 |
                                | 95 | 1646375280000 |   36 |    1 |     0 |    0 |
                                | 95 | 1646377200000 |  180 |    1 |     0 |    0 |
                                | 95 | 1646380800000 |  284 |    1 |     0 |    0 |
                                | 95 | 1646384400000 |  360 |    1 |     0 |    0 |
                                | 95 | 1646388000000 |  401 |    1 |     0 |    0 |
                                | 95 | 1646391600000 |  406 |    1 |     0 |    0 |
                                | 95 | 1646395200000 |  372 |    1 |     0 |    0 |
                                | 95 | 1646398800000 |  310 |    1 |     0 |    0 |
                                | 95 | 1646402400000 |  218 |    1 |     0 |    0 |
                                | 95 | 1646406000000 |  114 |    1 |     0 |    0 |
                                | 95 | 1646409600000 |   35 |    1 |     0 |    0 |
                                | 95 | 1646413200000 |    8 |    1 |     0 |    0 |
                                | 95 | 1646413620000 |    2 |    1 |     0 |    0 |
                                | 95 | 1646413980000 |    0 |    1 |     0 |    0 |
                                +----+---------------+------+------+-------+------+
                                30 rows in set (0.001 sec)
                                
                                

                                Die kann man jetzt in echarts etc. verwenden.

                                Woran ich noch verzweifle:

                                // Alles löschen
                                sendTo("sql.0", "deleteAll", {
                                    "id": '0_userdata.0.Solaranlage.pvforecast',
                                }, async function (result) {
                                      console.log(result);
                                });
                                

                                Wie schaffe ich es auch den Wert von id als Variable zu übergeben?
                                Daran habe ich nämlich 90% der Zeit gesessen. Zuerst habe ich es vergeblich mit dem Blockly-SendTo Block versucht (aber der hat es immer falsch formatiert gesendet) und dann wie ich die festen Werte durch Variablen ersetze.

                                P Offline
                                P Offline
                                PatrickWalther
                                Developer
                                schrieb am zuletzt editiert von
                                #310

                                @bananajoe Vielleicht kann das ja @Meistertr einbinden.

                                1 Antwort Letzte Antwort
                                0
                                • P PatrickWalther

                                  @diginix welche Formel? Hast du einen Link?

                                  DiginixD Offline
                                  DiginixD Offline
                                  Diginix
                                  schrieb am zuletzt editiert von Diginix
                                  #311

                                  @patrickwalther Ich habe einfach alle 30min Werte addiert und durch 2 geteilt.
                                  Wenn 1h lang 2000 Watt prognostiziert sind, dann sind das 2 kWh. Wenn für 10 Uhr 1 kW und für 10:30 2 kW angesetzt sind, wären das entsprechend 0,5h x 1kW + 0,5h x 2kW = 1,5 kWh. Da solcast pro 30min einen Wert liefert ist es also die Summe aller x 0,5.

                                  Oder meinst du die Formel vom Plenticore Adapter von Strathcole? K.a. die ist logischerweise in seinem JS zu finden. Aber sicher nicht einfach übertragbar. Er nutzt glaube eine fertige Formel und hat diese weiter verfeinert bis es gut passte.
                                  Da laufen auch Wetterdaten von div. iob Adaptern und kachelmannwetter mit rein.

                                  ..:: So long! Tom ::..

                                  NUC7i3 (Ubuntu Proxmox VM) | Echo Dots 2+3. Gen | Xiaomi Sensoren | Mi Robot 1S | Yeelight | Sonoff | Shelly | H801 RGB | Gosund SP1 | NodeMCU+ESP32 | Kostal Plenticore PV+BYD | openWB

                                  P 1 Antwort Letzte Antwort
                                  0
                                  • DiginixD Diginix

                                    @patrickwalther Ich habe einfach alle 30min Werte addiert und durch 2 geteilt.
                                    Wenn 1h lang 2000 Watt prognostiziert sind, dann sind das 2 kWh. Wenn für 10 Uhr 1 kW und für 10:30 2 kW angesetzt sind, wären das entsprechend 0,5h x 1kW + 0,5h x 2kW = 1,5 kWh. Da solcast pro 30min einen Wert liefert ist es also die Summe aller x 0,5.

                                    Oder meinst du die Formel vom Plenticore Adapter von Strathcole? K.a. die ist logischerweise in seinem JS zu finden. Aber sicher nicht einfach übertragbar. Er nutzt glaube eine fertige Formel und hat diese weiter verfeinert bis es gut passte.
                                    Da laufen auch Wetterdaten von div. iob Adaptern und kachelmannwetter mit rein.

                                    P Offline
                                    P Offline
                                    PatrickWalther
                                    Developer
                                    schrieb am zuletzt editiert von
                                    #312

                                    @diginix okay wie heißt der Adapter von @StrathCole?

                                    DiginixD 1 Antwort Letzte Antwort
                                    0
                                    • P PatrickWalther

                                      @diginix okay wie heißt der Adapter von @StrathCole?

                                      DiginixD Offline
                                      DiginixD Offline
                                      Diginix
                                      schrieb am zuletzt editiert von Diginix
                                      #313

                                      @patrickwalther https://github.com/StrathCole/ioBroker.plenticore

                                      Der ist vorrangig für Kostal Wechselrichter und hat nur on top eine PV Prognose. Aber auch ohne WR sollte der Part funktionieren wenn man die Werte der PV Anlage hinterlegt. Evtl startet er nur nicht wenn keine IP für den WR eingetragen oder erreichbar ist.

                                      ..:: So long! Tom ::..

                                      NUC7i3 (Ubuntu Proxmox VM) | Echo Dots 2+3. Gen | Xiaomi Sensoren | Mi Robot 1S | Yeelight | Sonoff | Shelly | H801 RGB | Gosund SP1 | NodeMCU+ESP32 | Kostal Plenticore PV+BYD | openWB

                                      1 Antwort Letzte Antwort
                                      1
                                      • DiginixD Diginix

                                        @bastian-m Wie machst du denn jetzt den ganzen Vergleich in deinem Skript mit einer (unbekannten) Menge an Objekten?

                                        B Offline
                                        B Offline
                                        bastian-m
                                        schrieb am zuletzt editiert von
                                        #314

                                        @diginix said in Test PV Forecast Adapter:

                                        @bastian-m Wie machst du denn jetzt den ganzen Vergleich in deinem Skript mit einer (unbekannten) Menge an Objekten?

                                        Mit einem Blocky des Todes ;-) Ich durchlaufe in einer Schleife alle 15-Min-Intervalle von 7 bis 18 Uhr und simuliere für jede dieser möglichen Einschaltzeiten, wie viel Eigenverbrauch der Verbraucher abgreifen würde und gebe dann die Startzeit mit dem höchsten Eigenverbrauch aus.
                                        Ich muss mal ein bisschen JavaScript lernen...grundlegendes prozedurales Programmieren beherrsche ich schon...aber...naja...in den 90er im Informatik-LK hat man halt Pascal gelernt. Falls einer die Sprache noch kennt. ;-)

                                        Ich nutze forecast.solar mit Abo und nicht solcast - ich habe die Prognosen noch nicht systematisch mit dem tatsächlichen Ertrag verglichen, aber so schlecht passen die nicht. Um zumindest grob zu entscheiden ober der Verbraucher die Nacht duchläuft oder am nächsten Tag, reicht das.

                                        1 Antwort Letzte Antwort
                                        1
                                        • BananaJoeB BananaJoe

                                          @PatrickWalther

                                          So, es ist vollbracht. Zwar durch die Brust ins Auge, aber es läuft (nebenbei habe ich aber wieder einmal viel gelernt).

                                          Ich habe nun die Vorhersage erfolgreich mit dem SQL-Adapter (und einer MySQL-Datenbank) und dem echarts-Adapter als Anzeige zum laufen bekommen:
                                          65f1abc8-bf77-43da-9914-17be824c2dcb-image.png
                                          gelb ist meine echte Tagesleistung, rot die aus diesem Adapter (auch wenn ich hier Äpfel mit Birnen vergleiche, gelb sind W und rot Wh, daran mache ich mich als nächstes).

                                          Als Vorrausetzung nehme ich einen installierten und funktionsfähigen SQL-Adapter an.
                                          Außerdem habt Ihr den pvforecast Adapter konfiguriert und am laufen so das es einen Datenpunkt mit der Vorhersage gibt. Meine Lösung nutzt den Datenpunkt JSONTable der Anlage. Meine Anlage heißt 600W und der Datenpunkt also

                                          pvforecast.0.600W.JSONTable
                                          

                                          ###################################################################

                                          Schritt 1: Datenpunkt erstellen, konfigurieren und initialisieren
                                          Es braucht einen Datenpunkt der Daten hält, ich habe hier diesen erstellt:

                                          0_userdata.0.Solaranlage.pvforecast
                                          

                                          Als Typ Number bzw. Nummer
                                          Dann habe ich ich SQL für den Datenpunkt eingeschaltet:
                                          ed032325-be5e-40ed-afdb-2da83d0824a2-image.png
                                          Entprellzeit auf 0 da die Daten in einem rutsch geschrieben werden

                                          Nun ist es wichtig im Objekte Explorer dort einmal einen Wert von Hand reinzuschreiben, z.B. eine 42:
                                          97f71f6a-a0a7-4718-86cd-199ad63c96e5-image.png
                                          Erst dann ist der Datenpunkt in der SQL-Datenbank auch angelegt. Das hat mich die ersten bestimmt 20 Minuten nerven gekostet bis ich darauf gekommen bin. Solange funktioniert nämlich das SendTo noch nicht.

                                          Schritt 2: Das Blockly Skript
                                          Ja ja, ich dachte ich könnte das mal eben mit Blockly zusammenklicken statt es direkt in JavaScript zu schreiben. Mach ich vielleicht noch. Nun ist es Blockly mit 3 JavaScript Funktionen weil der SendTo Block einfach nicht zu überreden war das ganze vernünftig zu senden.

                                          Im Spoiler der Blockly-Export

                                          <xml xmlns="https://developers.google.com/blockly/xml">
                                           <variables>
                                             <variable id="xr?C%:}F%HR,+baC%W8n">x</variable>
                                             <variable id="d/.bOP=7VlC5/[+=8g/u">myVAL</variable>
                                             <variable id="SL$d6/`ClO6iqfefh5LN">myTS</variable>
                                             <variable id="B$n_|Lt?V?dltG$1=%U!">JSONTable</variable>
                                             <variable id="zqSSt1.lPBrP!prtJp:[">JSONListe</variable>
                                             <variable id="[,noZ+!#R([v)Vli[JAC">counter</variable>
                                             <variable id="9[xS=sH).DKBS8oGN@cs">i</variable>
                                             <variable id="tkH#qcE=H5/_7~OttW5(">tempDatum</variable>
                                             <variable id="f=MX5bxXCe`#`$z~HXcG">tempLeistung</variable>
                                           </variables>
                                           <block type="procedures_defcustomreturn" id="f5+e$i!@hdFdP7[JA1^`" x="288" y="-212">
                                             <mutation statements="false">
                                               <arg name="x" varid="xr?C%:}F%HR,+baC%W8n"></arg>
                                             </mutation>
                                             <field name="NAME">ReplaceHyphen</field>
                                             <field name="SCRIPT">cmV0dXJuIHgucmVwbGFjZSgiLy0vZyIsIi4iKTs=</field>
                                             <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                                           </block>
                                           <block type="procedures_defcustomnoreturn" id="W?BjTQs!pguWw4HPwT)p" x="287" y="-162">
                                             <mutation statements="false">
                                               <arg name="myVAL" varid="d/.bOP=7VlC5/[+=8g/u"></arg>
                                               <arg name="myTS" varid="SL$d6/`ClO6iqfefh5LN"></arg>
                                             </mutation>
                                             <field name="NAME">SendTo_SQL_storeState</field>
                                             <field name="SCRIPT">Ly8gVW5kIHdlcnQgZXJzdGVsbGVuIHdpZSBnZXBsYW50DQpzZW5kVG8oInNxbC4wIiwgInN0b3JlU3RhdGUiLCB7DQogICAgImlkIjogJzBfdXNlcmRhdGEuMC5Tb2xhcmFubGFnZS5wdmZvcmVjYXN0JywNCiAgICAic3RhdGUiOiB7IA0KICAgICAgICAidmFsIjogbXlWQUwsIA0KICAgICAgICAidHMiOiBteVRTLA0KICAgICAgICAiYWNrIjogdHJ1ZQ0KICAgIH0NCn0sIGFzeW5jIGZ1bmN0aW9uIChyZXN1bHQpIHsNCiAgICBjb25zb2xlLmxvZyhyZXN1bHQpOw0KfSk7</field>
                                             <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                                           </block>
                                           <block type="procedures_defcustomnoreturn" id="m.]d6DR4hIR|rhM`P3KU" x="288" y="-112">
                                             <mutation statements="false"></mutation>
                                             <field name="NAME">SendTo_SQL_deleteAll</field>
                                             <field name="SCRIPT">Ly8gQWxsZXMgbMO2c2NoZW4NCnNlbmRUbygic3FsLjAiLCAiZGVsZXRlQWxsIiwgew0KICAgICJpZCI6ICcwX3VzZXJkYXRhLjAuU29sYXJhbmxhZ2UucHZmb3JlY2FzdCcsDQp9LCBhc3luYyBmdW5jdGlvbiAocmVzdWx0KSB7DQogICAgICBjb25zb2xlLmxvZyhyZXN1bHQpOw0KfSk7DQo=</field>
                                             <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
                                           </block>
                                           <block type="comment" id="emF90N[xA].w:e$0a5`A" x="288" y="-62">
                                             <field name="COMMENT">Trigger auf den Datenpunkt JSONTable der</field>
                                             <next>
                                               <block type="comment" id="v|g5R@PBSlfR{}gqtWR1">
                                                 <field name="COMMENT">gewünschten Anlage</field>
                                                 <next>
                                                   <block type="on_ext" id="2}81gNSPn48mxt-C32N3">
                                                     <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
                                                     <field name="CONDITION">ne</field>
                                                     <field name="ACK_CONDITION"></field>
                                                     <value name="OID0">
                                                       <shadow type="field_oid" id="$fUC/kgh^7[pBZjds,[N">
                                                         <field name="oid">default</field>
                                                       </shadow>
                                                       <block type="text" id="Q~[~L7`?jff9w0!|{R!~">
                                                         <field name="TEXT">pvforecast.0.600W.JSONTable</field>
                                                       </block>
                                                     </value>
                                                     <statement name="STATEMENT">
                                                       <block type="comment" id="xipk,Q4m/$Zbq(9xP]N;">
                                                         <field name="COMMENT">Den JSON in eine Variable als Objekt holen</field>
                                                         <next>
                                                           <block type="variables_set" id="9le8nB_}E+{=^zh:Futa" disabled="true">
                                                             <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field>
                                                             <value name="VALUE">
                                                               <block type="convert_json2object" id="C^`)6e!W4atd.!+{(i`D">
                                                                 <value name="VALUE">
                                                                   <block type="get_value_var" id="CX?q]Gc8j[Ks2F4.yc=c">
                                                                     <field name="ATTR">val</field>
                                                                     <value name="OID">
                                                                       <shadow type="text" id="Y:eexHcUNi5aP`=sh5_;">
                                                                         <field name="TEXT"></field>
                                                                       </shadow>
                                                                       <block type="text" id="2yV92%k{c@aR$t@FV|VK">
                                                                         <field name="TEXT">pvforecast.0.600W.JSONTable</field>
                                                                       </block>
                                                                     </value>
                                                                   </block>
                                                                 </value>
                                                               </block>
                                                             </value>
                                                             <next>
                                                               <block type="variables_set" id="y:J|yOI69aKr_]e}X})q">
                                                                 <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field>
                                                                 <value name="VALUE">
                                                                   <block type="on_source" id="GDRdyJ%YUi4U{P:xhe%L">
                                                                     <field name="ATTR">state.val</field>
                                                                   </block>
                                                                 </value>
                                                                 <next>
                                                                   <block type="comment" id="78{/(q^zo:Vm3)}YeMKs">
                                                                     <field name="COMMENT">Den JSON nochmal als Liste</field>
                                                                     <next>
                                                                       <block type="variables_set" id="$C:;|F_ENe?Kc{f9E*tE" disabled="true">
                                                                         <field name="VAR" id="zqSSt1.lPBrP!prtJp:[">JSONListe</field>
                                                                         <value name="VALUE">
                                                                           <block type="lists_split" id=":4[[9BsVwSu-#SFS/qp#">
                                                                             <mutation mode="SPLIT"></mutation>
                                                                             <field name="MODE">SPLIT</field>
                                                                             <value name="INPUT">
                                                                               <block type="get_value_var" id="k${_LxJlQ~Jc%^8mQ;J3">
                                                                                 <field name="ATTR">val</field>
                                                                                 <value name="OID">
                                                                                   <shadow type="text">
                                                                                     <field name="TEXT"></field>
                                                                                   </shadow>
                                                                                   <block type="text" id="@(LLEO9DcZC_107PY7e;">
                                                                                     <field name="TEXT">pvforecast.0.600W.JSONTable</field>
                                                                                   </block>
                                                                                 </value>
                                                                               </block>
                                                                             </value>
                                                                             <value name="DELIM">
                                                                               <shadow type="text" id="_=ir)--C~K.5!,@3!%@4">
                                                                                 <field name="TEXT">},</field>
                                                                               </shadow>
                                                                             </value>
                                                                           </block>
                                                                         </value>
                                                                         <next>
                                                                           <block type="variables_set" id="KTHIaej{MV5TTxsehu:h">
                                                                             <field name="VAR" id="zqSSt1.lPBrP!prtJp:[">JSONListe</field>
                                                                             <value name="VALUE">
                                                                               <block type="lists_split" id="`#[tp]8]y!L^LEp8OL)J">
                                                                                 <mutation mode="SPLIT"></mutation>
                                                                                 <field name="MODE">SPLIT</field>
                                                                                 <value name="INPUT">
                                                                                   <block type="on_source" id="c),q`)7dZyX)GtW;Oe0Y">
                                                                                     <field name="ATTR">state.val</field>
                                                                                   </block>
                                                                                 </value>
                                                                                 <value name="DELIM">
                                                                                   <shadow type="text" id="koPJuBu/Hm/D7+[$DR$`">
                                                                                     <field name="TEXT">},{</field>
                                                                                   </shadow>
                                                                                 </value>
                                                                               </block>
                                                                             </value>
                                                                             <next>
                                                                               <block type="comment" id="_dDWRwqorhv|K4r20+CF">
                                                                                 <field name="COMMENT">Zähler für die einzelnen Werte</field>
                                                                                 <next>
                                                                                   <block type="variables_set" id="w[HNQFZ(pKC;(LonsppG">
                                                                                     <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field>
                                                                                     <value name="VALUE">
                                                                                       <block type="math_number" id="$YD#)Z6].!0wU8:!IFY-">
                                                                                         <field name="NUM">-1</field>
                                                                                       </block>
                                                                                     </value>
                                                                                     <next>
                                                                                       <block type="comment" id="nON/.IM*.X5L7BSfqn.j">
                                                                                         <field name="COMMENT">Vorherige Werte löschen</field>
                                                                                         <next>
                                                                                           <block type="procedures_callcustomnoreturn" id="MjjlAd,#02dH9;[91A:e">
                                                                                             <mutation name="SendTo_SQL_deleteAll"></mutation>
                                                                                             <next>
                                                                                               <block type="comment" id="+UxP]UFX*K*Ay8@+.3D(">
                                                                                                 <field name="COMMENT">Kurz warten ...</field>
                                                                                                 <next>
                                                                                                   <block type="timeouts_wait" id="b#[5BCU4#vD.+@RIgxwr">
                                                                                                     <field name="DELAY">2</field>
                                                                                                     <field name="UNIT">sec</field>
                                                                                                     <next>
                                                                                                       <block type="comment" id="?qlG@bV1nj7K%h8?`S-h">
                                                                                                         <field name="COMMENT">Die Werte abarbeiten:</field>
                                                                                                         <next>
                                                                                                           <block type="controls_forEach" id="sZ%NhNSxC10sAg@O]Kz6">
                                                                                                             <field name="VAR" id="9[xS=sH).DKBS8oGN@cs">i</field>
                                                                                                             <value name="LIST">
                                                                                                               <block type="variables_get" id="psB3RQ42dmHy[=aKrs!2">
                                                                                                                 <field name="VAR" id="zqSSt1.lPBrP!prtJp:[">JSONListe</field>
                                                                                                               </block>
                                                                                                             </value>
                                                                                                             <statement name="DO">
                                                                                                               <block type="comment" id="0i?Xu2@hUv,g4?;i5Fhl">
                                                                                                                 <field name="COMMENT">Wird beim ersten mal 0 sein</field>
                                                                                                                 <next>
                                                                                                                   <block type="math_change" id="liet[5#L@~`I]t{8:/Es">
                                                                                                                     <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field>
                                                                                                                     <value name="DELTA">
                                                                                                                       <shadow type="math_number" id="986qLvCF[J2VK^no0@Rp">
                                                                                                                         <field name="NUM">1</field>
                                                                                                                       </shadow>
                                                                                                                     </value>
                                                                                                                     <next>
                                                                                                                       <block type="comment" id="}fPI/Q;fVu7V-uYuX2I+">
                                                                                                                         <field name="COMMENT">Wir arbeiten die Liste ab, nutzen aber das Objekt!</field>
                                                                                                                         <next>
                                                                                                                           <block type="variables_set" id="^w);@i_kdtjWWf?c}BcO">
                                                                                                                             <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                             <value name="VALUE">
                                                                                                                               <block type="get_attr" id="jTRbW_-wI4-}.!,5V(VJ">
                                                                                                                                 <value name="PATH">
                                                                                                                                   <shadow type="text" id="3r`W9/~ToEj{Abx:)agx">
                                                                                                                                     <field name="TEXT"></field>
                                                                                                                                   </shadow>
                                                                                                                                   <block type="text_join" id="xoFmSb~Y+xnD;cvM|g;-">
                                                                                                                                     <mutation items="2"></mutation>
                                                                                                                                     <value name="ADD0">
                                                                                                                                       <block type="variables_get" id="K9;4LQ$1S/`at#YY52.j">
                                                                                                                                         <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field>
                                                                                                                                       </block>
                                                                                                                                     </value>
                                                                                                                                     <value name="ADD1">
                                                                                                                                       <block type="text" id="Kkt8qVr.ykp~NV;@{Uas">
                                                                                                                                         <field name="TEXT">.Uhrzeit</field>
                                                                                                                                       </block>
                                                                                                                                     </value>
                                                                                                                                   </block>
                                                                                                                                 </value>
                                                                                                                                 <value name="OBJECT">
                                                                                                                                   <block type="variables_get" id="`-rw74I`kqylUWgeH*+(">
                                                                                                                                     <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field>
                                                                                                                                   </block>
                                                                                                                                 </value>
                                                                                                                               </block>
                                                                                                                             </value>
                                                                                                                             <next>
                                                                                                                               <block type="comment" id="b?]P+H9BwqfkDRv$/:j(">
                                                                                                                                 <field name="COMMENT">Die - in . umwandeln</field>
                                                                                                                                 <next>
                                                                                                                                   <block type="variables_set" id="k@v15A-cYpf/vbpRa;_z">
                                                                                                                                     <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                                     <value name="VALUE">
                                                                                                                                       <block type="procedures_callcustomreturn" id="p[kw(;yI)pXBjjzD#D)~">
                                                                                                                                         <mutation name="ReplaceHyphen">
                                                                                                                                           <arg name="x"></arg>
                                                                                                                                         </mutation>
                                                                                                                                         <value name="ARG0">
                                                                                                                                           <block type="variables_get" id="N)h=(1TR`.9#96=m?A0Y">
                                                                                                                                             <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                                           </block>
                                                                                                                                         </value>
                                                                                                                                       </block>
                                                                                                                                     </value>
                                                                                                                                     <next>
                                                                                                                                       <block type="comment" id="I-6Pjzc2in5fU|/L@xLT">
                                                                                                                                         <field name="COMMENT">In ein Datum-Objekt umwandeln</field>
                                                                                                                                         <next>
                                                                                                                                           <block type="variables_set" id="FsILBORsaLrrazBi1L)J">
                                                                                                                                             <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                                             <value name="VALUE">
                                                                                                                                               <block type="convert_from_date" id="4bbw}ZJhpHe}e.*nJ0`M">
                                                                                                                                                 <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
                                                                                                                                                 <field name="OPTION">object</field>
                                                                                                                                                 <value name="VALUE">
                                                                                                                                                   <block type="variables_get" id="RjC;=Ac;nPHFrHCNt$SG">
                                                                                                                                                     <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                                                   </block>
                                                                                                                                                 </value>
                                                                                                                                               </block>
                                                                                                                                             </value>
                                                                                                                                             <next>
                                                                                                                                               <block type="comment" id="?/.AjS+{19mE_EhC6?{%">
                                                                                                                                                 <field name="COMMENT">Die Leistung holen (hier in Wh statt kWh)</field>
                                                                                                                                                 <next>
                                                                                                                                                   <block type="variables_set" id="7$e1=Z.||tt-}b}$`QUX">
                                                                                                                                                     <field name="VAR" id="f=MX5bxXCe`#`$z~HXcG">tempLeistung</field>
                                                                                                                                                     <value name="VALUE">
                                                                                                                                                       <block type="math_arithmetic" id="czVYE)d?^hj;sB8tQW%c" inline="false">
                                                                                                                                                         <field name="OP">MULTIPLY</field>
                                                                                                                                                         <value name="A">
                                                                                                                                                           <shadow type="math_number" id="QXXI#nb51thU(gYujO7l">
                                                                                                                                                             <field name="NUM">1</field>
                                                                                                                                                           </shadow>
                                                                                                                                                           <block type="get_attr" id="!p(Q2{*u/U@(LdLaWO;s">
                                                                                                                                                             <value name="PATH">
                                                                                                                                                               <shadow type="text">
                                                                                                                                                                 <field name="TEXT"></field>
                                                                                                                                                               </shadow>
                                                                                                                                                               <block type="text_join" id="eO+Kc@J#5ncJexgCa;XG">
                                                                                                                                                                 <mutation items="2"></mutation>
                                                                                                                                                                 <value name="ADD0">
                                                                                                                                                                   <block type="variables_get" id="6h@/w;v+5fJ:2k^fRu$`">
                                                                                                                                                                     <field name="VAR" id="[,noZ+!#R([v)Vli[JAC">counter</field>
                                                                                                                                                                   </block>
                                                                                                                                                                 </value>
                                                                                                                                                                 <value name="ADD1">
                                                                                                                                                                   <block type="text" id="u;lW,EMq1lo;0wl@^s~Z">
                                                                                                                                                                     <field name="TEXT">.Leistung</field>
                                                                                                                                                                   </block>
                                                                                                                                                                 </value>
                                                                                                                                                               </block>
                                                                                                                                                             </value>
                                                                                                                                                             <value name="OBJECT">
                                                                                                                                                               <block type="variables_get" id=":wC%m_*5#kUmjSCtRht*">
                                                                                                                                                                 <field name="VAR" id="B$n_|Lt?V?dltG$1=%U!">JSONTable</field>
                                                                                                                                                               </block>
                                                                                                                                                             </value>
                                                                                                                                                           </block>
                                                                                                                                                         </value>
                                                                                                                                                         <value name="B">
                                                                                                                                                           <shadow type="math_number" id=".oUR!B4y8;}kLXv3HYVD">
                                                                                                                                                             <field name="NUM">1000</field>
                                                                                                                                                           </shadow>
                                                                                                                                                         </value>
                                                                                                                                                       </block>
                                                                                                                                                     </value>
                                                                                                                                                     <next>
                                                                                                                                                       <block type="comment" id=".r}c.6$[JDf=.|#00pZj">
                                                                                                                                                         <field name="COMMENT">Und in die Datenbank schreiben</field>
                                                                                                                                                         <next>
                                                                                                                                                           <block type="procedures_callcustomnoreturn" id="C,/_Emb0_,HXS0:;0?Cb">
                                                                                                                                                             <mutation name="SendTo_SQL_storeState">
                                                                                                                                                               <arg name="myVAL"></arg>
                                                                                                                                                               <arg name="myTS"></arg>
                                                                                                                                                             </mutation>
                                                                                                                                                             <value name="ARG0">
                                                                                                                                                               <block type="variables_get" id="ZX``,0~qVZ*H;d75IT!S">
                                                                                                                                                                 <field name="VAR" id="f=MX5bxXCe`#`$z~HXcG">tempLeistung</field>
                                                                                                                                                               </block>
                                                                                                                                                             </value>
                                                                                                                                                             <value name="ARG1">
                                                                                                                                                               <block type="variables_get" id="2rC,dvFPd3*_,1)EOdkN">
                                                                                                                                                                 <field name="VAR" id="tkH#qcE=H5/_7~OttW5(">tempDatum</field>
                                                                                                                                                               </block>
                                                                                                                                                             </value>
                                                                                                                                                           </block>
                                                                                                                                                         </next>
                                                                                                                                                       </block>
                                                                                                                                                     </next>
                                                                                                                                                   </block>
                                                                                                                                                 </next>
                                                                                                                                               </block>
                                                                                                                                             </next>
                                                                                                                                           </block>
                                                                                                                                         </next>
                                                                                                                                       </block>
                                                                                                                                     </next>
                                                                                                                                   </block>
                                                                                                                                 </next>
                                                                                                                               </block>
                                                                                                                             </next>
                                                                                                                           </block>
                                                                                                                         </next>
                                                                                                                       </block>
                                                                                                                     </next>
                                                                                                                   </block>
                                                                                                                 </next>
                                                                                                               </block>
                                                                                                             </statement>
                                                                                                           </block>
                                                                                                         </next>
                                                                                                       </block>
                                                                                                     </next>
                                                                                                   </block>
                                                                                                 </next>
                                                                                               </block>
                                                                                             </next>
                                                                                           </block>
                                                                                         </next>
                                                                                       </block>
                                                                                     </next>
                                                                                   </block>
                                                                                 </next>
                                                                               </block>
                                                                             </next>
                                                                           </block>
                                                                         </next>
                                                                       </block>
                                                                     </next>
                                                                   </block>
                                                                 </next>
                                                               </block>
                                                             </next>
                                                           </block>
                                                         </next>
                                                       </block>
                                                     </statement>
                                                   </block>
                                                 </next>
                                               </block>
                                             </next>
                                           </block>
                                          </xml>
                                          

                                          Anpassen müsst Ihr:

                                          In der JavaScript-Funktion SendTo_SQL_storeState den Namen des Ziel-Datenpunktes:
                                          40558805-14b2-4080-9681-84d67524a428-image.png
                                          gelb markiert:
                                          84a72c5c-f34e-4793-8174-a9eb2ee5e8ad-image.png

                                          Das gleiche in der JavaScript-Funktion SendTo_SQL_DeleteAll
                                          91c29379-c885-4fef-b5b4-c710f95d35ff-image.png

                                          Und im Kopf den Quellpfad zu eurer Anlage:
                                          46235a8d-a6ad-44ff-8668-09fe532644d5-image.png

                                          Und ob Ihr es in kWh oder Wh haben wollt:
                                          cdba127d-a976-408f-a313-22f6ba0d77e3-image.png
                                          (die x 1000 entfernen oder durch 1 Ersetzen bei kWh)

                                          Wenn Ihr das Skript startet passiert erst einmal nichts. Erst wenn neue Daten reinkämen.
                                          Zum Testen könntet Ihr

                                          • Im Trigger von wurde geändert auf wurde aktualisiert ändern
                                          • den pvforecast Adapter einmal neu starten. Zumindest bei mir holt er dann sofort einmal neue Daten

                                          und schon hat er uns die Werte schön in die Datenbank geschrieben:

                                          MariaDB [iobroker]> select * from ts_number where id = '95';
                                          +----+---------------+------+------+-------+------+
                                          | id | ts            | val  | ack  | _from | q    |
                                          +----+---------------+------+------+-------+------+
                                          | 95 | 1646287082001 |    0 |    1 |     0 |    0 |
                                          | 95 | 1646288940000 |   29 |    1 |     0 |    0 |
                                          | 95 | 1646290802000 |  146 |    1 |     0 |    0 |
                                          | 95 | 1646294400000 |  247 |    1 |     0 |    0 |
                                          | 95 | 1646298000000 |  377 |    1 |     0 |    0 |
                                          | 95 | 1646301600000 |  422 |    1 |     0 |    0 |
                                          | 95 | 1646305200000 |  428 |    1 |     0 |    0 |
                                          | 95 | 1646308800000 |  383 |    1 |     0 |    0 |
                                          | 95 | 1646312400000 |  317 |    1 |     0 |    0 |
                                          | 95 | 1646316000000 |  222 |    1 |     0 |    0 |
                                          | 95 | 1646319600000 |  113 |    1 |     0 |    0 |
                                          | 95 | 1646323200000 |   34 |    1 |     0 |    0 |
                                          | 95 | 1646326800000 |    8 |    1 |     0 |    0 |
                                          | 95 | 1646327160000 |    2 |    1 |     0 |    0 |
                                          | 95 | 1646327460000 |    0 |    1 |     0 |    0 |
                                          | 95 | 1646373360000 |    0 |    1 |     0 |    0 |
                                          | 95 | 1646375280000 |   36 |    1 |     0 |    0 |
                                          | 95 | 1646377200000 |  180 |    1 |     0 |    0 |
                                          | 95 | 1646380800000 |  284 |    1 |     0 |    0 |
                                          | 95 | 1646384400000 |  360 |    1 |     0 |    0 |
                                          | 95 | 1646388000000 |  401 |    1 |     0 |    0 |
                                          | 95 | 1646391600000 |  406 |    1 |     0 |    0 |
                                          | 95 | 1646395200000 |  372 |    1 |     0 |    0 |
                                          | 95 | 1646398800000 |  310 |    1 |     0 |    0 |
                                          | 95 | 1646402400000 |  218 |    1 |     0 |    0 |
                                          | 95 | 1646406000000 |  114 |    1 |     0 |    0 |
                                          | 95 | 1646409600000 |   35 |    1 |     0 |    0 |
                                          | 95 | 1646413200000 |    8 |    1 |     0 |    0 |
                                          | 95 | 1646413620000 |    2 |    1 |     0 |    0 |
                                          | 95 | 1646413980000 |    0 |    1 |     0 |    0 |
                                          +----+---------------+------+------+-------+------+
                                          30 rows in set (0.001 sec)
                                          
                                          

                                          Die kann man jetzt in echarts etc. verwenden.

                                          Woran ich noch verzweifle:

                                          // Alles löschen
                                          sendTo("sql.0", "deleteAll", {
                                              "id": '0_userdata.0.Solaranlage.pvforecast',
                                          }, async function (result) {
                                                console.log(result);
                                          });
                                          

                                          Wie schaffe ich es auch den Wert von id als Variable zu übergeben?
                                          Daran habe ich nämlich 90% der Zeit gesessen. Zuerst habe ich es vergeblich mit dem Blockly-SendTo Block versucht (aber der hat es immer falsch formatiert gesendet) und dann wie ich die festen Werte durch Variablen ersetze.

                                          sonnenscheinS Offline
                                          sonnenscheinS Offline
                                          sonnenschein
                                          schrieb am zuletzt editiert von
                                          #315

                                          @bananajoe
                                          Hallo !

                                          Ich habe jetzt schon ne ganze weile versucht das Thema Forecast per script zu erledigen da ja SQL schreiben aus dem Adapter nicht verfügbar ist. Bin aber nicht final fertig geworden.
                                          Evtl. hilft dir dieser Schnipsel weiter.
                                          Nicht wundern die Variablen sind alle zum "Spielen" damit ich den sendto überhaupt fehlerfrei bekommen habe.
                                          Auch ob die variable als var, let oder const definiert werden muß habe ich noch nicht ganz verstanden

                                          //Mit iobroker Javascript sql abfragen ID ermittel und dann in SQL per ID schreiben
                                          var zielid = "0_userdata.0.WriteSQL.05:00:00"; // ID von meinem Testdatenpunkt unter "ziel"
                                          var ziel = "0_userdata.0.WriteSQL.WertAna01"; // Datenpunkt als Ziel
                                          var quell = "pvforecast.1.summary.JSONTable"; // Quelle aus dem JSON String
                                          var werttype = 0; // if datapoints type number set 0; string set 1; boolean set 2
                                          var wert = 4321; // Testwert der geschrieben werden soll
                                          var datenbank = "iobroker"; // name der datenbank des sql server
                                          var dbtabelle = '.datapoints'; // hier sthen die Dataenpunkte druin und man kann die ID dazu finden
                                          var sqlInstanz = "sql.0"; // aktuelle INstanznummer meines SQL Adapters
                                          var zieltabelle = '.ts_number'; // das ist die tabelle mit den Werten der Datenpunkt ID
                                          var ack = 1 // bestätigungsbit in der datenbantabelle
                                          let tabfrom = 5;// von wo kommen die Daten 5 ist java adapter
                                          let q = 0;
                                          const zeitpunkt = new Date(); // aktuellen zeitpunkt
                                          let unixzeitpunkt = zeitpunkt.getTime();// Spukt mir einen Unixzeitstempel aus!
                                          console.log("Aktueller Zeitpunkt ist Kir:" + unixzeitpunkt);
                                          let tswert = 1646066415926
                                          // SQL Abfrage
                                          // ----------- in Tab Datapoint die ID finden, steht dann in result.result.[0], damit dann in die tab ts_number schreiben will 
                                              sendTo(sqlInstanz, 'query', ('SELECT id FROM' + ' ' + datenbank + dbtabelle + ' ' + 'WHERE name =\'' + zielid + '\''), function (result) {  
                                          if (result.error) { 
                                          console.error(result.error);
                                          }
                                          else{
                                             sendTo(sqlInstanz, 'query', 'INSERT INTO' + ' ' + datenbank + zieltabelle + ' ' + '(id, ts, val, ack, _from, q)' + ' VALUES(' + result.result[0].id + ', '+ unixzeitpunkt + ', '+ wert + ', '+ ack + ', ' + tabfrom + ', ' + q);
                                          }
                                          });
                                          

                                          PlatformBetriebssystem:linux Architektur:arm64 CPUs:4 Geschwindigkeit:1800 MHz Modell:Cortex-A72
                                          RAM:3.7 GB System-Betriebszeit:00:19:02 Node.js:v20.18.0
                                          _nodeCurrent:20.18.0
                                          _npmCurrent:10.8.2
                                          Operating System: Debian GNU/Linux 12 (bookworm) Kernel: Linux 6.6.57-v8+

                                          1 Antwort Letzte Antwort
                                          0
                                          Antworten
                                          • In einem neuen Thema antworten
                                          Anmelden zum Antworten
                                          • Älteste zuerst
                                          • Neuste zuerst
                                          • Meiste Stimmen


                                          Support us

                                          ioBroker
                                          Community Adapters
                                          Donate

                                          809

                                          Online

                                          32.4k

                                          Benutzer

                                          81.5k

                                          Themen

                                          1.3m

                                          Beiträge
                                          Community
                                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                                          ioBroker Community 2014-2025
                                          logo
                                          • Anmelden

                                          • Du hast noch kein Konto? Registrieren

                                          • Anmelden oder registrieren, um zu suchen
                                          • Erster Beitrag
                                            Letzter Beitrag
                                          0
                                          • Home
                                          • Aktuell
                                          • Tags
                                          • Ungelesen 0
                                          • Kategorien
                                          • Unreplied
                                          • Beliebt
                                          • GitHub
                                          • Docu
                                          • Hilfe