- Home
- Deutsch
- Skripten / Logik
- Blockly
- Konvertierung von Zeitraum Datum/Uhrzeit aus JSON
Konvertierung von Zeitraum Datum/Uhrzeit aus JSON
-
Hallo an alle. Wie kann ich mit Blockly aus einer JSON Datei bzw. String das Datum herauslesen bzw. einen Zeitraum. Und wie kann ich ein Symbol aus gleichem verwenden?
Format sieht wie folgt aus:
"Effective":"Do. 12:00 - Sa. 00:00"
Ist dann natürlich der nä. kommenden (in diesem Fall Donnerstag) gemeint.
Am besten wie ich Anfang und Ende daraus lesen kann.
-
Also ohne Bibliothek ist es schwierig - ich merke auch immer wieder wie umständlich das Puzzeln ist und wie man das javascript teilweise inkonsequent umsetzt - aber egal. Hier mal ein Vorschlag - auch wenn die Sommer- und Winterzeit - falls die in den Zeitraum fällt nicht berücksichtigt wird. Das musst dann mit einer Bibliothek machen oder halt 2 mal im Jahr damit leben.
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="NL2KE=!}Zmt$hJQhH5V;">Effective</variable> <variable id="!BKERwI$xoYSsO$e/!+-">Heute</variable> <variable id="zI%s0A5p2Gpr5vX$g@|}">Element</variable> <variable id="2e{Y?fWyy-HCr`j33Dpg">Zeit</variable> <variable id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</variable> <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="%GNLsL32kU#,c`m/:kU,">Ende</variable> <variable id="H*rbj$ZVfoo}B`P#^ISE">Anfang</variable> </variables> <block type="variables_set" id="AQT_dD29iQ%3]/_v}m_F" x="-987" y="-688"> <field name="VAR" id="NL2KE=!}Zmt$hJQhH5V;">Effective</field> <value name="VALUE"> <block type="get_attr" id="w4s.PQ-_Ph`.N`*rtAV}"> <value name="PATH"> <shadow type="text" id="(z*JkCpP9u#h=e;I3_y)"> <field name="TEXT">Effective</field> </shadow> </value> <value name="OBJECT"> <block type="convert_json2object" id="2UGX5=1JwMM~29$-f:|L"> <value name="VALUE"> <block type="text" id="B3YI5l4A]d-{?0qIW/i~"> <field name="TEXT">{"Effective":"Do. 12:00 - So. 00:00"}</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id=".MPR;2b%4`w%Ww{IBD3l"> <field name="VAR" id="!BKERwI$xoYSsO$e/!+-">Heute</field> <value name="VALUE"> <block type="time_get" id="_ii#1cl%HyAe+:8a-}!v"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">wd</field> </block> </value> <next> <block type="controls_if" id="8q8yfyF)ppopq*kWtk4L"> <value name="IF0"> <block type="logic_compare" id="zzA;#!h(e|+!j!$$mapm"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="mt3e~IV+eoQ}|.RobAMy"> <field name="VAR" id="!BKERwI$xoYSsO$e/!+-">Heute</field> </block> </value> <value name="B"> <block type="math_number" id="8llnD`8q%``UKZ7MwAS;"> <field name="NUM">7</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="(7?.MhNKE4_X;l,pII}@"> <field name="VAR" id="!BKERwI$xoYSsO$e/!+-">Heute</field> <value name="VALUE"> <block type="math_number" id="JIKt`hC]5WY}i3A1G?L/"> <field name="NUM">0</field> </block> </value> </block> </statement> <next> <block type="variables_set" id="5K_E;K$P~q/6.|(*zzA?"> <field name="VAR" id="zI%s0A5p2Gpr5vX$g@|}">Element</field> <value name="VALUE"> <block type="math_number" id="vTWr$QzJB;9TW;FNm{;_"> <field name="NUM">0</field> </block> </value> <next> <block type="controls_forEach" id="oc$8$UMKv(pn4Nwa+H}d"> <field name="VAR" id="2e{Y?fWyy-HCr`j33Dpg">Zeit</field> <value name="LIST"> <block type="lists_split" id="gIuNR%ZYq=*l43Q~,WrL"> <mutation mode="SPLIT"></mutation> <field name="MODE">SPLIT</field> <value name="INPUT"> <block type="variables_get" id="PGR#uRAi%Z}*HC=;efZR"> <field name="VAR" id="NL2KE=!}Zmt$hJQhH5V;">Effective</field> </block> </value> <value name="DELIM"> <shadow type="text" id="i::oo9.BKD}I}qIj]=a|"> <field name="TEXT"> - </field> </shadow> </value> </block> </value> <statement name="DO"> <block type="math_change" id="rK6rTY_#w:1ErUCj9%p5"> <field name="VAR" id="zI%s0A5p2Gpr5vX$g@|}">Element</field> <value name="DELTA"> <shadow type="math_number" id="(u}AM,2nE9[ps{TddKa."> <field name="NUM">1</field> </shadow> </value> <next> <block type="variables_set" id="3G0[wq6fJKGGvnSNqV_u"> <field name="VAR" id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</field> <value name="VALUE"> <block type="lists_split" id="pfXE.JlOjmH9ivKh:3R3"> <mutation mode="SPLIT"></mutation> <field name="MODE">SPLIT</field> <value name="INPUT"> <block type="variables_get" id="urR=@xpA#)S51jyoz~=I"> <field name="VAR" id="2e{Y?fWyy-HCr`j33Dpg">Zeit</field> </block> </value> <value name="DELIM"> <shadow type="text" id="b[Xl9r*yH(vcBJp!i*$@"> <field name="TEXT">. </field> </shadow> </value> </block> </value> <next> <block type="variables_set" id="a0!+@)G9|P-pqkKdc*=a"> <field name="VAR" id="aC((b2L0*@zb-.p|~1/h">Datum</field> <value name="VALUE"> <block type="convert_from_date" id="2]KFb.uVH._L%r^i9F-z"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="lists_getIndex" id=";Wq_qJbNYp``_u)qDcrJ"> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="variables_get" id="$Kg[(NvER[{te#WanzRI"> <field name="VAR" id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</field> </block> </value> <value name="AT"> <block type="math_number" id=":7~%X@%Djm!BL~-[fM4%"> <field name="NUM">2</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="s~C8AxeBgk)4Ld2NXfTL"> <field name="VAR" id="18Z@{WD;.Mjb8Xir$J?K">Wochentag</field> <value name="VALUE"> <block type="convert_jsonata" id="y!;v@NW$i`XyA%jb`3U^"> <value name="EXPRESSION"> <shadow type="text" id="][6M8SS*~^WHHg2SEDE)"> <field name="TEXT">(["So","Mo","Di","Mi","Do","Fr","Sa"])#$i@$n[$n=$$].$i</field> </shadow> </value> <value name="TARGET"> <block type="lists_getIndex" id="EeBu~-P=bqaYuO7c7I4S"> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="variables_get" id="=PF8|9m]ZKNaM-oHn6zx"> <field name="VAR" id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</field> </block> </value> <value name="AT"> <block type="math_number" id="vRVq}|eVwq7M^n)f|9nj"> <field name="NUM">1</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="+o:NShBOKW(bUMb)5g0f"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> <value name="VALUE"> <block type="math_arithmetic" id="vZf-i,pcMomv4N(dwL`m"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="yGV4LkTaAu%P?)vicUDA"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="`o@)-)K!;[i|=2=,|0*{"> <field name="VAR" id="18Z@{WD;.Mjb8Xir$J?K">Wochentag</field> </block> </value> <value name="B"> <shadow type="math_number" id="E3#SX(8`!O,e{c2kM_y:"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="kTRw@Iv*W|oKk?9970Qk"> <field name="VAR" id="!BKERwI$xoYSsO$e/!+-">Heute</field> </block> </value> </block> </value> <next> <block type="logic_switch_case" id="Xg9jIS0xc[E8cO{$n:jr"> <mutation xmlns="http://www.w3.org/1999/xhtml" case="1"></mutation> <value name="CONDITION"> <block type="variables_get" id="[Ea?=J.5C`Z+qqvnh*i)"> <field name="VAR" id="zI%s0A5p2Gpr5vX$g@|}">Element</field> </block> </value> <value name="CASECONDITION0"> <block type="math_number" id="TC6Zelwc!hEJ3;NXiDqx"> <field name="NUM">1</field> </block> </value> <statement name="CASE0"> <block type="debug" id="[)8`!K$vR-qfui-ox$Ap"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="1B8:~vIL:j#B[ZS$Bl+["> <field name="TEXT">Anfang wird berechnet</field> </shadow> </value> <next> <block type="logic_switch_case" id="I(qD`kAkQz=S+)*O3^df"> <mutation xmlns="http://www.w3.org/1999/xhtml" case="1"></mutation> <value name="CONDITION"> <block type="logic_boolean" id="=J:`/rlypBwHV4nD5}.2"> <field name="BOOL">TRUE</field> </block> </value> <value name="CASECONDITION0"> <block type="logic_compare" id="!pPpNA|HL2E)}}y)`_rQ"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="/ayj9f7ECX)a!*i]OY;/"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> <value name="B"> <block type="math_number" id=")Rm7;w[eW=3N!N`{B8^7"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="CASE0"> <block type="variables_set" id="f]~r)@0sACqIVJXCXO5/"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> <value name="VALUE"> <block type="math_arithmetic" id="1-lJ-HQd2;:7f44xq[iv"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="Lk!KX:}gx|tqn;93qGg0"> <field name="NUM">7</field> </shadow> </value> <value name="B"> <shadow type="math_number" id="PBK]eXt9XhVj}34k|W*e"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="*{LmnFk44C.z]/-ic[DD"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> </block> </value> </block> </statement> <value name="CASECONDITION1"> <block type="logic_compare" id="d6FJ#x4-Ht$YFHY2EKAV"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="OEXP]{gddCeQjdGGJUy#"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> <value name="B"> <block type="math_number" id="L_m2%}`vNl}6ONs(M+fT"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="CASE1"> <block type="controls_if" id=":]U%QcTETe_RXjb3E9KL"> <value name="IF0"> <block type="time_compare_ex" id="zijwn$U~V({3f6Q,5z~h"> <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="false" actual_time="true"></mutation> <field name="USE_ACTUAL_TIME">TRUE</field> <field name="OPTION">></field> <value name="START_TIME"> <shadow type="text" id="8g!VA42bs`q%8)M:c/4)"> <field name="TEXT">12:00</field> </shadow> <block type="lists_getIndex" id="(HH{~kh?-G5Kks9U@Lit"> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="variables_get" id="fJ7Ry{~$327T4=-}!f*R"> <field name="VAR" id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</field> </block> </value> <value name="AT"> <block type="math_number" id="J3kO$YEZ:.A.EK4y/u@C"> <field name="NUM">2</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="pXNO@mAA0iy4XG:}i_MX"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> <value name="VALUE"> <block type="math_number" id="8`zct+{4mh`bwq|l,3ew"> <field name="NUM">7</field> </block> </value> </block> </statement> </block> </statement> <next> <block type="variables_set" id="XMRCFLz^)zGRi!No3=H#"> <field name="VAR" id="H*rbj$ZVfoo}B`P#^ISE">Anfang</field> <value name="VALUE"> <block type="time_calculation" id="bLcSdgA,4$dk]nP7+I.R"> <field name="OPERATION">+</field> <field name="UNIT">day</field> <value name="DATE_TIME"> <shadow type="time_get" id="OQ!LO/xEEDTG7RnPTJWM"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </shadow> <block type="variables_get" id="HP?WwIpo9}yG/mW{^-u#"> <field name="VAR" id="aC((b2L0*@zb-.p|~1/h">Datum</field> </block> </value> <value name="VALUE"> <shadow type="math_number" id="B?L5O:@r3doK=Z,?J7yx"> <field name="NUM">1</field> </shadow> <block type="convert_tonumber" id=".$:w3P.4m3KWMvqiR@[L"> <value name="VALUE"> <block type="variables_get" id="^X+X^-*B$hU/yxDDS@~F"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> </block> </value> </block> </value> <next> <block type="debug" id="F;vxk+EHp*sdUZ`zQ.A/"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="VZEwX$_l_uDYT@Kq?Sd9"> <field name="TEXT">test</field> </shadow> <block type="convert_from_date" id="]OM}1G$+(hd.(]*C:FdI"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ.MM.TT SS:mm:ss.sss</field> <value name="VALUE"> <block type="variables_get" id="I_qmwmsx+oY?Lfnt;.z#"> <field name="VAR" id="H*rbj$ZVfoo}B`P#^ISE">Anfang</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> <value name="CASECONDITION1"> <block type="math_number" id="-H[.==q5F~tgVR1$$G5B"> <field name="NUM">2</field> </block> </value> <statement name="CASE1"> <block type="debug" id="^wJf298~n(zZAwl}{q-8"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="3uq07.Bk:G7IsQn%l[+S"> <field name="TEXT">Ende wird berechnet</field> </shadow> </value> <next> <block type="variables_set" id="AO97yXBqRqp=IRkoJMD!"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> <value name="VALUE"> <block type="time_calculation" id="`|g86n#XJ:8U$EJV~~%}"> <field name="OPERATION">+</field> <field name="UNIT">day</field> <value name="DATE_TIME"> <shadow type="time_get" id="OQ!LO/xEEDTG7RnPTJWM"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </shadow> <block type="variables_get" id="|J.Ezm!e8abp=np6E80;"> <field name="VAR" id="aC((b2L0*@zb-.p|~1/h">Datum</field> </block> </value> <value name="VALUE"> <shadow type="math_number" id="B?L5O:@r3doK=Z,?J7yx"> <field name="NUM">1</field> </shadow> <block type="convert_tonumber" id="M^DGj_]M}s0Q$=p=Rc:W"> <value name="VALUE"> <block type="variables_get" id="!#dF{oRO~R@g18%C{zSC"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> </block> </value> </block> </value> <next> <block type="controls_whileUntil" id="s4Pj)l+0)M0E$MLN$caV"> <field name="MODE">WHILE</field> <value name="BOOL"> <block type="logic_compare" id="?rd7J7K{d}GH$9PkT##n"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="QH_WO[^*K8d(NPI7qnH5"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> </block> </value> <value name="B"> <block type="variables_get" id="j*s6bN1[[6i8k%*`#jl:"> <field name="VAR" id="H*rbj$ZVfoo}B`P#^ISE">Anfang</field> </block> </value> </block> </value> <statement name="DO"> <block type="variables_set" id="e?k;iQDd%9Bx]thjgV-g"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> <value name="VALUE"> <block type="time_calculation" id="5uFkc1O+*GEJ$D@H.I6K"> <field name="OPERATION">+</field> <field name="UNIT">day</field> <value name="DATE_TIME"> <shadow type="time_get" id="OQ!LO/xEEDTG7RnPTJWM"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </shadow> <block type="variables_get" id="*%Cy$u[(jYkxbtb$MQ$["> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> </block> </value> <value name="VALUE"> <shadow type="math_number" id="B?L5O:@r3doK=Z,?J7yx"> <field name="NUM">1</field> </shadow> <block type="convert_tonumber" id="nVA$XHGL-^MV@MR4!?/i"> <value name="VALUE"> <block type="math_number" id="/wlkUgXt%U{.uxc:fAx2"> <field name="NUM">7</field> </block> </value> </block> </value> </block> </value> </block> </statement> <next> <block type="debug" id="VG3MPKS2r3FVr?9wy-G5"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="VZEwX$_l_uDYT@Kq?Sd9"> <field name="TEXT">test</field> </shadow> <block type="convert_from_date" id="(]i*;H5PMZ{=X5qMqBx;"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ.MM.TT SS:mm:ss.sss</field> <value name="VALUE"> <block type="variables_get" id="igY{PNkcotgSQ9MbxV|;"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </xml>
-
@mickym danke, versuche das mal nachzubilden, schade kann man das nicht einfach kopieren
-
@memberx ich hab dir doch den Code zum Import angehängt
-
@mickym muss mal doof fragen, wo geschickt? Wo finde ich das
-
@memberx na mach den Spoiler auf - kopiere es in die Zwischenablage und importiere das Blockly.
-
@mickym hab es jetzt gefunden beim Spoiler, danke testes mal
-
@mickym was muss ich in den Part JSON aus Objekt einfügen, da der Text ja nicht statisch ist sondern entweder aus einer meiner Variable oder aus nem JSON entnommen werden muss:
21.10.2023, 14:03:35.793 [info ]: javascript.0 (11230) Stop script script.js.Datum_auslesen_Meteoalarm
21.10.2023, 14:03:35.881 [info ]: javascript.0 (11230) Start javascript script.js.Datum_auslesen_Meteoalarm
21.10.2023, 14:03:35.885 [info ]: javascript.0 (11230) script.js.Datum_auslesen_Meteoalarm: registered 0 subscriptions, 0 schedules, 0 messages, 0 logs and 0 file subscriptions
21.10.2023, 14:03:35.886 [error]: javascript.0 (11230) script.js.Datum_auslesen_Meteoalarm: TypeError: Cannot read properties of undefined (reading 'split')
21.10.2023, 14:03:35.886 [error]: javascript.0 (11230) at script.js.Datum_auslesen_Meteoalarm:10:27
21.10.2023, 14:03:35.887 [error]: javascript.0 (11230) at script.js.Datum_auslesen_Meteoalarm:55:3 -
@memberx Na das ganze musst halt in einen trigger einbinden - dann kannst Dir die Umwandlung auch sparen. (also JSON nach Objekt), da der trigger automatisch den Wert wohl automatisch in ein Objekt wandelt.
So hier das Ganze direkt im trigger - du musst nur noch den Datenpunkt oben einsetzen.
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="NL2KE=!}Zmt$hJQhH5V;">Effective</variable> <variable id="!BKERwI$xoYSsO$e/!+-">Heute</variable> <variable id="zI%s0A5p2Gpr5vX$g@|}">Element</variable> <variable id="2e{Y?fWyy-HCr`j33Dpg">Zeit</variable> <variable id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</variable> <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="%GNLsL32kU#,c`m/:kU,">Ende</variable> <variable id="H*rbj$ZVfoo}B`P#^ISE">Anfang</variable> </variables> <block type="on_ext" id="31ur5XmPM#E,Lkevb@:A" x="-963" y="-937"> <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="wN=/d(#czqS}S*H_n^Oq"> <field name="oid">default</field> </shadow> </value> <statement name="STATEMENT"> <block type="variables_set" id="AQT_dD29iQ%3]/_v}m_F"> <field name="VAR" id="NL2KE=!}Zmt$hJQhH5V;">Effective</field> <value name="VALUE"> <block type="get_attr" id="w4s.PQ-_Ph`.N`*rtAV}"> <value name="PATH"> <shadow type="text" id="(z*JkCpP9u#h=e;I3_y)"> <field name="TEXT">Effective</field> </shadow> </value> <value name="OBJECT"> <block type="on_source" id="EgAI|_@P}m#5;?T{4?;R"> <field name="ATTR">state.val</field> </block> </value> </block> </value> <next> <block type="variables_set" id=".MPR;2b%4`w%Ww{IBD3l"> <field name="VAR" id="!BKERwI$xoYSsO$e/!+-">Heute</field> <value name="VALUE"> <block type="time_get" id="_ii#1cl%HyAe+:8a-}!v"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">wd</field> </block> </value> <next> <block type="controls_if" id="8q8yfyF)ppopq*kWtk4L"> <value name="IF0"> <block type="logic_compare" id="zzA;#!h(e|+!j!$$mapm"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="mt3e~IV+eoQ}|.RobAMy"> <field name="VAR" id="!BKERwI$xoYSsO$e/!+-">Heute</field> </block> </value> <value name="B"> <block type="math_number" id="8llnD`8q%``UKZ7MwAS;"> <field name="NUM">7</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="(7?.MhNKE4_X;l,pII}@"> <field name="VAR" id="!BKERwI$xoYSsO$e/!+-">Heute</field> <value name="VALUE"> <block type="math_number" id="JIKt`hC]5WY}i3A1G?L/"> <field name="NUM">0</field> </block> </value> </block> </statement> <next> <block type="variables_set" id="5K_E;K$P~q/6.|(*zzA?"> <field name="VAR" id="zI%s0A5p2Gpr5vX$g@|}">Element</field> <value name="VALUE"> <block type="math_number" id="vTWr$QzJB;9TW;FNm{;_"> <field name="NUM">0</field> </block> </value> <next> <block type="controls_forEach" id="oc$8$UMKv(pn4Nwa+H}d"> <field name="VAR" id="2e{Y?fWyy-HCr`j33Dpg">Zeit</field> <value name="LIST"> <block type="lists_split" id="gIuNR%ZYq=*l43Q~,WrL"> <mutation mode="SPLIT"></mutation> <field name="MODE">SPLIT</field> <value name="INPUT"> <block type="variables_get" id="PGR#uRAi%Z}*HC=;efZR"> <field name="VAR" id="NL2KE=!}Zmt$hJQhH5V;">Effective</field> </block> </value> <value name="DELIM"> <shadow type="text" id="i::oo9.BKD}I}qIj]=a|"> <field name="TEXT"> - </field> </shadow> </value> </block> </value> <statement name="DO"> <block type="math_change" id="rK6rTY_#w:1ErUCj9%p5"> <field name="VAR" id="zI%s0A5p2Gpr5vX$g@|}">Element</field> <value name="DELTA"> <shadow type="math_number" id="(u}AM,2nE9[ps{TddKa."> <field name="NUM">1</field> </shadow> </value> <next> <block type="variables_set" id="3G0[wq6fJKGGvnSNqV_u"> <field name="VAR" id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</field> <value name="VALUE"> <block type="lists_split" id="pfXE.JlOjmH9ivKh:3R3"> <mutation mode="SPLIT"></mutation> <field name="MODE">SPLIT</field> <value name="INPUT"> <block type="variables_get" id="urR=@xpA#)S51jyoz~=I"> <field name="VAR" id="2e{Y?fWyy-HCr`j33Dpg">Zeit</field> </block> </value> <value name="DELIM"> <shadow type="text" id="b[Xl9r*yH(vcBJp!i*$@"> <field name="TEXT">. </field> </shadow> </value> </block> </value> <next> <block type="variables_set" id="a0!+@)G9|P-pqkKdc*=a"> <field name="VAR" id="aC((b2L0*@zb-.p|~1/h">Datum</field> <value name="VALUE"> <block type="convert_from_date" id="2]KFb.uVH._L%r^i9F-z"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="lists_getIndex" id=";Wq_qJbNYp``_u)qDcrJ"> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="variables_get" id="$Kg[(NvER[{te#WanzRI"> <field name="VAR" id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</field> </block> </value> <value name="AT"> <block type="math_number" id=":7~%X@%Djm!BL~-[fM4%"> <field name="NUM">2</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="s~C8AxeBgk)4Ld2NXfTL"> <field name="VAR" id="18Z@{WD;.Mjb8Xir$J?K">Wochentag</field> <value name="VALUE"> <block type="convert_jsonata" id="y!;v@NW$i`XyA%jb`3U^"> <value name="EXPRESSION"> <shadow type="text" id="][6M8SS*~^WHHg2SEDE)"> <field name="TEXT">(["So","Mo","Di","Mi","Do","Fr","Sa"])#$i@$n[$n=$$].$i</field> </shadow> </value> <value name="TARGET"> <block type="lists_getIndex" id="EeBu~-P=bqaYuO7c7I4S"> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="variables_get" id="=PF8|9m]ZKNaM-oHn6zx"> <field name="VAR" id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</field> </block> </value> <value name="AT"> <block type="math_number" id="vRVq}|eVwq7M^n)f|9nj"> <field name="NUM">1</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="+o:NShBOKW(bUMb)5g0f"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> <value name="VALUE"> <block type="math_arithmetic" id="vZf-i,pcMomv4N(dwL`m"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="yGV4LkTaAu%P?)vicUDA"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="`o@)-)K!;[i|=2=,|0*{"> <field name="VAR" id="18Z@{WD;.Mjb8Xir$J?K">Wochentag</field> </block> </value> <value name="B"> <shadow type="math_number" id="E3#SX(8`!O,e{c2kM_y:"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="kTRw@Iv*W|oKk?9970Qk"> <field name="VAR" id="!BKERwI$xoYSsO$e/!+-">Heute</field> </block> </value> </block> </value> <next> <block type="logic_switch_case" id="Xg9jIS0xc[E8cO{$n:jr"> <mutation xmlns="http://www.w3.org/1999/xhtml" case="1"></mutation> <value name="CONDITION"> <block type="variables_get" id="[Ea?=J.5C`Z+qqvnh*i)"> <field name="VAR" id="zI%s0A5p2Gpr5vX$g@|}">Element</field> </block> </value> <value name="CASECONDITION0"> <block type="math_number" id="TC6Zelwc!hEJ3;NXiDqx"> <field name="NUM">1</field> </block> </value> <statement name="CASE0"> <block type="debug" id="[)8`!K$vR-qfui-ox$Ap"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="1B8:~vIL:j#B[ZS$Bl+["> <field name="TEXT">Anfang wird berechnet</field> </shadow> </value> <next> <block type="logic_switch_case" id="I(qD`kAkQz=S+)*O3^df"> <mutation xmlns="http://www.w3.org/1999/xhtml" case="1"></mutation> <value name="CONDITION"> <block type="logic_boolean" id="=J:`/rlypBwHV4nD5}.2"> <field name="BOOL">TRUE</field> </block> </value> <value name="CASECONDITION0"> <block type="logic_compare" id="!pPpNA|HL2E)}}y)`_rQ"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="/ayj9f7ECX)a!*i]OY;/"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> <value name="B"> <block type="math_number" id=")Rm7;w[eW=3N!N`{B8^7"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="CASE0"> <block type="variables_set" id="f]~r)@0sACqIVJXCXO5/"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> <value name="VALUE"> <block type="math_arithmetic" id="1-lJ-HQd2;:7f44xq[iv"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="Lk!KX:}gx|tqn;93qGg0"> <field name="NUM">7</field> </shadow> </value> <value name="B"> <shadow type="math_number" id="PBK]eXt9XhVj}34k|W*e"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="*{LmnFk44C.z]/-ic[DD"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> </block> </value> </block> </statement> <value name="CASECONDITION1"> <block type="logic_compare" id="d6FJ#x4-Ht$YFHY2EKAV"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="OEXP]{gddCeQjdGGJUy#"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> <value name="B"> <block type="math_number" id="L_m2%}`vNl}6ONs(M+fT"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="CASE1"> <block type="controls_if" id=":]U%QcTETe_RXjb3E9KL"> <value name="IF0"> <block type="time_compare_ex" id="zijwn$U~V({3f6Q,5z~h"> <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="false" actual_time="true"></mutation> <field name="USE_ACTUAL_TIME">TRUE</field> <field name="OPTION">></field> <value name="START_TIME"> <shadow type="text" id="8g!VA42bs`q%8)M:c/4)"> <field name="TEXT">12:00</field> </shadow> <block type="lists_getIndex" id="(HH{~kh?-G5Kks9U@Lit"> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="variables_get" id="fJ7Ry{~$327T4=-}!f*R"> <field name="VAR" id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</field> </block> </value> <value name="AT"> <block type="math_number" id="J3kO$YEZ:.A.EK4y/u@C"> <field name="NUM">2</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="pXNO@mAA0iy4XG:}i_MX"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> <value name="VALUE"> <block type="math_number" id="8`zct+{4mh`bwq|l,3ew"> <field name="NUM">7</field> </block> </value> </block> </statement> </block> </statement> <next> <block type="variables_set" id="XMRCFLz^)zGRi!No3=H#"> <field name="VAR" id="H*rbj$ZVfoo}B`P#^ISE">Anfang</field> <value name="VALUE"> <block type="time_calculation" id="bLcSdgA,4$dk]nP7+I.R"> <field name="OPERATION">+</field> <field name="UNIT">day</field> <value name="DATE_TIME"> <shadow type="time_get" id="OQ!LO/xEEDTG7RnPTJWM"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </shadow> <block type="variables_get" id="HP?WwIpo9}yG/mW{^-u#"> <field name="VAR" id="aC((b2L0*@zb-.p|~1/h">Datum</field> </block> </value> <value name="VALUE"> <shadow type="math_number" id="B?L5O:@r3doK=Z,?J7yx"> <field name="NUM">1</field> </shadow> <block type="convert_tonumber" id=".$:w3P.4m3KWMvqiR@[L"> <value name="VALUE"> <block type="variables_get" id="^X+X^-*B$hU/yxDDS@~F"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> </block> </value> </block> </value> <next> <block type="debug" id="F;vxk+EHp*sdUZ`zQ.A/"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="VZEwX$_l_uDYT@Kq?Sd9"> <field name="TEXT">test</field> </shadow> <block type="convert_from_date" id="]OM}1G$+(hd.(]*C:FdI"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ.MM.TT SS:mm:ss.sss</field> <value name="VALUE"> <block type="variables_get" id="I_qmwmsx+oY?Lfnt;.z#"> <field name="VAR" id="H*rbj$ZVfoo}B`P#^ISE">Anfang</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> <value name="CASECONDITION1"> <block type="math_number" id="-H[.==q5F~tgVR1$$G5B"> <field name="NUM">2</field> </block> </value> <statement name="CASE1"> <block type="debug" id="^wJf298~n(zZAwl}{q-8"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="3uq07.Bk:G7IsQn%l[+S"> <field name="TEXT">Ende wird berechnet</field> </shadow> </value> <next> <block type="variables_set" id="AO97yXBqRqp=IRkoJMD!"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> <value name="VALUE"> <block type="time_calculation" id="`|g86n#XJ:8U$EJV~~%}"> <field name="OPERATION">+</field> <field name="UNIT">day</field> <value name="DATE_TIME"> <shadow type="time_get" id="OQ!LO/xEEDTG7RnPTJWM"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </shadow> <block type="variables_get" id="|J.Ezm!e8abp=np6E80;"> <field name="VAR" id="aC((b2L0*@zb-.p|~1/h">Datum</field> </block> </value> <value name="VALUE"> <shadow type="math_number" id="B?L5O:@r3doK=Z,?J7yx"> <field name="NUM">1</field> </shadow> <block type="convert_tonumber" id="M^DGj_]M}s0Q$=p=Rc:W"> <value name="VALUE"> <block type="variables_get" id="!#dF{oRO~R@g18%C{zSC"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> </block> </value> </block> </value> <next> <block type="controls_whileUntil" id="s4Pj)l+0)M0E$MLN$caV"> <field name="MODE">WHILE</field> <value name="BOOL"> <block type="logic_compare" id="?rd7J7K{d}GH$9PkT##n"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="QH_WO[^*K8d(NPI7qnH5"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> </block> </value> <value name="B"> <block type="variables_get" id="j*s6bN1[[6i8k%*`#jl:"> <field name="VAR" id="H*rbj$ZVfoo}B`P#^ISE">Anfang</field> </block> </value> </block> </value> <statement name="DO"> <block type="variables_set" id="e?k;iQDd%9Bx]thjgV-g"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> <value name="VALUE"> <block type="time_calculation" id="5uFkc1O+*GEJ$D@H.I6K"> <field name="OPERATION">+</field> <field name="UNIT">day</field> <value name="DATE_TIME"> <shadow type="time_get" id="OQ!LO/xEEDTG7RnPTJWM"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </shadow> <block type="variables_get" id="*%Cy$u[(jYkxbtb$MQ$["> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> </block> </value> <value name="VALUE"> <shadow type="math_number" id="B?L5O:@r3doK=Z,?J7yx"> <field name="NUM">1</field> </shadow> <block type="convert_tonumber" id="nVA$XHGL-^MV@MR4!?/i"> <value name="VALUE"> <block type="math_number" id="/wlkUgXt%U{.uxc:fAx2"> <field name="NUM">7</field> </block> </value> </block> </value> </block> </value> </block> </statement> <next> <block type="debug" id="VG3MPKS2r3FVr?9wy-G5"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="VZEwX$_l_uDYT@Kq?Sd9"> <field name="TEXT">test</field> </shadow> <block type="convert_from_date" id="(]i*;H5PMZ{=X5qMqBx;"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ.MM.TT SS:mm:ss.sss</field> <value name="VALUE"> <block type="variables_get" id="igY{PNkcotgSQ9MbxV|;"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </xml>
Oder wenn es nicht aus einem Datenpunkt kommt - einfach in der 1. Variante halt statt dem String die Variable einsetzen.
-
@mickym habe jetzt mal versucht das Anfangsdatum an Telegram zu schicken, dort sthet aber nur undefined.
Im Prinzip will ich das Anfangs und Enddatum nutzen, um zu sagen, ok die Wetterwarnung (in diesem Fall) ist aktive oder nicht. Er scheint die Ausgabe in dem Format aber nicht zu verstehen.
-
@memberx Also wie Du Deine Daten da rein bringst, das weiß ich nicht - das hast Du ja nicht beschrieben.
Aus dem Skript werden 2 Datumsobjekte generiert Anfang und Ende:
Wie Du den JSON in das Skript bringst.
{"Effective":"Do. 12:00 - Sa. 00:00"}
Ein JSON Objekt steht immer in geschweiften Klammern - das weiß ich nicht. Das musst Du halt genau beschreiben - bzw. dann halt oben einsetzen. Das Format muss genauso kommen, wie eben gepostet mit den geschweiften Klammern und der Eigenschaft in Anführungszeichen - der Wert in diesem Fall auch, da es ein String ist.
-
@memberx Also der JSON sieht aktuell (musste Italien nehmen) da es dort gerade eine Warnung gibt, es steht also noch mehr in den geschweiften Klammern
[{"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"},
-
@memberx SO hilft das nichts - weil das wird dauernd interpretiert, Wenn Du hier Code oder Daten postest bitte in CodeTags.
und dann auch vollständig. Das ganze scheint ein Array zu sein und das sehe ich nicht, wenn Du hier nur Bruchstücke postest. Steht vor der eckigen Klammer noch was? - Wo ist die eckige Klammer zu?
Setze es wie gesagt in CodeTags und prüfe ob das JSON vollständig ist: https://jsonformatter.org/
Man kann Dir nur helfen, wenn Du selbst mit JSON umgehen kannst oder sonst musst Du halt vollständige Daten posten und in CodeTags
-
@mickym das was ich Dir kopiert habe, ist was dieser JSON in den Objekten ausgibt, Instanz ist Meteoalarm
Weiss nicht, was ich Dir hier anderes angeben kann dafür!
-
@memberx Genau - dann gibts folgende Möglichkeiten.
- Du lässt den Datenpunkt triggern - das ist das was ich Dir vorher geschrieben habe.
und - Du kannst den Wert in die Zwischenablage kopieren und hier in Code Tags einfügen.
ABER nicht mit der Maus markieren sondern - die Schaltfläche verwenden:
Den Pfad sehe ich - ich versuchst mal zu interpretieren . aber wie gesagt - die Daten kopiert man über das Kopieren Symbol.
Genauso den Pfad:
aber gut ändere einfach mal das Attribut, wie folgt:
bzw. im Trigger mach mal folgendes:
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="6oK@toJ1ZzVY=OwBdY^o">Liste</variable> <variable id="NL2KE=!}Zmt$hJQhH5V;">Effective</variable> <variable id="!BKERwI$xoYSsO$e/!+-">Heute</variable> <variable id="zI%s0A5p2Gpr5vX$g@|}">Element</variable> <variable id="2e{Y?fWyy-HCr`j33Dpg">Zeit</variable> <variable id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</variable> <variable id="aC((b2L0*@zb-.p|~1/h">Datum</variable> <variable id="H*rbj$ZVfoo}B`P#^ISE">Anfang</variable> <variable id="%GNLsL32kU#,c`m/:kU,">Ende</variable> <variable id="18Z@{WD;.Mjb8Xir$J?K">Wochentag</variable> <variable id="..Vyxt!`-weR`@gg9$oi">offsetfDay</variable> </variables> <block type="on_ext" id="9v0T4-}H*gM#fI)`[0W8" x="-963" y="-887"> <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="YE4ow[7PN)yjgnsA{xI?"> <field name="oid">admin.0.connected</field> </shadow> <block type="text" id="]im@@vJe?#dW58|58p@Z"> <field name="TEXT">meteoalarm.0.JSON</field> </block> </value> <statement name="STATEMENT"> <block type="variables_set" id="d*(FmGB+M-hG{1%is)re"> <field name="VAR" id="6oK@toJ1ZzVY=OwBdY^o">Liste</field> <value name="VALUE"> <block type="lists_getIndex" id="43Ic5Oi[3#0bULfo(FmC"> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="on_source" id="((mMLHK4)1NZ7%b|XgKn"> <field name="ATTR">state.val</field> </block> </value> <value name="AT"> <block type="math_number" id="HFzs=wzX77)(VDKarEe8"> <field name="NUM">1</field> </block> </value> </block> </value> <next> <block type="variables_set" id="AQT_dD29iQ%3]/_v}m_F"> <field name="VAR" id="NL2KE=!}Zmt$hJQhH5V;">Effective</field> <value name="VALUE"> <block type="get_attr" id="w4s.PQ-_Ph`.N`*rtAV}"> <value name="PATH"> <shadow type="text" id="(z*JkCpP9u#h=e;I3_y)"> <field name="TEXT">Effective</field> </shadow> </value> <value name="OBJECT"> <block type="variables_get" id="|JX*Wn45Pc6ml@I0U=Rv"> <field name="VAR" id="6oK@toJ1ZzVY=OwBdY^o">Liste</field> </block> </value> </block> </value> <next> <block type="variables_set" id=".MPR;2b%4`w%Ww{IBD3l"> <field name="VAR" id="!BKERwI$xoYSsO$e/!+-">Heute</field> <value name="VALUE"> <block type="time_get" id="_ii#1cl%HyAe+:8a-}!v"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">wd</field> </block> </value> <next> <block type="controls_if" id="8q8yfyF)ppopq*kWtk4L"> <value name="IF0"> <block type="logic_compare" id="zzA;#!h(e|+!j!$$mapm"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="mt3e~IV+eoQ}|.RobAMy"> <field name="VAR" id="!BKERwI$xoYSsO$e/!+-">Heute</field> </block> </value> <value name="B"> <block type="math_number" id="8llnD`8q%``UKZ7MwAS;"> <field name="NUM">7</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="(7?.MhNKE4_X;l,pII}@"> <field name="VAR" id="!BKERwI$xoYSsO$e/!+-">Heute</field> </block> </statement> <next> <block type="variables_set" id="5K_E;K$P~q/6.|(*zzA?"> <field name="VAR" id="zI%s0A5p2Gpr5vX$g@|}">Element</field> <value name="VALUE"> <block type="math_number" id="vTWr$QzJB;9TW;FNm{;_"> <field name="NUM">0</field> </block> </value> <next> <block type="controls_forEach" id="oc$8$UMKv(pn4Nwa+H}d"> <field name="VAR" id="2e{Y?fWyy-HCr`j33Dpg">Zeit</field> <value name="LIST"> <block type="lists_split" id="gIuNR%ZYq=*l43Q~,WrL"> <mutation mode="SPLIT"></mutation> <field name="MODE">SPLIT</field> <value name="INPUT"> <block type="variables_get" id="PGR#uRAi%Z}*HC=;efZR"> <field name="VAR" id="NL2KE=!}Zmt$hJQhH5V;">Effective</field> </block> </value> <value name="DELIM"> <shadow type="text" id="i::oo9.BKD}I}qIj]=a|"> <field name="TEXT"> - </field> </shadow> </value> </block> </value> <statement name="DO"> <block type="math_change" id="rK6rTY_#w:1ErUCj9%p5"> <field name="VAR" id="zI%s0A5p2Gpr5vX$g@|}">Element</field> <value name="DELTA"> <shadow type="math_number" id="(u}AM,2nE9[ps{TddKa."> <field name="NUM">1</field> </shadow> </value> <next> <block type="variables_set" id="3G0[wq6fJKGGvnSNqV_u"> <field name="VAR" id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</field> <value name="VALUE"> <block type="lists_split" id="pfXE.JlOjmH9ivKh:3R3"> <mutation mode="SPLIT"></mutation> <field name="MODE">SPLIT</field> <value name="INPUT"> <block type="variables_get" id="urR=@xpA#)S51jyoz~=I"> <field name="VAR" id="2e{Y?fWyy-HCr`j33Dpg">Zeit</field> </block> </value> <value name="DELIM"> <shadow type="text" id="b[Xl9r*yH(vcBJp!i*$@"> <field name="TEXT">. </field> </shadow> </value> </block> </value> <next> <block type="variables_set" id="a0!+@)G9|P-pqkKdc*=a"> <field name="VAR" id="aC((b2L0*@zb-.p|~1/h">Datum</field> <value name="VALUE"> <block type="convert_from_date" id="2]KFb.uVH._L%r^i9F-z"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="lists_getIndex" id=";Wq_qJbNYp``_u)qDcrJ"> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="variables_get" id="$Kg[(NvER[{te#WanzRI"> <field name="VAR" id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</field> </block> </value> <value name="AT"> <block type="math_number" id=":7~%X@%Djm!BL~-[fM4%"> <field name="NUM">2</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="s~C8AxeBgk)4Ld2NXfTL"> <field name="VAR" id="18Z@{WD;.Mjb8Xir$J?K">Wochentag</field> <value name="VALUE"> <block type="convert_jsonata" id="y!;v@NW$i`XyA%jb`3U^"> <value name="EXPRESSION"> <shadow type="text" id="][6M8SS*~^WHHg2SEDE)"> <field name="TEXT">(["So","Mo","Di","Mi","Do","Fr","Sa"])#$i@$n[$n=$$].$i</field> </shadow> </value> <value name="TARGET"> <block type="lists_getIndex" id="EeBu~-P=bqaYuO7c7I4S"> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="variables_get" id="=PF8|9m]ZKNaM-oHn6zx"> <field name="VAR" id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</field> </block> </value> <value name="AT"> <block type="math_number" id="vRVq}|eVwq7M^n)f|9nj"> <field name="NUM">1</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="+o:NShBOKW(bUMb)5g0f"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> <value name="VALUE"> <block type="math_arithmetic" id="vZf-i,pcMomv4N(dwL`m"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="yGV4LkTaAu%P?)vicUDA"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="`o@)-)K!;[i|=2=,|0*{"> <field name="VAR" id="18Z@{WD;.Mjb8Xir$J?K">Wochentag</field> </block> </value> <value name="B"> <shadow type="math_number" id="E3#SX(8`!O,e{c2kM_y:"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="kTRw@Iv*W|oKk?9970Qk"> <field name="VAR" id="!BKERwI$xoYSsO$e/!+-">Heute</field> </block> </value> </block> </value> <next> <block type="logic_switch_case" id="Xg9jIS0xc[E8cO{$n:jr"> <mutation xmlns="http://www.w3.org/1999/xhtml" case="1"></mutation> <value name="CONDITION"> <block type="variables_get" id="[Ea?=J.5C`Z+qqvnh*i)"> <field name="VAR" id="zI%s0A5p2Gpr5vX$g@|}">Element</field> </block> </value> <value name="CASECONDITION0"> <block type="math_number" id="TC6Zelwc!hEJ3;NXiDqx"> <field name="NUM">1</field> </block> </value> <statement name="CASE0"> <block type="debug" id="[)8`!K$vR-qfui-ox$Ap"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="1B8:~vIL:j#B[ZS$Bl+["> <field name="TEXT">Anfang wird berechnet</field> </shadow> </value> <next> <block type="logic_switch_case" id="I(qD`kAkQz=S+)*O3^df"> <mutation xmlns="http://www.w3.org/1999/xhtml" case="1"></mutation> <value name="CONDITION"> <block type="logic_boolean" id="=J:`/rlypBwHV4nD5}.2"> <field name="BOOL">TRUE</field> </block> </value> <value name="CASECONDITION0"> <block type="logic_compare" id="!pPpNA|HL2E)}}y)`_rQ"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="/ayj9f7ECX)a!*i]OY;/"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> <value name="B"> <block type="math_number" id=")Rm7;w[eW=3N!N`{B8^7"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="CASE0"> <block type="variables_set" id="f]~r)@0sACqIVJXCXO5/"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> <value name="VALUE"> <block type="math_arithmetic" id="1-lJ-HQd2;:7f44xq[iv"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="Lk!KX:}gx|tqn;93qGg0"> <field name="NUM">7</field> </shadow> </value> <value name="B"> <shadow type="math_number" id="PBK]eXt9XhVj}34k|W*e"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="*{LmnFk44C.z]/-ic[DD"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> </block> </value> </block> </statement> <value name="CASECONDITION1"> <block type="logic_compare" id="d6FJ#x4-Ht$YFHY2EKAV"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="OEXP]{gddCeQjdGGJUy#"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> <value name="B"> <block type="math_number" id="L_m2%}`vNl}6ONs(M+fT"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="CASE1"> <block type="controls_if" id=":]U%QcTETe_RXjb3E9KL"> <value name="IF0"> <block type="time_compare_ex" id="zijwn$U~V({3f6Q,5z~h"> <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="false" actual_time="true"></mutation> <field name="USE_ACTUAL_TIME">TRUE</field> <field name="OPTION">></field> <value name="START_TIME"> <shadow type="text" id="8g!VA42bs`q%8)M:c/4)"> <field name="TEXT">12:00</field> </shadow> <block type="lists_getIndex" id="(HH{~kh?-G5Kks9U@Lit"> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="variables_get" id="fJ7Ry{~$327T4=-}!f*R"> <field name="VAR" id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</field> </block> </value> <value name="AT"> <block type="math_number" id="J3kO$YEZ:.A.EK4y/u@C"> <field name="NUM">2</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="pXNO@mAA0iy4XG:}i_MX"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> <value name="VALUE"> <block type="math_number" id="8`zct+{4mh`bwq|l,3ew"> <field name="NUM">7</field> </block> </value> </block> </statement> </block> </statement> <next> <block type="variables_set" id="XMRCFLz^)zGRi!No3=H#"> <field name="VAR" id="H*rbj$ZVfoo}B`P#^ISE">Anfang</field> <value name="VALUE"> <block type="time_calculation" id="bLcSdgA,4$dk]nP7+I.R"> <field name="OPERATION">+</field> <field name="UNIT">day</field> <value name="DATE_TIME"> <shadow type="time_get" id="OQ!LO/xEEDTG7RnPTJWM"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </shadow> <block type="variables_get" id="HP?WwIpo9}yG/mW{^-u#"> <field name="VAR" id="aC((b2L0*@zb-.p|~1/h">Datum</field> </block> </value> <value name="VALUE"> <shadow type="math_number" id="B?L5O:@r3doK=Z,?J7yx"> <field name="NUM">1</field> </shadow> <block type="convert_tonumber" id=".$:w3P.4m3KWMvqiR@[L"> <value name="VALUE"> <block type="variables_get" id="^X+X^-*B$hU/yxDDS@~F"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> </block> </value> </block> </value> <next> <block type="debug" id="F;vxk+EHp*sdUZ`zQ.A/"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="VZEwX$_l_uDYT@Kq?Sd9"> <field name="TEXT">test</field> </shadow> <block type="convert_from_date" id="]OM}1G$+(hd.(]*C:FdI"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ.MM.TT SS:mm:ss.sss</field> <value name="VALUE"> <block type="variables_get" id="I_qmwmsx+oY?Lfnt;.z#"> <field name="VAR" id="H*rbj$ZVfoo}B`P#^ISE">Anfang</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> <value name="CASECONDITION1"> <block type="math_number" id="-H[.==q5F~tgVR1$$G5B"> <field name="NUM">2</field> </block> </value> <statement name="CASE1"> <block type="debug" id="^wJf298~n(zZAwl}{q-8"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="3uq07.Bk:G7IsQn%l[+S"> <field name="TEXT">Ende wird berechnet</field> </shadow> </value> <next> <block type="variables_set" id="AO97yXBqRqp=IRkoJMD!"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> <value name="VALUE"> <block type="time_calculation" id="`|g86n#XJ:8U$EJV~~%}"> <field name="OPERATION">+</field> <field name="UNIT">day</field> <value name="DATE_TIME"> <shadow type="time_get" id="OQ!LO/xEEDTG7RnPTJWM"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </shadow> <block type="variables_get" id="|J.Ezm!e8abp=np6E80;"> <field name="VAR" id="aC((b2L0*@zb-.p|~1/h">Datum</field> </block> </value> <value name="VALUE"> <shadow type="math_number" id="B?L5O:@r3doK=Z,?J7yx"> <field name="NUM">1</field> </shadow> <block type="convert_tonumber" id="M^DGj_]M}s0Q$=p=Rc:W"> <value name="VALUE"> <block type="variables_get" id="!#dF{oRO~R@g18%C{zSC"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> </block> </value> </block> </value> <next> <block type="controls_whileUntil" id="s4Pj)l+0)M0E$MLN$caV"> <field name="MODE">WHILE</field> <value name="BOOL"> <block type="logic_compare" id="?rd7J7K{d}GH$9PkT##n"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="QH_WO[^*K8d(NPI7qnH5"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> </block> </value> <value name="B"> <block type="variables_get" id="j*s6bN1[[6i8k%*`#jl:"> <field name="VAR" id="H*rbj$ZVfoo}B`P#^ISE">Anfang</field> </block> </value> </block> </value> <statement name="DO"> <block type="variables_set" id="e?k;iQDd%9Bx]thjgV-g"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> <value name="VALUE"> <block type="time_calculation" id="5uFkc1O+*GEJ$D@H.I6K"> <field name="OPERATION">+</field> <field name="UNIT">day</field> <value name="DATE_TIME"> <shadow type="time_get" id="OQ!LO/xEEDTG7RnPTJWM"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </shadow> <block type="variables_get" id="*%Cy$u[(jYkxbtb$MQ$["> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> </block> </value> <value name="VALUE"> <shadow type="math_number" id="B?L5O:@r3doK=Z,?J7yx"> <field name="NUM">1</field> </shadow> <block type="convert_tonumber" id="nVA$XHGL-^MV@MR4!?/i"> <value name="VALUE"> <block type="math_number" id="/wlkUgXt%U{.uxc:fAx2"> <field name="NUM">7</field> </block> </value> </block> </value> </block> </value> </block> </statement> <next> <block type="debug" id="VG3MPKS2r3FVr?9wy-G5"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="VZEwX$_l_uDYT@Kq?Sd9"> <field name="TEXT">test</field> </shadow> <block type="convert_from_date" id="(]i*;H5PMZ{=X5qMqBx;"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ.MM.TT SS:mm:ss.sss</field> <value name="VALUE"> <block type="variables_get" id="igY{PNkcotgSQ9MbxV|;"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="debug" id="DT6xXap`9F++yvIycG|j"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="c.@cD=VCv-^W86rCnb_)"> <field name="TEXT">test</field> </shadow> <block type="time_compare_ex" id="q7dSf0Id/l3LF_?brZmM"> <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="true" actual_time="true"></mutation> <field name="USE_ACTUAL_TIME">TRUE</field> <field name="OPTION">between</field> <value name="START_TIME"> <shadow type="text" id="8nwL?)~2=;Yezkdenlzt"> <field name="TEXT">12:00</field> </shadow> <block type="variables_get" id="SRMhaQ{;D[)o4_:x[5OK"> <field name="VAR" id="H*rbj$ZVfoo}B`P#^ISE">Anfang</field> </block> </value> <value name="END_TIME"> <shadow type="text" id="]EI?=yE_(mw,1?)nmtje"> <field name="TEXT">18:00</field> </shadow> <block type="variables_get" id="YY?@gMrTztegxouUnyA+"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </xml>
Innerhalb dessen ist das nun so geändert:
Allerdings ist noch ein logischer Fehler drin. Es war verkehrt, dass Du hier geschrieben hattest:
"Effective":"Do. 12:00 - Sa. 00:00"
Damit triggert das entweder nur einmal - da sonst gleich der Donnerstag drauf genommen wird. Im Prinzip hätte man es von Ende rechnen müssen - deswegen wird das Skript so nicht funktionieren.
Ist dann natürlich der nä. kommenden (in diesem Fall Donnerstag) gemeint.
- Du lässt den Datenpunkt triggern - das ist das was ich Dir vorher geschrieben habe.
-
@mickym Eckige Klammer zu wurde beim kopieren sicher abgeschnitten sorry. Aber sehe ich das richtig, dass im JSON Format eigentlich keine eckige Klammer sein sollte? Ist sie hier aber in disem Output
Habe übrigens gedacht, ich habe aus Versehen doppent eingefügt, aber im JSON sind in diesem Fall 2 Meldungen gleichzeitig, Regen und Blitze, daher hat die eckige Klammer zu gefehlt beim Löschen.
[{"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"}]
-
@memberx sagte in Konvertierung von Zeitraum Datum/Uhrzeit aus JSON:
Eckige Klammer zu wurde beim kopieren sicher abgeschnitten sorry. Aber sehe ich das richtig, dass im JSON Format eigentlich keine eckige Klammer sein sollte? Ist sie hier aber in disem Output
Habe übrigens gedacht, ich habe aus Versehen doppent eingefügt, aber im JSON sind in diesem Fall 2 Meldungen gleichzeitig, Regen und Blitze, daher hat die eckige Klammer zu gefehlt beim Löschen.So ist es besser.
Nein die eckigen Klammern sind schon richtig - sie markieren eine Liste oder ein Array. Das besteht aus mehreren Objekten. Arrays werden in JSON mit eckigen Klammern umschlossen und Objekte mit geschweiften KLammern.
Warum bei Meteoalarm das ganze in einem Array ist, liegt daran, dass es einfach mehrere Warnungen auf einmal geben kann.
Du musst Dich halt entscheiden welche Meldung - wir gehen nun mal von der 1. Meldung aus, -
@memberx sagte in Konvertierung von Zeitraum Datum/Uhrzeit aus JSON:
@mickym Eckige Klammer zu wurde beim kopieren sicher abgeschnitten sorry. Aber sehe ich das richtig, dass im JSON Format eigentlich keine eckige Klammer sein sollte? Ist sie hier aber in disem Output
Habe übrigens gedacht, ich habe aus Versehen doppent eingefügt, aber im JSON sind in diesem Fall 2 Meldungen gleichzeitig, Regen und Blitze, daher hat die eckige Klammer zu gefehlt beim Löschen.
[{"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"}]
So siehst Du dass das Array - deine Liste aus 2 Objekten besteht:
- Objekt
{"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"}
- Objekt
{"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"}
Beide Objekte sind in einer Liste (in einem Array) - also eckige Klammer durch Komma getrennt. Es sind also 2 Meldungen!!!
-
So trotzdem hat das Skript nun einen logischen Fehler.
Jedesmal wenn das Anfangszeitpunkt vorbei ist - nimmt er ja schon eine Woche drauf. Wir dürfen also nur die Woche drauf nehmen, wenn das Enddatum in der Zukunft liegt. Deswegen funktioniert das Skript nicht richtig. Ich werde mal ummodeln und Deine Daten mal in einen Datenpunkt kopieren. (Für die Zukunft ist es nur hilfreich, wenn Du nicht Bruchstücke zur Verfügung stellst, wenn man Dir helfen soll.) Also vergiss das Skript erst mal - ich ändere das nochmal grundlegend - braucht aber Zeit. Insbesondere - da ich puzzeln eigentlich hasse - ich sehe immer wieder wie umständlich das ist.
-
So damit müsste es eigentlich tun:
Du musst halt nur bei dem deaktivierten Puzzleteil noch einen eigenen Datenpunkt referenzieren, der dann true oder false aufnimmt, je nachdem ob die Periode aktiv ist oder nicht.
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="6oK@toJ1ZzVY=OwBdY^o">Liste</variable> <variable id="NL2KE=!}Zmt$hJQhH5V;">Effective</variable> <variable id="!BKERwI$xoYSsO$e/!+-">Heute</variable> <variable id="zI%s0A5p2Gpr5vX$g@|}">Element</variable> <variable id="2e{Y?fWyy-HCr`j33Dpg">Zeit</variable> <variable id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</variable> <variable id="aC((b2L0*@zb-.p|~1/h">Datum</variable> <variable id="H*rbj$ZVfoo}B`P#^ISE">Anfang</variable> <variable id="%GNLsL32kU#,c`m/:kU,">Ende</variable> <variable id="18Z@{WD;.Mjb8Xir$J?K">Wochentag</variable> <variable id="..Vyxt!`-weR`@gg9$oi">offsetfDay</variable> </variables> <block type="on_ext" id="9v0T4-}H*gM#fI)`[0W8" x="-963" y="-887"> <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="YE4ow[7PN)yjgnsA{xI?"> <field name="oid">admin.0.connected</field> </shadow> <block type="text" id="]im@@vJe?#dW58|58p@Z"> <field name="TEXT">meteoalarm.0.JSON</field> </block> </value> <statement name="STATEMENT"> <block type="variables_set" id="d*(FmGB+M-hG{1%is)re"> <field name="VAR" id="6oK@toJ1ZzVY=OwBdY^o">Liste</field> <value name="VALUE"> <block type="lists_getIndex" id="43Ic5Oi[3#0bULfo(FmC"> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="convert_json2object" id="QbMq4-GPDD#Gf]L:2xUJ"> <value name="VALUE"> <block type="on_source" id="((mMLHK4)1NZ7%b|XgKn"> <field name="ATTR">state.val</field> </block> </value> </block> </value> <value name="AT"> <block type="math_number" id="HFzs=wzX77)(VDKarEe8"> <field name="NUM">1</field> </block> </value> </block> </value> <next> <block type="debug" id="J@WyJwvAmu2nFGR|RIa?"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="D?N_jCk`QR}J)(e7i!p$"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="+H3DmIb_:A+kriEUBY#l"> <field name="VAR" id="6oK@toJ1ZzVY=OwBdY^o">Liste</field> </block> </value> <next> <block type="variables_set" id="AQT_dD29iQ%3]/_v}m_F"> <field name="VAR" id="NL2KE=!}Zmt$hJQhH5V;">Effective</field> <value name="VALUE"> <block type="get_attr" id="w4s.PQ-_Ph`.N`*rtAV}"> <value name="PATH"> <shadow type="text" id="(z*JkCpP9u#h=e;I3_y)"> <field name="TEXT">Effective</field> </shadow> </value> <value name="OBJECT"> <block type="variables_get" id="|JX*Wn45Pc6ml@I0U=Rv"> <field name="VAR" id="6oK@toJ1ZzVY=OwBdY^o">Liste</field> </block> </value> </block> </value> <next> <block type="variables_set" id=".MPR;2b%4`w%Ww{IBD3l"> <field name="VAR" id="!BKERwI$xoYSsO$e/!+-">Heute</field> <value name="VALUE"> <block type="time_get" id="_ii#1cl%HyAe+:8a-}!v"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">wd</field> </block> </value> <next> <block type="controls_if" id="8q8yfyF)ppopq*kWtk4L"> <value name="IF0"> <block type="logic_compare" id="zzA;#!h(e|+!j!$$mapm"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="mt3e~IV+eoQ}|.RobAMy"> <field name="VAR" id="!BKERwI$xoYSsO$e/!+-">Heute</field> </block> </value> <value name="B"> <block type="math_number" id="8llnD`8q%``UKZ7MwAS;"> <field name="NUM">7</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="(7?.MhNKE4_X;l,pII}@"> <field name="VAR" id="!BKERwI$xoYSsO$e/!+-">Heute</field> </block> </statement> <next> <block type="variables_set" id="5K_E;K$P~q/6.|(*zzA?"> <field name="VAR" id="zI%s0A5p2Gpr5vX$g@|}">Element</field> <value name="VALUE"> <block type="math_number" id="vTWr$QzJB;9TW;FNm{;_"> <field name="NUM">0</field> </block> </value> <next> <block type="controls_forEach" id="oc$8$UMKv(pn4Nwa+H}d"> <field name="VAR" id="2e{Y?fWyy-HCr`j33Dpg">Zeit</field> <value name="LIST"> <block type="lists_split" id="gIuNR%ZYq=*l43Q~,WrL"> <mutation mode="SPLIT"></mutation> <field name="MODE">SPLIT</field> <value name="INPUT"> <block type="variables_get" id="PGR#uRAi%Z}*HC=;efZR"> <field name="VAR" id="NL2KE=!}Zmt$hJQhH5V;">Effective</field> </block> </value> <value name="DELIM"> <shadow type="text" id="i::oo9.BKD}I}qIj]=a|"> <field name="TEXT"> - </field> </shadow> </value> </block> </value> <statement name="DO"> <block type="math_change" id="rK6rTY_#w:1ErUCj9%p5"> <field name="VAR" id="zI%s0A5p2Gpr5vX$g@|}">Element</field> <value name="DELTA"> <shadow type="math_number" id="(u}AM,2nE9[ps{TddKa."> <field name="NUM">1</field> </shadow> </value> <next> <block type="variables_set" id="3G0[wq6fJKGGvnSNqV_u"> <field name="VAR" id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</field> <value name="VALUE"> <block type="lists_split" id="pfXE.JlOjmH9ivKh:3R3"> <mutation mode="SPLIT"></mutation> <field name="MODE">SPLIT</field> <value name="INPUT"> <block type="variables_get" id="urR=@xpA#)S51jyoz~=I"> <field name="VAR" id="2e{Y?fWyy-HCr`j33Dpg">Zeit</field> </block> </value> <value name="DELIM"> <shadow type="text" id="b[Xl9r*yH(vcBJp!i*$@"> <field name="TEXT">. </field> </shadow> </value> </block> </value> <next> <block type="variables_set" id="a0!+@)G9|P-pqkKdc*=a"> <field name="VAR" id="aC((b2L0*@zb-.p|~1/h">Datum</field> <value name="VALUE"> <block type="convert_from_date" id="2]KFb.uVH._L%r^i9F-z"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> <value name="VALUE"> <block type="lists_getIndex" id=";Wq_qJbNYp``_u)qDcrJ"> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="variables_get" id="$Kg[(NvER[{te#WanzRI"> <field name="VAR" id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</field> </block> </value> <value name="AT"> <block type="math_number" id=":7~%X@%Djm!BL~-[fM4%"> <field name="NUM">2</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="s~C8AxeBgk)4Ld2NXfTL"> <field name="VAR" id="18Z@{WD;.Mjb8Xir$J?K">Wochentag</field> <value name="VALUE"> <block type="convert_jsonata" id="y!;v@NW$i`XyA%jb`3U^"> <value name="EXPRESSION"> <shadow type="text" id="][6M8SS*~^WHHg2SEDE)"> <field name="TEXT">(["So","Mo","Di","Mi","Do","Fr","Sa"])#$i@$n[$n=$$].$i</field> </shadow> </value> <value name="TARGET"> <block type="lists_getIndex" id="EeBu~-P=bqaYuO7c7I4S"> <mutation statement="false" at="true"></mutation> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> <block type="variables_get" id="=PF8|9m]ZKNaM-oHn6zx"> <field name="VAR" id="+;kV=u:75tdkFai/[0n*">Zeitpunkt</field> </block> </value> <value name="AT"> <block type="math_number" id="vRVq}|eVwq7M^n)f|9nj"> <field name="NUM">1</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="+o:NShBOKW(bUMb)5g0f"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> <value name="VALUE"> <block type="math_arithmetic" id="vZf-i,pcMomv4N(dwL`m"> <field name="OP">MINUS</field> <value name="A"> <shadow type="math_number" id="yGV4LkTaAu%P?)vicUDA"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="`o@)-)K!;[i|=2=,|0*{"> <field name="VAR" id="18Z@{WD;.Mjb8Xir$J?K">Wochentag</field> </block> </value> <value name="B"> <shadow type="math_number" id="E3#SX(8`!O,e{c2kM_y:"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="kTRw@Iv*W|oKk?9970Qk"> <field name="VAR" id="!BKERwI$xoYSsO$e/!+-">Heute</field> </block> </value> </block> </value> <next> <block type="logic_switch_case" id="Xg9jIS0xc[E8cO{$n:jr"> <mutation xmlns="http://www.w3.org/1999/xhtml" case="1"></mutation> <value name="CONDITION"> <block type="variables_get" id="[Ea?=J.5C`Z+qqvnh*i)"> <field name="VAR" id="zI%s0A5p2Gpr5vX$g@|}">Element</field> </block> </value> <value name="CASECONDITION0"> <block type="math_number" id="TC6Zelwc!hEJ3;NXiDqx"> <field name="NUM">1</field> </block> </value> <statement name="CASE0"> <block type="debug" id="[)8`!K$vR-qfui-ox$Ap"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="1B8:~vIL:j#B[ZS$Bl+["> <field name="TEXT">Anfang wird berechnet</field> </shadow> </value> <next> <block type="variables_set" id="XMRCFLz^)zGRi!No3=H#"> <field name="VAR" id="H*rbj$ZVfoo}B`P#^ISE">Anfang</field> <value name="VALUE"> <block type="time_calculation" id="bLcSdgA,4$dk]nP7+I.R"> <field name="OPERATION">+</field> <field name="UNIT">day</field> <value name="DATE_TIME"> <shadow type="time_get" id="OQ!LO/xEEDTG7RnPTJWM"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </shadow> <block type="variables_get" id="HP?WwIpo9}yG/mW{^-u#"> <field name="VAR" id="aC((b2L0*@zb-.p|~1/h">Datum</field> </block> </value> <value name="VALUE"> <shadow type="math_number" id="B?L5O:@r3doK=Z,?J7yx"> <field name="NUM">1</field> </shadow> <block type="convert_tonumber" id=".$:w3P.4m3KWMvqiR@[L"> <value name="VALUE"> <block type="variables_get" id="^X+X^-*B$hU/yxDDS@~F"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> </block> </value> </block> </value> <next> <block type="debug" id="F;vxk+EHp*sdUZ`zQ.A/"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="VZEwX$_l_uDYT@Kq?Sd9"> <field name="TEXT">test</field> </shadow> <block type="convert_from_date" id="]OM}1G$+(hd.(]*C:FdI"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ.MM.TT SS:mm:ss.sss</field> <value name="VALUE"> <block type="variables_get" id="I_qmwmsx+oY?Lfnt;.z#"> <field name="VAR" id="H*rbj$ZVfoo}B`P#^ISE">Anfang</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </statement> <value name="CASECONDITION1"> <block type="math_number" id="-H[.==q5F~tgVR1$$G5B"> <field name="NUM">2</field> </block> </value> <statement name="CASE1"> <block type="debug" id="^wJf298~n(zZAwl}{q-8"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="3uq07.Bk:G7IsQn%l[+S"> <field name="TEXT">Ende wird berechnet</field> </shadow> </value> <next> <block type="variables_set" id="KNV%9d6C[1TVUozz_Tkc"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> <value name="VALUE"> <block type="time_calculation" id="FZd3@lphYB,}K^)f,E8i"> <field name="OPERATION">+</field> <field name="UNIT">day</field> <value name="DATE_TIME"> <shadow type="time_get" id="OQ!LO/xEEDTG7RnPTJWM"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </shadow> <block type="variables_get" id="0hU9bXEM:jJtp{{WDd:D"> <field name="VAR" id="aC((b2L0*@zb-.p|~1/h">Datum</field> </block> </value> <value name="VALUE"> <shadow type="math_number" id="B?L5O:@r3doK=Z,?J7yx"> <field name="NUM">1</field> </shadow> <block type="convert_tonumber" id=":ZzlpPj?YQp/I|;o^S[["> <value name="VALUE"> <block type="variables_get" id="i4_f+-8f:5Vz%tBykI*V"> <field name="VAR" id="..Vyxt!`-weR`@gg9$oi">offsetfDay</field> </block> </value> </block> </value> </block> </value> <next> <block type="controls_whileUntil" id="s4Pj)l+0)M0E$MLN$caV"> <field name="MODE">WHILE</field> <value name="BOOL"> <block type="logic_compare" id="?rd7J7K{d}GH$9PkT##n"> <field name="OP">LT</field> <value name="A"> <block type="variables_get" id="QH_WO[^*K8d(NPI7qnH5"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> </block> </value> <value name="B"> <block type="variables_get" id="j*s6bN1[[6i8k%*`#jl:"> <field name="VAR" id="H*rbj$ZVfoo}B`P#^ISE">Anfang</field> </block> </value> </block> </value> <statement name="DO"> <block type="variables_set" id="e?k;iQDd%9Bx]thjgV-g"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> <value name="VALUE"> <block type="time_calculation" id="5uFkc1O+*GEJ$D@H.I6K"> <field name="OPERATION">+</field> <field name="UNIT">day</field> <value name="DATE_TIME"> <shadow type="time_get" id="OQ!LO/xEEDTG7RnPTJWM"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </shadow> <block type="variables_get" id="*%Cy$u[(jYkxbtb$MQ$["> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> </block> </value> <value name="VALUE"> <shadow type="math_number" id="B?L5O:@r3doK=Z,?J7yx"> <field name="NUM">1</field> </shadow> <block type="convert_tonumber" id="nVA$XHGL-^MV@MR4!?/i"> <value name="VALUE"> <block type="math_number" id="/wlkUgXt%U{.uxc:fAx2"> <field name="NUM">7</field> </block> </value> </block> </value> </block> </value> </block> </statement> <next> <block type="debug" id="VG3MPKS2r3FVr?9wy-G5"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="VZEwX$_l_uDYT@Kq?Sd9"> <field name="TEXT">test</field> </shadow> <block type="convert_from_date" id="(]i*;H5PMZ{=X5qMqBx;"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation> <field name="OPTION">custom</field> <field name="FORMAT">JJJJ.MM.TT SS:mm:ss.sss</field> <value name="VALUE"> <block type="variables_get" id="igY{PNkcotgSQ9MbxV|;"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> <next> <block type="debug" id="DT6xXap`9F++yvIycG|j"> <field name="Severity">log</field> <value name="TEXT"> <shadow type="text" id="c.@cD=VCv-^W86rCnb_)"> <field name="TEXT">test</field> </shadow> <block type="time_compare_ex" id="q7dSf0Id/l3LF_?brZmM"> <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="true" actual_time="true"></mutation> <field name="USE_ACTUAL_TIME">TRUE</field> <field name="OPTION">between</field> <value name="START_TIME"> <shadow type="text" id="8nwL?)~2=;Yezkdenlzt"> <field name="TEXT">12:00</field> </shadow> <block type="variables_get" id="SRMhaQ{;D[)o4_:x[5OK"> <field name="VAR" id="H*rbj$ZVfoo}B`P#^ISE">Anfang</field> </block> </value> <value name="END_TIME"> <shadow type="text" id="]EI?=yE_(mw,1?)nmtje"> <field name="TEXT">18:00</field> </shadow> <block type="variables_get" id="YY?@gMrTztegxouUnyA+"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> </block> </value> </block> </value> <next> <block type="update" id="?iMr-+E:#1|?^9Tm:zB3" disabled="true"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Test.Alarm</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="time_compare_ex" id="ULKq.S+6_kK)F/~:W8r["> <mutation xmlns="http://www.w3.org/1999/xhtml" end_time="true" actual_time="true"></mutation> <field name="USE_ACTUAL_TIME">TRUE</field> <field name="OPTION">between</field> <value name="START_TIME"> <shadow type="text" id="8nwL?)~2=;Yezkdenlzt"> <field name="TEXT">12:00</field> </shadow> <block type="variables_get" id="q,T9+QKzkez+#w+6WCCP"> <field name="VAR" id="H*rbj$ZVfoo}B`P#^ISE">Anfang</field> </block> </value> <value name="END_TIME"> <shadow type="text" id="]EI?=yE_(mw,1?)nmtje"> <field name="TEXT">18:00</field> </shadow> <block type="variables_get" id="u@%v4oVsv-k$E+%#kGwn"> <field name="VAR" id="%GNLsL32kU#,c`m/:kU,">Ende</field> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </xml>
Die debug Ausgaben kannst ja selbst wegmachen.