NEWS
[gelöst] Uptime anzeigen
-
verständlich anzuzeigen? `
Widget numberMultipilkationsfaktor 0,00001157407407407407
Nachkommastellen 1
Angezeigt werden x.y Tage.
Gruß
Rainer
-
-
Mal 1000 nehmen, daraus ein Date() machen und dann wie gewünscht formatieren:
// Date=0 -> 1\. Januar 1970 00:00:00 UTC function dateToRuntime(d) { return (d.getFullYear()-1970) + " Jahre " + (d.getMonth()+1) + " Mon " + d.getDate() + " Tg " + d.getHours() + " Std " + d.getMinutes()+ " Min " + d.getSeconds() + " Sek"; } var idUptime = "rpi2.0.uptime.uptime"/*rpi2.0.uptime.uptime*/; var date = new Date( getState(idUptime).val * 1000 ); console.log( dateToRuntime(date) );0 Jahre 2 Mon 7 Tg 21 Std 45 Min 14 Sek
-
Hallo Kuddel,
hier mein Blockly Export
<xml xmlns="http://www.w3.org/1999/xhtml"><block type="schedule" id="S},%B!W7FjU|w+;Bi3u/" x="-485" y="-192"><field name="SCHEDULE">*/5 * * * *</field> <statement name="STATEMENT"><block type="update" id="y#+loq.7I0v*|h]l_kq{"><mutation delay_input="false"></mutation> <field name="OID">javascript.1.Cubie.Uptime_ges</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"><block type="get_value" id="#=Ud:?8|Bc0R?oq(}{Vz"><field name="ATTR">val</field> <field name="OID">rpi2.0.uptime.uptime</field></block></value> <next><block type="update" id="eA^0!7o(`eleB@l]`.|0"><mutation delay_input="false"></mutation> <field name="OID">javascript.1.Cubie.Uptime_Tage</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"><block type="math_round" id="uP@wY=JXp(4!v5rm9Gn~"><field name="OP">ROUNDDOWN</field> <value name="NUM"><shadow type="math_number" id="w)m[6-o#SFO|})aX;^Sn"><field name="NUM">3.1</field></shadow> <block type="math_arithmetic" id="vojum#UhUmJ9*:xhJyqM"><field name="OP">DIVIDE</field> <value name="A"><shadow type="math_number" id="bahI:FVxEi%`f[PVR#?r"><field name="NUM">1</field></shadow> <block type="get_value" id="[|0!~mVsMp1i7GC2fy1Z"><field name="ATTR">val</field> <field name="OID">rpi2.0.uptime.uptime</field></block></value> <value name="B"><shadow type="math_number" id="+UqJ|585+0jXm6HYSp4E"><field name="NUM">86400</field></shadow></value></block></value></block></value> <next><block type="update" id="Se9rQfpcSmVCND6pX=Ws"><mutation delay_input="false"></mutation> <field name="OID">javascript.1.Cubie.Uptime_ZW</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"><block type="math_arithmetic" id=".m2Q2rNHGS#:i@ekz[k2"><field name="OP">MINUS</field> <value name="A"><shadow type="math_number" id="}H73ztKqU,dkWZ,F,i*R"><field name="NUM">1</field></shadow> <block type="get_value" id="bpTvx8c.O#jAL}pJSJj-"><field name="ATTR">val</field> <field name="OID">javascript.1.Cubie.Uptime_ges</field></block></value> <value name="B"><shadow type="math_number" id="P5_|Dw(]!C*d/0LDlJX["><field name="NUM">86400</field></shadow> <block type="math_arithmetic" id="7WlCymLr1Is+=fNRy;dQ"><field name="OP">MULTIPLY</field> <value name="A"><shadow type="math_number" id=",I@|[8va{Mw(V#ASt9{M"><field name="NUM">1</field></shadow> <block type="get_value" id="A7v[`v%0?A3hGM2AN[;V"><field name="ATTR">val</field> <field name="OID">javascript.1.Cubie.Uptime_Tage</field></block></value> <value name="B"><shadow type="math_number" id="/,*u1Aoc5!#2y,F-=!/n"><field name="NUM">86400</field></shadow></value></block></value></block></value> <next><block type="update" id="/A~Ky-nYm7HE1o{A9baQ"><mutation delay_input="false"></mutation> <field name="OID">javascript.1.Cubie.Uptime_ZW2</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"><block type="math_arithmetic" id=":b){J;T)jZtd/)n*5#B{"><field name="OP">MINUS</field> <value name="A"><shadow type="math_number" id="}H73ztKqU,dkWZ,F,i*R"><field name="NUM">1</field></shadow> <block type="get_value" id="/JH:_LB{Hp?rOVHcEADl"><field name="ATTR">val</field> <field name="OID">javascript.1.Cubie.Uptime_ZW</field></block></value> <value name="B"><shadow type="math_number" id="P5_|Dw(]!C*d/0LDlJX["><field name="NUM">0</field></shadow> <block type="math_arithmetic" id="mLuiO`a28Da0=imSY6O;"><field name="OP">MULTIPLY</field> <value name="A"><shadow type="math_number" id=",I@|[8va{Mw(V#ASt9{M"><field name="NUM">1</field></shadow> <block type="get_value" id="}*Gq9T%V[oV_jgDHh^*."><field name="ATTR">val</field> <field name="OID">javascript.1.Cubie.Uptime_Std</field></block></value> <value name="B"><shadow type="math_number" id="r#Ma-:UQ]LCs1Q@IbCMx"><field name="NUM">3600</field></shadow></value></block></value></block></value> <next><block type="update" id="ZKoi^`ERY)v{O6b_C]r6"><mutation delay_input="false"></mutation> <field name="OID">javascript.1.Cubie.Uptime_Min</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"><block type="math_round" id="zqxerP]LTaiC,@[uzrDO"><field name="OP">ROUNDDOWN</field> <value name="NUM"><shadow type="math_number" id="w)m[6-o#SFO|})aX;^Sn"><field name="NUM">3.1</field></shadow> <block type="math_arithmetic" id="ui+kB%jzB5[nE1ECAER6"><field name="OP">DIVIDE</field> <value name="A"><shadow type="math_number" id="}H73ztKqU,dkWZ,F,i*R"><field name="NUM">1</field></shadow> <block type="get_value" id="4/P4aLtdolS=),aE=~Ag"><field name="ATTR">val</field> <field name="OID">javascript.1.Cubie.Uptime_ZW2</field></block></value> <value name="B"><shadow type="math_number" id="P5_|Dw(]!C*d/0LDlJX["><field name="NUM">60</field></shadow></value></block></value></block></value> <next><block type="update" id="!KDV22%PP5g(oNX+=[w3"><mutation delay_input="false"></mutation> <field name="OID">javascript.1.Cubie.Uptime_Std</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"><block type="math_round" id="+hY9mT8D|CibrT:Gvq_j"><field name="OP">ROUNDDOWN</field> <value name="NUM"><shadow type="math_number" id="w)m[6-o#SFO|})aX;^Sn"><field name="NUM">0</field></shadow> <block type="math_arithmetic" id=";ColkGP3n}oo]mSUoRwq"><field name="OP">DIVIDE</field> <value name="A"><shadow type="math_number" id="bahI:FVxEi%`f[PVR#?r"><field name="NUM">1</field></shadow> <block type="get_value" id=".QSN5B`KuiQ,e%vz@P/Y"><field name="ATTR">val</field> <field name="OID">javascript.1.Cubie.Uptime_ZW</field></block></value> <value name="B"><shadow type="math_number" id="z,H?AQ,eFM+{;WC/]m45"><field name="NUM">3600</field></shadow></value></block></value></block></value> <next><block type="update" id="(g+SDiV]@I6UoHl8jE.i"><mutation delay_input="true"></mutation> <field name="OID">javascript.1.Cubie.Uptime_Text</field> <field name="WITH_DELAY">TRUE</field> <field name="DELAY_MS">1000</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="VALUE"><block type="text_join" id="|gSv+WZHIMcsYv;iY}y5"><mutation items="6"></mutation> <value name="ADD0"><block type="get_value" id="Aob5,7,6Fa({At9jX?SF"><field name="ATTR">val</field> <field name="OID">javascript.1.Cubie.Uptime_Tage</field></block></value> <value name="ADD1"><block type="text" id="_N5MntuQ3.OAGrQ,UEnV"><field name="TEXT">Tag(e),</field></block></value> <value name="ADD2"><block type="get_value" id="Z2t3{W{(pTh/O.wwZfia"><field name="ATTR">val</field> <field name="OID">javascript.1.Cubie.Uptime_Std</field></block></value> <value name="ADD3"><block type="text" id="V0sqG%|UzZe:%=_GTSO%"><field name="TEXT">Stunde(n),</field></block></value> <value name="ADD4"><block type="get_value" id="/bGi~CQIfe#cYt}H1,?Z"><field name="ATTR">val</field> <field name="OID">javascript.1.Cubie.Uptime_Min</field></block></value> <value name="ADD5"><block type="text" id="1oy#IR@#^HupeI(++C48"><field name="TEXT"> Minute(n)</field></block></value></block></value> <next><block type="controls_if" id="Q?MRtB7lLyq%ncUNMC]t"><value name="IF0"><block type="logic_compare" id="?F,VX!%;pPt#*RW.RWv;"><field name="OP">LT</field> <value name="A"><block type="get_value" id="lrd?hNTbTq`%0sx.;*ii"><field name="ATTR">val</field> <field name="OID">javascript.1.Cubie.Uptime_max</field></block></value> <value name="B"><block type="convert_tonumber" id="~?++J(e2feDq.d;sU{jT"><value name="VALUE"><block type="get_value" id="Z7Z`NXRr!=aoz%:I;-RZ"><field name="ATTR">val</field> <field name="OID">javascript.1.Cubie.Uptime_Tage</field></block></value></block></value></block></value> <statement name="DO0"><block type="update" id="D)c;gm7[rLdTia*wf=]*"><mutation delay_input="false"></mutation> <field name="OID">javascript.1.Cubie.Uptime_max</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"><block type="convert_tonumber" id="*m[{DN.=.L|:6aZ#kb,+"><value name="VALUE"><block type="get_value" id="]{c(Z900yb~IRpZs#)}r"><field name="ATTR">val</field> <field name="OID">javascript.1.Cubie.Uptime_Tage</field></block></value></block></value></block></statement></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></statement> <next><block type="create" id=".}.ey:Itd)91H;2~Ou[/"><field name="NAME">javascript.1.Cubie.Uptime_ges</field> <statement name="STATEMENT"><block type="create" id="vkCry^Ep%ux9#tQ5J#`0"><field name="NAME">javascript.1.Cubie.Uptime_Tage</field> <statement name="STATEMENT"><block type="create" id="`VapYHDvE2gl.CuQ*IED"><field name="NAME">javascript.1.Cubie.Uptime_Std</field> <statement name="STATEMENT"><block type="create" id="rdA^Te*[%Mun~V9t~SMG"><field name="NAME">javascript.1.Cubie.Uptime_Min</field> <statement name="STATEMENT"><block type="create" id="1*PWEyAezqJk]URWmWzW"><field name="NAME">javascript.1.Cubie.Uptime_Text</field> <statement name="STATEMENT"><block type="create" id="=x(!bGVP%kvGKhaOG2HP"><field name="NAME">javascript.1.Cubie.Uptime_ZW</field> <statement name="STATEMENT"><block type="create" id="m*Lv03:nqoS8qxKs3X}="><field name="NAME">javascript.1.Cubie.Uptime_ZW2</field> <statement name="STATEMENT"><block type="create" id="A~.H}%h8CQ9g*Ho-DlqC"><field name="NAME">javascript.1.Cubie.Uptime_max</field></block></statement></block></statement></block></statement></block></statement></block></statement></block></statement></block></statement></block></next></block></xml>Gruss
Volkmar
-
Hallo Volkmar, vielen Dank für dein Skript.
Ich habe es ein wenig umgeschrieben, sodass ich nur einen Datenpunkt erstellen musst:
<xml xmlns="http://www.w3.org/1999/xhtml"><block type="schedule" id="S},%B!W7FjU|w+;Bi3u/" x="-662" y="-338"><field name="SCHEDULE">*/1 * * * *</field> <statement name="STATEMENT"><block type="comment" id="x#L9[%LY|Yrx`l)DWm|n"><field name="COMMENT">Uptime Master</field> <next><block type="variables_set" id="c;vRX]+MD3w~Fa4u0_oA"><field name="VAR">master_uptime_gesamt</field> <value name="VALUE"><block type="get_value" id="#=Ud:?8|Bc0R?oq(}{Vz"><field name="ATTR">val</field> <field name="OID">rpi2.0.uptime.uptime</field></block></value> <next><block type="variables_set" id=":+s25++7%;E1ZPSp_bNH"><field name="VAR">master_uptime_tage</field> <value name="VALUE"><block type="math_round" id="V_n,Z?87Yzo#1@Gk)B_|"><field name="OP">ROUNDDOWN</field> <value name="NUM"><shadow type="math_number" id="w)m[6-o#SFO|})aX;^Sn"><field name="NUM">3.1</field></shadow> <block type="math_arithmetic" id="#vPh0eWHzHbmc0{P(xGl"><field name="OP">DIVIDE</field> <value name="A"><shadow type="math_number" id="bahI:FVxEi%`f[PVR#?r"><field name="NUM">1</field></shadow> <block type="get_value" id="[]}_AgMQs2tS-b3SOG6:"><field name="ATTR">val</field> <field name="OID">rpi2.0.uptime.uptime</field></block></value> <value name="B"><shadow type="math_number" id="cBfkqtHp/(na=hF*Xs;{"><field name="NUM">86400</field></shadow></value></block></value></block></value> <next><block type="variables_set" id="xf#[c;spkxV;?_=;2t4]"><field name="VAR">master_uptime_zw</field> <value name="VALUE"><block type="math_arithmetic" id="g85j0([NmkejbN]_LFQ;"><field name="OP">MINUS</field> <value name="A"><shadow type="math_number" id="}H73ztKqU,dkWZ,F,i*R"><field name="NUM">1</field></shadow> <block type="variables_get" id="-VqLq_~+I^S2}L3!#xzI"><field name="VAR">master_uptime_gesamt</field></block></value> <value name="B"><shadow type="math_number" id="P5_|Dw(]!C*d/0LDlJX["><field name="NUM">86400</field></shadow> <block type="math_arithmetic" id="8KQWiO_0+1E7KPBL`BnK"><field name="OP">MULTIPLY</field> <value name="A"><shadow type="math_number" id=",I@|[8va{Mw(V#ASt9{M"><field name="NUM">1</field></shadow> <block type="variables_get" id="HYJ?9+`q-3)^O0iZJD-["><field name="VAR">master_uptime_tage</field></block></value> <value name="B"><shadow type="math_number" id="@(,y`FuDg+P*5o[794U6"><field name="NUM">86400</field></shadow></value></block></value></block></value> <next><block type="variables_set" id="eAJhBVv3}N8LUFKRAWGZ"><field name="VAR">master_uptime_std</field> <value name="VALUE"><block type="math_round" id="/RbEc%QP!6/M9EimZe]N"><field name="OP">ROUNDDOWN</field> <value name="NUM"><shadow type="math_number" id="w)m[6-o#SFO|})aX;^Sn"><field name="NUM">0</field></shadow> <block type="math_arithmetic" id="BFHl3E~ysn|,xUa5Vb8#"><field name="OP">DIVIDE</field> <value name="A"><shadow type="math_number" id="bahI:FVxEi%`f[PVR#?r"><field name="NUM">1</field></shadow> <block type="variables_get" id="7=o8aPA{`ENu)Ede_%B@"><field name="VAR">master_uptime_zw</field></block></value> <value name="B"><shadow type="math_number" id="6k]Nz4u+nuL.OON8Z+?j"><field name="NUM">3600</field></shadow></value></block></value></block></value> <next><block type="variables_set" id=".+IdB1+tIgC(cXj^#9gr"><field name="VAR">master_uptime_zw2</field> <value name="VALUE"><block type="math_arithmetic" id="Tb1}ci*dwi]?N(+VZS0*"><field name="OP">MINUS</field> <value name="A"><shadow type="math_number" id="}H73ztKqU,dkWZ,F,i*R"><field name="NUM">1</field></shadow> <block type="variables_get" id="pl@KE2~vpoFkF~SSzk%%"><field name="VAR">master_uptime_zw</field></block></value> <value name="B"><shadow type="math_number" id="P5_|Dw(]!C*d/0LDlJX["><field name="NUM">0</field></shadow> <block type="math_arithmetic" id="pIkaJRUH0EN9i5BFh|Ou"><field name="OP">MULTIPLY</field> <value name="A"><shadow type="math_number" id=",I@|[8va{Mw(V#ASt9{M"><field name="NUM">1</field></shadow> <block type="variables_get" id="^B.o=TuQbG!2~GNM/e-d"><field name="VAR">master_uptime_std</field></block></value> <value name="B"><shadow type="math_number" id="jHJ,OA,V7xyG1^Be^jW."><field name="NUM">3600</field></shadow></value></block></value></block></value> <next><block type="variables_set" id="6GHul#I2g`ZkYC1e~C{1"><field name="VAR">master_uptime_min</field> <value name="VALUE"><block type="math_round" id="I%[WOX~v6)8yc}K1_|nS"><field name="OP">ROUNDDOWN</field> <value name="NUM"><shadow type="math_number" id="w)m[6-o#SFO|})aX;^Sn"><field name="NUM">3.1</field></shadow> <block type="math_arithmetic" id="kqIicz=;J=5v)|+`2Vs)"><field name="OP">DIVIDE</field> <value name="A"><shadow type="math_number" id="}H73ztKqU,dkWZ,F,i*R"><field name="NUM">1</field></shadow> <block type="variables_get" id="/E]PwFOERrG;mY.@U?fN"><field name="VAR">master_uptime_zw2</field></block></value> <value name="B"><shadow type="math_number" id=":5Jjoq2?fnn.3?nX.qu5"><field name="NUM">60</field></shadow></value></block></value></block></value> <next><block type="update" id="(g+SDiV]@I6UoHl8jE.i"><mutation delay_input="false"></mutation> <field name="OID">javascript.0.master_uptime</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"><block type="text_join" id="|gSv+WZHIMcsYv;iY}y5"><mutation items="6"></mutation> <value name="ADD0"><block type="variables_get" id=";lH~jePSwnZZ`B9Uf9#8"><field name="VAR">master_uptime_tage</field></block></value> <value name="ADD1"><block type="text" id="_N5MntuQ3.OAGrQ,UEnV"><field name="TEXT">Tag(e),</field></block></value> <value name="ADD2"><block type="variables_get" id=".4sH_?4VFhqf^8u!M7F9"><field name="VAR">master_uptime_std</field></block></value> <value name="ADD3"><block type="text" id="V0sqG%|UzZe:%=_GTSO%"><field name="TEXT">Stunde(n),</field></block></value> <value name="ADD4"><block type="variables_get" id="~~tdGbeXHF,RXc4-gV[i"><field name="VAR">master_uptime_min</field></block></value> <value name="ADD5"><block type="text" id="1oy#IR@#^HupeI(++C48"><field name="TEXT"> Minute(n)</field></block></value></block></value></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></statement></block></xml>
