NEWS
Umrechnung Sekunden in hh:mm:ss
-
Brauch bitte euere Hilfe ich steh leider voll am Schlauch.
Mein Geschirrspüler gibt mir die Restlaufzeit in Sekunden.
Diese sind zur Darstellung in VIS leider unbrauchbar (oder besser Frau will hhss)Jetzt hab ich folgendes gebastelt mit JS und Blocky.
Java Script zur Umrechnungvon Millisekunden in hh:mm:ss
function f_ms(t) { let year, month, day, hour, minute, second; second = Math.floor(t / 1000); minute = Math.floor(second / 60); second = second % 60; hour = Math.floor(minute / 60); minute = minute % 60; day = Math.floor(hour / 24); hour = hour % 24; month = Math.floor(day / 30); day = day % 30; year = Math.floor(month / 12); month = month % 12; return `${year}J ${month}M ${day}T ${hour}h ${minute}m ${second}s`; };
und folgendes Blocky, dass mir den Output hh:mm:ss in einen DP schreiben soll
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="]{tt]3rI7{h*)rS!#2@I">t</variable> </variables> <block type="procedures_defcustomreturn" id="6f#1@J@@Uw/-%p,s-J/M" x="62" y="112"> <mutation statements="false"> <arg name="t" varid="]{tt]3rI7{h*)rS!#2@I"></arg> </mutation> <field name="NAME">f_ms</field> <field name="SCRIPT">cmV0dXJuIDA7</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="on_ext" id="a(DhuoBG+zO~3:KTzY]W" x="63" y="162"> <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="?wR_Bow9s((!a8[gQ=I?"> <field name="oid">homeconnect.0.012100518982022603.programs.active.options.BSH_Common_Option_RemainingProgramTime</field> </shadow> </value> <statement name="STATEMENT"> <block type="variables_set" id="y^U6dxF?5Ka0e4CQ_o`n"> <field name="VAR" id="]{tt]3rI7{h*)rS!#2@I">t</field> <value name="VALUE"> <block type="get_value" id="N+Z?twH32RU2M%ZHq;4n"> <field name="ATTR">val</field> <field name="OID">homeconnect.0.012100518982022603.programs.active.options.BSH_Common_Option_RemainingProgramTime</field> </block> </value> <next> <block type="update" id="}uCqB}h/@$cTDZ!Czna8"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.SpuelTimer</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="procedures_callcustomreturn" id="C(~L,(,P.o;~eg*!%=F)"> <mutation name="f_ms"> <arg name="t"></arg> </mutation> <value name="ARG0"> <block type="math_arithmetic" id="WvwZTkL@;$kHtK54ycz="> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="9JGgLjIY_ecs8R#kn4uR"> <field name="VAR" id="]{tt]3rI7{h*)rS!#2@I">t</field> </block> </value> <value name="B"> <shadow type="math_number" id="l~KY@z,#GA7+kxalf^vj"> <field name="NUM">1000</field> </shadow> </value> </block> </value> </block> </value> </block> </next> </block> </statement> </block> </xml>
Leider bekomm ich ein Ergebnis auch nicht vom JS zurück.
Ich bin am verzweifeln.
Danke für eure Hilfe -
@kkickingereder sagte: Restlaufzeit in Sekunden.
formatDate(1000 * Restlaufzeit, 'hh:mm:ss');
Blockly: In die JS-Funktion muss etwas eingetragen werden (3 Punkte rechts):
-
@paul53 Vielen Dank, jetzt funktioniert mein Script, das Return 0, war das Problem
-
-
@haselchen sagte: per Blockly da eine Uhrzeit raus?
-
Da schmeisst er mir immer die aktuelle Zeit raus.
-
@haselchen sagte: die aktuelle Zeit
Die Konvertierungsfunktion?
-
Ah Fehler gefunden. Ich stell mal um
Edit: Bist wie immer der Beste!
Natürlich, wenn man mal genau schaut, funktioniert es.
-
@haselchen
Im Trigger: -
@kkickingereder Ich habe das ganze so gelöst.
so hat meine Frau die Restlaufzeit von dem Programm und die Uhrzeit an dem es fertig ist.
Blockly:
Protokoll Ausgewählte Blöcke exportieren <xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="rI/MU0bb2vx?cMy#]1;h">Dauer</variable> <variable id="jIw-#0$lg4RWth^zia4n">Stunden</variable> <variable id="eDE,{!]85U2wKHr7b#+.">Minuten</variable> <variable id="zKK-|$Mj;MF-v}]?,o14">Sekunden</variable> </variables> <block type="on" id="z6e`6VBk83f9Go+uS?vD" x="112" y="38"> <field name="OID">homeconnect.0.SIEMENS-SN658X06TE-68A40E42FB34.programs.active.options.BSH_Common_Option_RemainingProgramTime</field> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="variables_set" id="5OO:r9CY/I4.PuLt+uoX"> <field name="VAR" id="rI/MU0bb2vx?cMy#]1;h">Dauer</field> <value name="VALUE"> <block type="get_value" id="+BQHmJD?}9`Lg3uT?8N`"> <field name="ATTR">val</field> <field name="OID">homeconnect.0.SIEMENS-SN658X06TE-68A40E42FB34.programs.active.options.BSH_Common_Option_RemainingProgramTime</field> </block> </value> <next> <block type="variables_set" id="P`1=(VlTq)WG,CD-.5bo"> <field name="VAR" id="jIw-#0$lg4RWth^zia4n">Stunden</field> <value name="VALUE"> <block type="math_round" id="S[;vM1j}t$+RFL;3gf=9"> <field name="OP">ROUNDDOWN</field> <value name="NUM"> <shadow type="math_number" id="{L(wDg$WtYWI6u2/$0(+"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="o=h6OG}c84!{s4Dl^^vZ"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="@{kAY6pA0-GbDWc!9v:V"> <field name="VAR" id="rI/MU0bb2vx?cMy#]1;h">Dauer</field> </block> </value> <value name="B"> <shadow type="math_number" id=",zQ3GVM~%~l|/6Wc+aGZ"> <field name="NUM">1</field> </shadow> <block type="math_number" id="cK2%7i*C?4hD;s-,93f^"> <field name="NUM">3600</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="YB98~EjxKRM.E^/RH;^c"> <field name="VAR" id="eDE,{!]85U2wKHr7b#+.">Minuten</field> <value name="VALUE"> <block type="math_round" id="bU`4pk9On/08ov|?CkBl"> <field name="OP">ROUNDDOWN</field> <value name="NUM"> <shadow type="math_number" id="5|KmBVYDfsYBmR7~Wl(9"> <field name="NUM">3.1</field> </shadow> <block type="math_modulo" id="$4Owp|d8.g!a#kaFhqs_"> <value name="DIVIDEND"> <shadow type="math_number" id="?)RI2P}2p!-YxZ88ijf~"> <field name="NUM">64</field> </shadow> <block type="math_arithmetic" id="frY;}ntyuAr*7.#,eo/0"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="COtpj]?(tSnLoo#9_3YI"> <field name="VAR" id="rI/MU0bb2vx?cMy#]1;h">Dauer</field> </block> </value> <value name="B"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="math_number" id="(9{Yo0!tJn1G}nK~j?U+"> <field name="NUM">60</field> </block> </value> </block> </value> <value name="DIVISOR"> <shadow type="math_number" id="_b.9`}PqVBWn+a6+zFp:"> <field name="NUM">60</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="[uN`$4gdo}]!RaSbDz]7"> <field name="VAR" id="zKK-|$Mj;MF-v}]?,o14">Sekunden</field> <value name="VALUE"> <block type="math_modulo" id="pgcv*`eLN{$4{]6ywy`,"> <value name="DIVIDEND"> <shadow type="math_number"> <field name="NUM">64</field> </shadow> <block type="math_arithmetic" id="ahqj,2ihF{2^=|)D]CDP"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="N=Ptb(8_CCCCn(mzR=$y"> <field name="VAR" id="rI/MU0bb2vx?cMy#]1;h">Dauer</field> </block> </value> <value name="B"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="math_number" id="gu.`t=SE*hv9|?b9XR~Z"> <field name="NUM">60</field> </block> </value> </block> </value> <value name="DIVISOR"> <shadow type="math_number" id="3!Z)0TJTI7g[H$pKG0Qu"> <field name="NUM">60</field> </shadow> </value> </block> </value> <next> <block type="control" id="YQb1D#LU-%kUHcwvqDAr"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Restlaufzeit_Geschirrspuehler</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text_join" id=":gH/~`:Sgc$=D?Le99Yz"> <mutation items="6"></mutation> <value name="ADD0"> <block type="variables_get" id="p+Br~z+{OLmsWTn2,Kd("> <field name="VAR" id="jIw-#0$lg4RWth^zia4n">Stunden</field> </block> </value> <value name="ADD1"> <block type="text" id="Vlv$MjO3eb0S.dl9Q#pu"> <field name="TEXT">Std. </field> </block> </value> <value name="ADD2"> <block type="variables_get" id="b9p+D7=YTP28!$iRn#wv"> <field name="VAR" id="eDE,{!]85U2wKHr7b#+.">Minuten</field> </block> </value> <value name="ADD3"> <block type="text" id="Fx58{XKN/}`:*`Q5Fw`m"> <field name="TEXT">Min. </field> </block> </value> <value name="ADD4"> <block type="variables_get" id="5@a-D./M7FJ6M9/~@K*M" disabled="true"> <field name="VAR" id="zKK-|$Mj;MF-v}]?,o14">Sekunden</field> </block> </value> <value name="ADD5"> <block type="text" id="WM^*N:.`PzQAb~|Y#FZ6" disabled="true"> <field name="TEXT">Sek.</field> </block> </value> </block> </value> <next> <block type="control" id="^W^m+#lm@Z;WqRm|dnT}"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Geschirrspuehler_fertig_um</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="convert_from_date" id=")ZDR7lKID(;F]3#jA_33"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">hh:mm:ss</field> <value name="VALUE"> <block type="math_arithmetic" id="(;Q{j/Th(QpZ,O:NR!gI"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="m#8q|-;wENNJh8{pGvm;"> <field name="NUM">1</field> </shadow> <block type="time_get" id="(tCA%Y)0lpIHk)a5AOJ2"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </block> </value> <value name="B"> <shadow type="math_number" id="hYrh.3`33kz7izXNDE_m"> <field name="NUM">6</field> </shadow> <block type="math_arithmetic" id=".=xi3L?p%}AN8CW)H5|]"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="TW.S8F$AG:alUBfpx]R/"> <field name="NUM">1000</field> </shadow> </value> <value name="B"> <shadow type="math_number" id="L~Y~(Rj_O[cg=87|{,b@"> <field name="NUM">0</field> </shadow> <block type="get_value" id="ZZJ{NupDcd8L!-2UZoz0"> <field name="ATTR">val</field> <field name="OID">homeconnect.0.SIEMENS-SN658X06TE-68A40E42FB34.programs.active.options.BSH_Common_Option_RemainingProgramTime</field> </block> </value> </block> </value> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </xml> <xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="rI/MU0bb2vx?cMy#]1;h">Dauer</variable> <variable id="jIw-#0$lg4RWth^zia4n">Stunden</variable> <variable id="eDE,{!]85U2wKHr7b#+.">Minuten</variable> <variable id="zKK-|$Mj;MF-v}]?,o14">Sekunden</variable> </variables> <block type="on" id="z6e`6VBk83f9Go+uS?vD" x="112" y="38"> <field name="OID">homeconnect.0.SIEMENS-SN658X06TE-68A40E42FB34.programs.active.options.BSH_Common_Option_RemainingProgramTime</field> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="variables_set" id="5OO:r9CY/I4.PuLt+uoX"> <field name="VAR" id="rI/MU0bb2vx?cMy#]1;h">Dauer</field> <value name="VALUE"> <block type="get_value" id="+BQHmJD?}9`Lg3uT?8N`"> <field name="ATTR">val</field> <field name="OID">homeconnect.0.SIEMENS-SN658X06TE-68A40E42FB34.programs.active.options.BSH_Common_Option_RemainingProgramTime</field> </block> </value> <next> <block type="variables_set" id="P`1=(VlTq)WG,CD-.5bo"> <field name="VAR" id="jIw-#0$lg4RWth^zia4n">Stunden</field> <value name="VALUE"> <block type="math_round" id="S[;vM1j}t$+RFL;3gf=9"> <field name="OP">ROUNDDOWN</field> <value name="NUM"> <shadow type="math_number" id="{L(wDg$WtYWI6u2/$0(+"> <field name="NUM">3.1</field> </shadow> <block type="math_arithmetic" id="o=h6OG}c84!{s4Dl^^vZ"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="@{kAY6pA0-GbDWc!9v:V"> <field name="VAR" id="rI/MU0bb2vx?cMy#]1;h">Dauer</field> </block> </value> <value name="B"> <shadow type="math_number" id=",zQ3GVM~%~l|/6Wc+aGZ"> <field name="NUM">1</field> </shadow> <block type="math_number" id="cK2%7i*C?4hD;s-,93f^"> <field name="NUM">3600</field> </block> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="YB98~EjxKRM.E^/RH;^c"> <field name="VAR" id="eDE,{!]85U2wKHr7b#+.">Minuten</field> <value name="VALUE"> <block type="math_round" id="bU`4pk9On/08ov|?CkBl"> <field name="OP">ROUNDDOWN</field> <value name="NUM"> <shadow type="math_number" id="5|KmBVYDfsYBmR7~Wl(9"> <field name="NUM">3.1</field> </shadow> <block type="math_modulo" id="$4Owp|d8.g!a#kaFhqs_"> <value name="DIVIDEND"> <shadow type="math_number" id="?)RI2P}2p!-YxZ88ijf~"> <field name="NUM">64</field> </shadow> <block type="math_arithmetic" id="frY;}ntyuAr*7.#,eo/0"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="COtpj]?(tSnLoo#9_3YI"> <field name="VAR" id="rI/MU0bb2vx?cMy#]1;h">Dauer</field> </block> </value> <value name="B"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="math_number" id="(9{Yo0!tJn1G}nK~j?U+"> <field name="NUM">60</field> </block> </value> </block> </value> <value name="DIVISOR"> <shadow type="math_number" id="_b.9`}PqVBWn+a6+zFp:"> <field name="NUM">60</field> </shadow> </value> </block> </value> </block> </value> <next> <block type="variables_set" id="[uN`$4gdo}]!RaSbDz]7"> <field name="VAR" id="zKK-|$Mj;MF-v}]?,o14">Sekunden</field> <value name="VALUE"> <block type="math_modulo" id="pgcv*`eLN{$4{]6ywy`,"> <value name="DIVIDEND"> <shadow type="math_number"> <field name="NUM">64</field> </shadow> <block type="math_arithmetic" id="ahqj,2ihF{2^=|)D]CDP"> <field name="OP">DIVIDE</field> <value name="A"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="N=Ptb(8_CCCCn(mzR=$y"> <field name="VAR" id="rI/MU0bb2vx?cMy#]1;h">Dauer</field> </block> </value> <value name="B"> <shadow type="math_number"> <field name="NUM">1</field> </shadow> <block type="math_number" id="gu.`t=SE*hv9|?b9XR~Z"> <field name="NUM">60</field> </block> </value> </block> </value> <value name="DIVISOR"> <shadow type="math_number" id="3!Z)0TJTI7g[H$pKG0Qu"> <field name="NUM">60</field> </shadow> </value> </block> </value> <next> <block type="control" id="YQb1D#LU-%kUHcwvqDAr"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Restlaufzeit_Geschirrspuehler</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="text_join" id=":gH/~`:Sgc$=D?Le99Yz"> <mutation items="6"></mutation> <value name="ADD0"> <block type="variables_get" id="p+Br~z+{OLmsWTn2,Kd("> <field name="VAR" id="jIw-#0$lg4RWth^zia4n">Stunden</field> </block> </value> <value name="ADD1"> <block type="text" id="Vlv$MjO3eb0S.dl9Q#pu"> <field name="TEXT">Std. </field> </block> </value> <value name="ADD2"> <block type="variables_get" id="b9p+D7=YTP28!$iRn#wv"> <field name="VAR" id="eDE,{!]85U2wKHr7b#+.">Minuten</field> </block> </value> <value name="ADD3"> <block type="text" id="Fx58{XKN/}`:*`Q5Fw`m"> <field name="TEXT">Min. </field> </block> </value> <value name="ADD4"> <block type="variables_get" id="5@a-D./M7FJ6M9/~@K*M" disabled="true"> <field name="VAR" id="zKK-|$Mj;MF-v}]?,o14">Sekunden</field> </block> </value> <value name="ADD5"> <block type="text" id="WM^*N:.`PzQAb~|Y#FZ6" disabled="true"> <field name="TEXT">Sek.</field> </block> </value> </block> </value> <next> <block type="control" id="^W^m+#lm@Z;WqRm|dnT}"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">0_userdata.0.Geschirrspuehler_fertig_um</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="convert_from_date" id=")ZDR7lKID(;F]3#jA_33"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">hh:mm:ss</field> <value name="VALUE"> <block type="math_arithmetic" id="(;Q{j/Th(QpZ,O:NR!gI"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="m#8q|-;wENNJh8{pGvm;"> <field name="NUM">1</field> </shadow> <block type="time_get" id="(tCA%Y)0lpIHk)a5AOJ2"> <mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation> <field name="OPTION">object</field> </block> </value> <value name="B"> <shadow type="math_number" id="hYrh.3`33kz7izXNDE_m"> <field name="NUM">6</field> </shadow> <block type="math_arithmetic" id=".=xi3L?p%}AN8CW)H5|]"> <field name="OP">MULTIPLY</field> <value name="A"> <shadow type="math_number" id="TW.S8F$AG:alUBfpx]R/"> <field name="NUM">1000</field> </shadow> </value> <value name="B"> <shadow type="math_number" id="L~Y~(Rj_O[cg=87|{,b@"> <field name="NUM">0</field> </shadow> <block type="get_value" id="ZZJ{NupDcd8L!-2UZoz0"> <field name="ATTR">val</field> <field name="OID">homeconnect.0.SIEMENS-SN658X06TE-68A40E42FB34.programs.active.options.BSH_Common_Option_RemainingProgramTime</field> </block> </value> </block> </value> </block> </value> </block> </value> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </xml>