Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Konvertierung von Zeitraum Datum/Uhrzeit aus JSON

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Konvertierung von Zeitraum Datum/Uhrzeit aus JSON

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

      Hier mal das Beispiel dieses Threads in NodeRed umgesetzt:

      e693097e-7ac1-4e18-b85d-31bf0a261059-image.png

      [
         {
             "id": "6b221f540253d656",
             "type": "ioBroker in",
             "z": "7e6af0015415146d",
             "name": "",
             "topic": "0_userdata.0.Test.meteoalarm",
             "payloadType": "value",
             "onlyack": "",
             "func": "all",
             "gap": "",
             "fireOnStart": "false",
             "outFormat": "MQTT",
             "x": 140,
             "y": 4240,
             "wires": [
                 [
                     "0262326a57a3e1be"
                 ]
             ]
         },
         {
             "id": "0262326a57a3e1be",
             "type": "json",
             "z": "7e6af0015415146d",
             "name": "",
             "property": "payload",
             "action": "",
             "pretty": false,
             "x": 350,
             "y": 4240,
             "wires": [
                 [
                     "fc867d5b79432725"
                 ]
             ]
         },
         {
             "id": "fc867d5b79432725",
             "type": "change",
             "z": "7e6af0015415146d",
             "name": "Berechne und Extrahiere",
             "rules": [
                 {
                     "t": "set",
                     "p": "payload",
                     "pt": "msg",
                     "to": "$map($split(payload[0].Effective,\" - \"),function($val){$moment($val,\"dd. HH:mm\",\"de\") })",
                     "tot": "jsonata"
                 },
                 {
                     "t": "set",
                     "p": "payload[1]",
                     "pt": "msg",
                     "to": "$moment($$.payload[1]).isBefore($$.payload[0]) ? $moment($$.payload[1]).add(1,'w') : $$.payload[1]",
                     "tot": "jsonata"
                 },
                 {
                     "t": "set",
                     "p": "aktiv",
                     "pt": "msg",
                     "to": "$moment().isBetween($$.payload[0],$$.payload[1]) ",
                     "tot": "jsonata"
                 },
                 {
                     "t": "set",
                     "p": "payload",
                     "pt": "msg",
                     "to": "{\t   \"Beginn\":$moment(payload[0]).tz('Europe/Berlin').format(\t       '[am:] dddd, [den] DD.MM.YYYY [um:] HH:mm'\t   ),\t   \"Ende\":$moment(payload[1]).tz('Europe/Berlin').format(\t       '[am:] dddd, [den] DD.MM.YYYY [um:] HH:mm'\t   ) \t}",
                     "tot": "jsonata"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 550,
             "y": 4240,
             "wires": [
                 [
                     "14da7f1f08c8b7d3",
                     "28adc5134af8df02"
                 ]
             ]
         },
         {
             "id": "14da7f1f08c8b7d3",
             "type": "debug",
             "z": "7e6af0015415146d",
             "name": "Extrahiere Anfang und Ende",
             "active": true,
             "tosidebar": true,
             "console": false,
             "tostatus": false,
             "complete": "payload",
             "targetType": "msg",
             "statusVal": "",
             "statusType": "auto",
             "x": 840,
             "y": 4180,
             "wires": []
         },
         {
             "id": "240b27628aa1db02",
             "type": "debug",
             "z": "7e6af0015415146d",
             "name": "Text für Telegramm",
             "active": true,
             "tosidebar": true,
             "console": false,
             "tostatus": false,
             "complete": "payload",
             "targetType": "msg",
             "statusVal": "",
             "statusType": "auto",
             "x": 1170,
             "y": 4240,
             "wires": []
         },
         {
             "id": "1f47709675c2bb30",
             "type": "template",
             "z": "7e6af0015415146d",
             "name": "",
             "field": "payload",
             "fieldType": "msg",
             "format": "handlebars",
             "syntax": "mustache",
             "template": "Aktive Wetterwarnung !!!\nBeginn: {{payload.Beginn}}\nEnde: {{payload.Ende}}",
             "output": "str",
             "x": 980,
             "y": 4240,
             "wires": [
                 [
                     "240b27628aa1db02"
                 ]
             ]
         },
         {
             "id": "28adc5134af8df02",
             "type": "switch",
             "z": "7e6af0015415146d",
             "name": "Aktive Warnung?",
             "property": "aktiv",
             "propertyType": "msg",
             "rules": [
                 {
                     "t": "true"
                 }
             ],
             "checkall": "true",
             "repair": false,
             "outputs": 1,
             "x": 790,
             "y": 4240,
             "wires": [
                 [
                     "1f47709675c2bb30"
                 ]
             ]
         }
      ]
      

      1 Reply Last reply Reply Quote 0
      • M
        memberx last edited by

        @mickym Wie kompliziert ist Node Red denn zu lernen? Gibt es Kosten? Sieht etwas zu einfach aus, einfach ektrahiere, kommt sicher noch etwas mehr dazu oder? 🙂

        mickym 2 Replies Last reply Reply Quote 0
        • mickym
          mickym Most Active @memberx last edited by

          @memberx Nein Kosten gibt es keine. So wie Blockly ursprünglich von Google entwickelt wurde, so wurde NodeRed von der IBM entwickelt und beides so ca. 2016 der OpenSource Community zur Weiterentwicklung gegeben. (s. https://de.wikipedia.org/wiki/Node-RED)

          Ja das tolle an NodeRed ist eben, dass Du auch komplizierte Dinge in diesen Knoten verstecken kannst und deshalb in meinen Augen einen viel besseren Überblick über die Funktionsweise der Knoten hast und leicht einfach mal ein Kabel kappen kannst oder eines hinzufügen kannst.

          Ich habe aber auch in Deinem Blockly JSONATA verwendet - das ist sehr mächtig aber nicht ganz einfach zu lernen.
          Die Logik ist in 4 Regeln mit JSONATA Code versteckt:

          de8fa7e4-db83-46d2-aef2-b6544ccb8d36-image.png

          Man kann es auch mit mehr Knoten aufdröseln, wenn einem das zu kompliziert ist und man nicht soviel Programmsprache kann. Ich zeig Dir noch eine Version in der man weniger Code schreibt - die moments Bibliothek da gibts ein eigenes Verzeichnis - da diese für die Zeitberechnung sehr mächtig ist: https://momentjs.com/docs/#/displaying/format/

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

            @memberx Ich hab alles mal in Einzelschritte zerlegt - wie gesagt mit der Moments Bibliothek bei Datums - und Zeitberechnungen muss man sich bissi beschäftigen:

            3c3fb858-d8a9-4ab6-9b72-85ca8cf87467-image.png

            ansonsten enthält jetzt quasi jede Node nur noch einen Schritt.

            [
               {
                   "id": "4ccc5df4d865b87c",
                   "type": "debug",
                   "z": "7e6af0015415146d",
                   "name": "in schön",
                   "active": true,
                   "tosidebar": true,
                   "console": false,
                   "tostatus": false,
                   "complete": "payload",
                   "targetType": "msg",
                   "statusVal": "",
                   "statusType": "auto",
                   "x": 3280,
                   "y": 3680,
                   "wires": []
               },
               {
                   "id": "d903332e86918bee",
                   "type": "debug",
                   "z": "7e6af0015415146d",
                   "name": "Text für Telegramm",
                   "active": true,
                   "tosidebar": true,
                   "console": false,
                   "tostatus": false,
                   "complete": "payload",
                   "targetType": "msg",
                   "statusVal": "",
                   "statusType": "auto",
                   "x": 3370,
                   "y": 3580,
                   "wires": []
               },
               {
                   "id": "be54b18dfc9929a0",
                   "type": "template",
                   "z": "7e6af0015415146d",
                   "name": "",
                   "field": "payload",
                   "fieldType": "msg",
                   "format": "handlebars",
                   "syntax": "mustache",
                   "template": "Aktive Wetterwarnung !!!\nBeginn: {{payload.Beginn}}\nEnde: {{payload.Ende}}",
                   "output": "str",
                   "x": 3180,
                   "y": 3580,
                   "wires": [
                       [
                           "d903332e86918bee"
                       ]
                   ]
               },
               {
                   "id": "b273529fd5ba628d",
                   "type": "split",
                   "z": "7e6af0015415146d",
                   "name": "",
                   "splt": " - ",
                   "spltType": "str",
                   "arraySplt": 1,
                   "arraySpltType": "len",
                   "stream": false,
                   "addname": "",
                   "x": 2450,
                   "y": 3400,
                   "wires": [
                       [
                           "070bbe468ca3eb44",
                           "faef99f46925cb1e"
                       ]
                   ]
               },
               {
                   "id": "1f87292f1df6e20c",
                   "type": "change",
                   "z": "7e6af0015415146d",
                   "name": "Extrahiere Effective",
                   "rules": [
                       {
                           "t": "set",
                           "p": "payload",
                           "pt": "msg",
                           "to": "payload[0].Effective",
                           "tot": "msg"
                       }
                   ],
                   "action": "",
                   "property": "",
                   "from": "",
                   "to": "",
                   "reg": false,
                   "x": 2270,
                   "y": 3400,
                   "wires": [
                       [
                           "b273529fd5ba628d",
                           "cb1d4ed32547d7c4"
                       ]
                   ]
               },
               {
                   "id": "45ec520a6208783f",
                   "type": "inject",
                   "z": "7e6af0015415146d",
                   "name": "",
                   "props": [
                       {
                           "p": "payload"
                       }
                   ],
                   "repeat": "",
                   "crontab": "",
                   "once": false,
                   "onceDelay": 0.1,
                   "topic": "",
                   "payload": "[{\"Event\":\"Giallo Pioggia Allerta\",\"Description\":\"Sono previsti fenomeni meteorologici di moderata intensità\\n (DISCLAIMER: \\\"Le informazioni fornite su METEOALARM per l'Italia riguardano esclusivamente l'intensità e la ricorrenza dei fenomeni, maggiori dettagli sono disponibili su www.meteoam.it. Le informazioni METEOALARM non forniscono la valutazione di impatto sul territorio e non rappresentano i messaggi di Allerta Ufficiali che vengono emessi dal Servizio Nazionale di Protezione Civile https://www.protezionecivile.gov.it\\\")\",\"Level\":2,\"Effective\":\"Sa. 09:00 - So. 01:59\",\"Icon\":\"/meteoalarm.admin/icons/black/t10.png\",\"AlarmType\":\"Regen\"},{\"Event\":\"Giallo Temporali Allerta\",\"Description\":\"Sono previsti fenomeni meteorologici di moderata intensità\\n (DISCLAIMER: \\\"Le informazioni fornite su METEOALARM per l'Italia riguardano esclusivamente l'intensità e la ricorrenza dei fenomeni, maggiori dettagli sono disponibili su www.meteoam.it. Le informazioni METEOALARM non forniscono la valutazione di impatto sul territorio e non rappresentano i messaggi di Allerta Ufficiali che vengono emessi dal Servizio Nazionale di Protezione Civile https://www.protezionecivile.gov.it\\\")\",\"Level\":2,\"Effective\":\"Sa. 09:00 - So. 01:59\",\"Icon\":\"/meteoalarm.admin/icons/black/t3.png\",\"AlarmType\":\"Blitz und Donner\"}]",
                   "payloadType": "json",
                   "x": 2070,
                   "y": 3400,
                   "wires": [
                       [
                           "1154820b84dcbff6",
                           "1f87292f1df6e20c"
                       ]
                   ]
               },
               {
                   "id": "1154820b84dcbff6",
                   "type": "debug",
                   "z": "7e6af0015415146d",
                   "name": "Input ist ein JSON Objekt",
                   "active": true,
                   "tosidebar": true,
                   "console": false,
                   "tostatus": false,
                   "complete": "payload",
                   "targetType": "msg",
                   "statusVal": "",
                   "statusType": "auto",
                   "x": 2290,
                   "y": 3340,
                   "wires": []
               },
               {
                   "id": "cb1d4ed32547d7c4",
                   "type": "debug",
                   "z": "7e6af0015415146d",
                   "name": "Effektive des 1.Objektes extrahiert",
                   "active": true,
                   "tosidebar": true,
                   "console": false,
                   "tostatus": false,
                   "complete": "payload",
                   "targetType": "msg",
                   "statusVal": "",
                   "statusType": "auto",
                   "x": 2560,
                   "y": 3460,
                   "wires": []
               },
               {
                   "id": "08aa9f357ae2b7f2",
                   "type": "join",
                   "z": "7e6af0015415146d",
                   "name": "",
                   "mode": "custom",
                   "build": "array",
                   "property": "payload",
                   "propertyType": "msg",
                   "key": "topic",
                   "joiner": "\\n",
                   "joinerType": "str",
                   "accumulate": false,
                   "timeout": "",
                   "count": "2",
                   "reduceRight": false,
                   "reduceExp": "",
                   "reduceInit": "",
                   "reduceInitType": "",
                   "reduceFixup": "",
                   "x": 2870,
                   "y": 3400,
                   "wires": [
                       [
                           "fa7e2ea550e7514e",
                           "3fb465f4d5b1624b"
                       ]
                   ]
               },
               {
                   "id": "070bbe468ca3eb44",
                   "type": "debug",
                   "z": "7e6af0015415146d",
                   "name": "erstelle Einzelnachrichten",
                   "active": false,
                   "tosidebar": true,
                   "console": false,
                   "tostatus": false,
                   "complete": "payload",
                   "targetType": "msg",
                   "statusVal": "",
                   "statusType": "auto",
                   "x": 2670,
                   "y": 3340,
                   "wires": []
               },
               {
                   "id": "fa7e2ea550e7514e",
                   "type": "debug",
                   "z": "7e6af0015415146d",
                   "name": "Erstelle Array aus Einzelnachrichten",
                   "active": true,
                   "tosidebar": true,
                   "console": false,
                   "tostatus": false,
                   "complete": "payload",
                   "targetType": "msg",
                   "statusVal": "",
                   "statusType": "auto",
                   "x": 3130,
                   "y": 3460,
                   "wires": []
               },
               {
                   "id": "faef99f46925cb1e",
                   "type": "change",
                   "z": "7e6af0015415146d",
                   "name": "erstelle Datum und Uhrzeit",
                   "rules": [
                       {
                           "t": "set",
                           "p": "payload",
                           "pt": "msg",
                           "to": "$moment(payload,\"dd. HH:mm\",\"de\")",
                           "tot": "jsonata"
                       }
                   ],
                   "action": "",
                   "property": "",
                   "from": "",
                   "to": "",
                   "reg": false,
                   "x": 2660,
                   "y": 3400,
                   "wires": [
                       [
                           "08aa9f357ae2b7f2",
                           "4f683133ce85b697"
                       ]
                   ]
               },
               {
                   "id": "4f683133ce85b697",
                   "type": "debug",
                   "z": "7e6af0015415146d",
                   "name": "vollständiges Datum und Uhrzeit",
                   "active": true,
                   "tosidebar": true,
                   "console": false,
                   "tostatus": false,
                   "complete": "payload",
                   "targetType": "msg",
                   "statusVal": "",
                   "statusType": "auto",
                   "x": 3010,
                   "y": 3340,
                   "wires": []
               },
               {
                   "id": "3fb465f4d5b1624b",
                   "type": "switch",
                   "z": "7e6af0015415146d",
                   "name": "Ist Ende vor Anfang?",
                   "property": "$moment($$.payload[1]).isBefore($$.payload[0])",
                   "propertyType": "jsonata",
                   "rules": [
                       {
                           "t": "true"
                       },
                       {
                           "t": "false"
                       }
                   ],
                   "checkall": "true",
                   "repair": false,
                   "outputs": 2,
                   "x": 3080,
                   "y": 3400,
                   "wires": [
                       [
                           "a8aada056e2343e3"
                       ],
                       [
                           "179169cf0de101fe"
                       ]
                   ]
               },
               {
                   "id": "a8aada056e2343e3",
                   "type": "change",
                   "z": "7e6af0015415146d",
                   "name": "addiere 1 Woche zu Ende",
                   "rules": [
                       {
                           "t": "set",
                           "p": "payload[1]",
                           "pt": "msg",
                           "to": "$moment($$.payload[1]).add(1,'w')",
                           "tot": "jsonata"
                       }
                   ],
                   "action": "",
                   "property": "",
                   "from": "",
                   "to": "",
                   "reg": false,
                   "x": 3330,
                   "y": 3360,
                   "wires": [
                       [
                           "179169cf0de101fe"
                       ]
                   ]
               },
               {
                   "id": "c35d1bedaa326b46",
                   "type": "change",
                   "z": "7e6af0015415146d",
                   "name": "Mach schönes Format",
                   "rules": [
                       {
                           "t": "set",
                           "p": "payload",
                           "pt": "msg",
                           "to": "{    \"Beginn\":$moment(payload[0]).tz('Europe/Berlin').format(        '[am:] dddd, [den] DD.MM.YYYY [um:] HH:mm'    ),    \"Ende\":$moment(payload[1]).tz('Europe/Berlin').format(        '[am:] dddd, [den] DD.MM.YYYY [um:] HH:mm'    )  }",
                           "tot": "jsonata"
                       }
                   ],
                   "action": "",
                   "property": "",
                   "from": "",
                   "to": "",
                   "reg": false,
                   "x": 2960,
                   "y": 3580,
                   "wires": [
                       [
                           "4ccc5df4d865b87c",
                           "be54b18dfc9929a0"
                       ]
                   ]
               },
               {
                   "id": "503a4d422934e44c",
                   "type": "switch",
                   "z": "7e6af0015415146d",
                   "name": "Aktive Warnung?",
                   "property": "aktiv",
                   "propertyType": "msg",
                   "rules": [
                       {
                           "t": "true"
                       }
                   ],
                   "checkall": "true",
                   "repair": false,
                   "outputs": 1,
                   "x": 2730,
                   "y": 3580,
                   "wires": [
                       [
                           "c35d1bedaa326b46"
                       ]
                   ]
               },
               {
                   "id": "179169cf0de101fe",
                   "type": "change",
                   "z": "7e6af0015415146d",
                   "name": "",
                   "rules": [
                       {
                           "t": "set",
                           "p": "aktiv",
                           "pt": "msg",
                           "to": "$moment().isBetween($$.payload[0],$$.payload[1]) ",
                           "tot": "jsonata"
                       }
                   ],
                   "action": "",
                   "property": "",
                   "from": "",
                   "to": "",
                   "reg": false,
                   "x": 3560,
                   "y": 3400,
                   "wires": [
                       [
                           "503a4d422934e44c"
                       ]
                   ]
               }
            ]
            

            Der Vorteil in NodeRed ist übrigens auch, dass man mit einer Inject Node die eingehenden Daten direkt testen kann ohne über einen Datenpunkt triggern zu müssen.

            1 Reply Last reply Reply Quote 1
            • M
              memberx last edited by memberx

              @mickym Lol, jetzt hab ich schon wieder was entdeckt, offenbar wird das Ende der Warnungen nicht immer mit Tag angegeben, wenn es bspw. nur ein paar Stunden aktiv ist am gleichen Tag. Da stoppt das Script dann weil das Ende nicht funktioniert.

              [{"Event":"WINDBÖEN","Description":"Es treten Windböen mit Geschwindigkeiten um 55 km/h (15 m/s, 30 kn, Bft 7) aus südwestlicher Richtung auf.","Level":2,"Effective":"So. 12:00 - 16:00","Icon":"/meteoalarm.admin/icons/black/t1.png","AlarmType":"Wind"}]
              
              22.10.2023, 13:29:57.617	[info ]: javascript.0 (201) Stop script script.js.Test_Wetterwarnungen
              22.10.2023, 13:29:57.705	[info ]: javascript.0 (201) Start javascript script.js.Test_Wetterwarnungen
              22.10.2023, 13:29:57.709	[info ]: javascript.0 (201) script.js.Test_Wetterwarnungen: registered 1 subscription, 0 schedules, 0 messages, 0 logs and 0 file subscriptions
              22.10.2023, 13:30:03.023	[info ]: javascript.0 (201) script.js.Test_Wetterwarnungen: {'Event':'WINDBÖEN','Description':'Es treten Windböen mit Geschwindigkeiten um 55 km/h (15 m/s, 30 kn, Bft 7) aus südwestlicher Richtung auf.','Level':2,'Effective':'So. 12:00 - 16:00','Icon':'/meteoalarm.admin/icons/black/t1.png','AlarmType':'Wind'}
              22.10.2023, 13:30:03.024	[info ]: javascript.0 (201) script.js.Test_Wetterwarnungen: Anfang wird berechnet
              22.10.2023, 13:30:03.024	[info ]: javascript.0 (201) script.js.Test_Wetterwarnungen: 22.10.2023. 12:00
              22.10.2023, 13:30:03.025	[info ]: javascript.0 (201) script.js.Test_Wetterwarnungen: Ende wird berechnet
              22.10.2023, 13:30:03.025	[info ]: javascript.0 (201) script.js.Test_Wetterwarnungen: NaN.NaN.NaN NaN:NaN
              22.10.2023, 13:30:03.025	[info ]: javascript.0 (201) script.js.Test_Wetterwarnungen: false
              
              mickym 1 Reply Last reply Reply Quote 0
              • mickym
                mickym Most Active @memberx last edited by mickym

                @memberx Füge mal diese Bausteine aus dem Spoiler:

                <xml xmlns="https://developers.google.com/blockly/xml">
                 <variables>
                   <variable id="aC((b2L0*@zb-.p|~1/h">Datum</variable>
                   <variable id="18Z@{WD;.Mjb8Xir$J?K">Wochentag</variable>
                   <variable id="..Vyxt!`-weR`@gg9$oi">offsetfDay</variable>
                   <variable id="2e{Y?fWyy-HCr`j33Dpg">Zeit</variable>
                 </variables>
                 <block type="controls_if" id="f$bw;{*2$kVszG=~MyHi" x="-876" y="-305">
                   <value name="IF0">
                     <block type="logic_compare" id="4W~+Hl[7D/;|5paGpvL+">
                       <field name="OP">EQ</field>
                       <value name="A">
                         <block type="variables_get" id="ZDXNoF!O67Q3eHq3i%zd">
                           <field name="VAR" id="18Z@{WD;.Mjb8Xir$J?K">Wochentag</field>
                         </block>
                       </value>
                       <value name="B">
                         <block type="logic_null" id="(:izOT`(@BU~HN]Xx}sb"></block>
                       </value>
                     </block>
                   </value>
                   <statement name="DO0">
                     <block type="variables_set" id=".i~[AsJ~Jm_7/I}40(QM">
                       <field name="VAR" id="aC((b2L0*@zb-.p|~1/h">Datum</field>
                       <value name="VALUE">
                         <block type="convert_from_date" id="4ZZqGR(0~bN/ViEYKSb~">
                           <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="#zB55fwx6zi!4hB,EX5Q">
                               <field name="VAR" id="2e{Y?fWyy-HCr`j33Dpg">Zeit</field>
                             </block>
                           </value>
                         </block>
                       </value>
                       <next>
                         <block type="variables_set" id="_bzE.8`tZ)5VDRaQNxW}">
                           <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field>
                           <value name="VALUE">
                             <block type="math_number" id="=Fpm5_*#I5,ye}V21$T%">
                               <field name="NUM">0</field>
                             </block>
                           </value>
                         </block>
                       </next>
                     </block>
                   </statement>
                 </block>
                </xml>
                

                an markierter Stelle ein:

                1da48511-a0f7-4594-8b87-e9dd84253cf2-image.png

                Damit sollte es wieder tun:

                1b90924b-808d-4736-8b60-2d9046c273cc-image.png

                M 1 Reply Last reply Reply Quote 1
                • M
                  memberx @mickym last edited by memberx

                  @mickym woooooohooo, Du bist der beste. Funktioniert nun auch für diesen Fall.

                  Frage, es gibt ja auch den Fall, dass keine Warnung vorliegt. Siehst Du irgendein Problem darin, dass Script dann einfach in nen Error reinlaufen zu lassen? Ich brauche ja auch keine Meldung wenn nichts vorliegt?

                  Sieht dann so aus

                  22.10.2023, 16:09:02.262	[info ]: javascript.0 (201) script.js.Test_Wetterwarnungen: {'Event':'','Description':'Keine aktuelle Wetterwarnung','Level':'1','Effective':'','Icon':''}
                  22.10.2023, 16:09:02.263	[info ]: javascript.0 (201) script.js.Test_Wetterwarnungen: Anfang wird berechnet
                  22.10.2023, 16:09:02.264	[info ]: javascript.0 (201) script.js.Test_Wetterwarnungen: NaN.NaN.NaN. NaN:NaN
                  22.10.2023, 16:09:02.264	[info ]: javascript.0 (201) script.js.Test_Wetterwarnungen: false
                  
                  mickym 1 Reply Last reply Reply Quote 0
                  • mickym
                    mickym Most Active @memberx last edited by mickym

                    @memberx

                    f0ceda01-6b77-473a-8f5e-08d1b400ff11-image.png

                    Du kannst um das Ganze (aber innerhalb des Triggers - s. Markierung), also nachdem Versuch das Attribut Effective aus dem Objekt zu extrahieren, noch eine Bedingung setzen - dann wird das ganze nur ausgeführt, wenn Effective gefüllt ist.

                    Mal blöde Frage ist eigentlich in dem Ordner das ganze nicht in einzelne Punkte aufgefdröselt?

                    Ich meine unter alarms?

                    d6a2d078-d2f2-4fc7-98da-397a6507daa8-image.png

                    M 1 Reply Last reply Reply Quote 1
                    • M
                      memberx @mickym last edited by memberx

                      @mickym said in Konvertierung von Zeitraum Datum/Uhrzeit aus JSON:

                      Mal blöde Frage ist eigentlich in dem Ordner das ganze nicht in einzelne Punkte aufgefdröselt?

                      schön wärs wenn die einfach Anfang ende usw. auch einzeln hätten, aber leider gibts fast nix als einzelne Punkte.

                      Bildschirmfoto 2023-10-22 um 16.28.35.png

                      In Alarms ist gar nichts

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

                        @memberx na unter alarms. Mach den Ordner mal auf

                        M 1 Reply Last reply Reply Quote 0
                        • M
                          memberx @mickym last edited by

                          @mickym Oh man, ich hab den Ordner schon mehrmals angeklickt, aber offenbar immer wenn keine Warnung vorlag, dann ist öffnet der sich nämlich gar nicht, weil nichts drin ist.

                          So ein Mist, aber ich hab sehr sehr viel für künftige Sachen lernen können dank Dir. Und mal ne Frage, wie würde man das handhaben, wenn der Ordner ohne Warnung leer ist und nur bei ner Warnung was beinhaltet?

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

                            @memberx Nochmal ich kenn den Adapter nicht - aber Du wirst ja auf einzelne Datenpunkte triggern und falls die nicht da sind, kann auch nichts triggern - sprich das Script wird einfach nicht ausgeführt.

                            Sprich Du brauchst nicht mal Zeiten abprüfen. Sind die Datenpunkte da unter alarms - dann ist eine Warnung aktiv, sonst nicht. Einfacher gehts eigentlich nicht.

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

                            Support us

                            ioBroker
                            Community Adapters
                            Donate

                            675
                            Online

                            31.8k
                            Users

                            79.9k
                            Topics

                            1.3m
                            Posts

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