- Home
- Deutsch
- Skripten / Logik
- Blockly
- Präsenzmelder nach Tageszeit mit bestimmter Helligkeit
Präsenzmelder nach Tageszeit mit bestimmter Helligkeit
-
@dslraser stimmt...mit dem zaehler-Intervall stimmt was nicht. Der zählt zu schnell. 2 Sekunden in einer - zumindest ungefähr. Ärgerlich...in einer meiner vorheriger Timer Versionen hatte ich schon passende Zahlen.
-
keine Ahnung was los war, aber es läuft jetzt bei mir, obwohl ich nur das Blockly neu gestartet habe.
@paul53 siehst Du da noch einen Fehler, oder sollte das so passen ?
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="p]Q_9:^{p7_mr,W/%`1v">idLicht_Einschaltdauer</variable> <variable id="Fj?b^GiMZ`!yB^^;6JeN">s</variable> <variable id=":r5GqANK%Ej~131I)--3">idLicht_letzte_Einschaltdauer</variable> <variable id="{OcV;9JI[AK?VB^,6ay*">zaehler</variable> <variable id="=C.#MjA5Hx+2SR[8~+%V">idBri</variable> <variable id="R[Tme+A4^8]zgN@T9eGi">idHUE_command</variable> <variable id="56jVkfRg7_;=([T5D@.(">idPRESENCE</variable> <variable id="2@A~O+K{.tV3zS;N`qAB">HUE_command</variable> <variable type="interval" id="Intervall">Intervall</variable> </variables> <block type="variables_set" id=",bx.3cM[,_8V[YvmD2Sb" x="13" y="-113"> <field name="VAR" id="p]Q_9:^{p7_mr,W/%`1v">idLicht_Einschaltdauer</field> <value name="VALUE"> <block type="field_oid" id="-=.BvR8stZdG8=MnsQ.R"> <field name="oid">0_userdata.0.Licht.Kueche.Einschaltdauer</field> </block> </value> <next> <block type="variables_set" id="6L-`{Q+yW^Q[?`xNY/pJ"> <field name="VAR" id=":r5GqANK%Ej~131I)--3">idLicht_letzte_Einschaltdauer</field> <value name="VALUE"> <block type="field_oid" id="Ip^#H6aRCS-xvtWWR!^C"> <field name="oid">0_userdata.0.Licht.Kueche.letzte_Einschaltdauer</field> </block> </value> <next> <block type="variables_set" id="CSo7=}pqPg@Q3ZAgjZny"> <field name="VAR" id="{OcV;9JI[AK?VB^,6ay*">zaehler</field> <value name="VALUE"> <block type="math_number" id="ev]Qo2PRH7pm|7Z@MSdG"> <field name="NUM">0</field> </block> </value> <next> <block type="variables_set" id="$syTrXc/u:Kjh|6nGcmE"> <field name="VAR" id="=C.#MjA5Hx+2SR[8~+%V">idBri</field> <value name="VALUE"> <block type="field_oid" id="{h*JQ-(=4N%VeeRU8SR{"> <field name="oid">hue.0.Küchenlampe.bri</field> </block> </value> <next> <block type="variables_set" id="GQmh|l;7~*pG}:S?~7^r"> <field name="VAR" id="R[Tme+A4^8]zgN@T9eGi">idHUE_command</field> <value name="VALUE"> <block type="field_oid" id="K^@T*?Me;9*2Tkr{[mh#"> <field name="oid">hue.0.Küchenlampe.command</field> </block> </value> <next> <block type="variables_set" id="81IoUR6={LX+_w]n,kta"> <field name="VAR" id="56jVkfRg7_;=([T5D@.(">idPRESENCE</field> <value name="VALUE"> <block type="field_oid" id="MIY|+n}Ohw$2qK[k|nx^"> <field name="oid">hm-rpc.0.000C18A996B41F.1.PRESENCE_DETECTION_STATE</field> </block> </value> <next> <block type="control_ex" id="fLc1Q,{9n.tqgKsC%mg{" inline="true"> <field name="TYPE">true</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="OID"> <shadow type="field_oid"> <field name="oid">Object ID</field> </shadow> <block type="variables_get" id="tE=s,5OJu+lDuMF9BWZ`"> <field name="VAR" id="p]Q_9:^{p7_mr,W/%`1v">idLicht_Einschaltdauer</field> </block> </value> <value name="VALUE"> <shadow type="logic_boolean"> <field name="BOOL">TRUE</field> </shadow> <block type="text" id="z5+B$(D=ja?hy_p8bcNv"> <field name="TEXT">0:00:00</field> </block> </value> <value name="DELAY_MS"> <shadow type="math_number" id="u7rG;7:?l(zw^a]GEHYQ"> <field name="NUM">0</field> </shadow> </value> <next> <block type="on_ext" id=".*n{}kLu_EYHqWfSKNO9"> <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="}88$?|!MiHehDltyR=+y"> <field name="oid">default</field> </shadow> <block type="variables_get" id="hm_7vV!GL.;4#/``id9K"> <field name="VAR" id="56jVkfRg7_;=([T5D@.(">idPRESENCE</field> </block> </value> <statement name="STATEMENT"> <block type="controls_if" id="1*=gPs[40,=!N_0hRWc`"> <mutation else="1"></mutation> <value name="IF0"> <block type="on_source" id="^5^qPS28Y:-wsVZwWvxU"> <field name="ATTR">state.val</field> </block> </value> <statement name="DO0"> <block type="controls_if" id="WpBEaYZB0n9:9u)er:pI"> <mutation elseif="1" else="1"></mutation> <value name="IF0"> <block type="time_compare_ex" id="qBw?hLwW:r[pq_^(K|.|"> <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="yteJQNfl1*r!1Rlf=A9:"> <field name="TEXT">12:00</field> </shadow> <block type="time_astro" id=";w|LeCq`5=RJjGci]jD*"> <field name="TYPE">sunriseEnd</field> <field name="OFFSET">0</field> </block> </value> <value name="END_TIME"> <shadow type="text" id="myBO9xgsi6VvFqHA1Wr%"> <field name="TEXT">18:00</field> </shadow> <block type="time_astro" id="qLYSb,JaJD|nTwX4LO^1"> <field name="TYPE">sunsetStart</field> <field name="OFFSET">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="AaOsctCq6uDCy%}L=vVM"> <field name="VAR" id="2@A~O+K{.tV3zS;N`qAB">HUE_command</field> <value name="VALUE"> <block type="text" id="P|1@(GY)VnU.qH;Am(=7"> <field name="TEXT">{"on":true,"bri":254,"transitiontime":100}</field> </block> </value> </block> </statement> <value name="IF1"> <block type="time_compare_ex" id="d6fQytsi2Nsr6V1AzFF2"> <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"> <field name="TEXT">12:00</field> </shadow> <block type="time_astro" id="X1rS1Nd/Zuz8HZFJu0*A"> <field name="TYPE">dawn</field> <field name="OFFSET">0</field> </block> </value> <value name="END_TIME"> <shadow type="text"> <field name="TEXT">18:00</field> </shadow> <block type="time_astro" id="O--5yLhi;P=K)?e#h|S}"> <field name="TYPE">nauticalDusk</field> <field name="OFFSET">0</field> </block> </value> </block> </value> <statement name="DO1"> <block type="variables_set" id="o-fM]-k5$T:m#dNFyYu)"> <field name="VAR" id="2@A~O+K{.tV3zS;N`qAB">HUE_command</field> <value name="VALUE"> <block type="text" id="V=-_HT-M*}hXbK5Zz2:["> <field name="TEXT">{"on":true,"bri":120,"transitiontime":100}</field> </block> </value> </block> </statement> <statement name="ELSE"> <block type="variables_set" id="Oz7fq-F+O@c}V[NY%2DY"> <field name="VAR" id="2@A~O+K{.tV3zS;N`qAB">HUE_command</field> <value name="VALUE"> <block type="text" id="gGupMQQz1#T$t=YL;e@U"> <field name="TEXT">{"on":true,"bri":10,"transitiontime":50}</field> </block> </value> </block> </statement> </block> </statement> <statement name="ELSE"> <block type="variables_set" id=",H!vbhEivaCe^vw0[UKi"> <field name="VAR" id="2@A~O+K{.tV3zS;N`qAB">HUE_command</field> <value name="VALUE"> <block type="text" id="Az6HQwwrxgR.SQWFG5)1"> <field name="TEXT">{"on":false,"bri":0,"transitiontime":100}</field> </block> </value> </block> </statement> <next> <block type="controls_if" id="T?J!H$p.VDfAmZ6d8-7u"> <value name="IF0"> <block type="logic_compare" id="RgQ*U2XgU=+sUqm)jj3W"> <field name="OP">NEQ</field> <value name="A"> <block type="variables_get" id="|U:sCp-Cnn_~tKC}K!),"> <field name="VAR" id="2@A~O+K{.tV3zS;N`qAB">HUE_command</field> </block> </value> <value name="B"> <block type="get_value_var" id="|~]+?LU3k!!?a#$wIno7"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id="FvsZ~:xA-0WGv1?rVoWM"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="^0hysL4wSLTwF{EKcun$"> <field name="VAR" id="R[Tme+A4^8]zgN@T9eGi">idHUE_command</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="control_ex" id="6zxVMf[6sS;BBuOgvJ*{" inline="true"> <field name="TYPE">false</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="OID"> <shadow type="field_oid" id="A#_aF,$?fY1-ek]a*J=h"> <field name="oid">Object ID</field> </shadow> <block type="variables_get" id="0q#m[E|X0[?rJ./V9tv2"> <field name="VAR" id="R[Tme+A4^8]zgN@T9eGi">idHUE_command</field> </block> </value> <value name="VALUE"> <shadow type="logic_boolean" id="6pN|=hPQU^6D;3xGg])4"> <field name="BOOL">TRUE</field> </shadow> <block type="variables_get" id="U:x3qE`$08H)#4+xUDTa"> <field name="VAR" id="2@A~O+K{.tV3zS;N`qAB">HUE_command</field> </block> </value> <value name="DELAY_MS"> <shadow type="math_number" id="Ga{l)Eq]hZV.SF``:)gM"> <field name="NUM">0</field> </shadow> </value> </block> </statement> </block> </next> </block> </statement> <next> <block type="on_ext" id="Yf[w@OIVV/#hkZHY~sAm"> <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="w6l2B;m6E^2rD8pvp1jz"> <field name="oid">default</field> </shadow> <block type="variables_get" id="L[uz0A,8GP4mcuf%DAe2"> <field name="VAR" id="=C.#MjA5Hx+2SR[8~+%V">idBri</field> </block> </value> <statement name="STATEMENT"> <block type="controls_if" id="g==GuTnIZb`|lRGG`ZM5"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="ef:-=UXYJy2:4[uS#@~2"> <field name="OP">NEQ</field> <value name="A"> <block type="get_value_var" id="-TE~VCq.ip^1FYpk@8cR"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id="Y[3LbM(x^Xh*Xp|Eq#nK"> <field name="TEXT"></field> </shadow> <block type="variables_get" id=":OhK`clcF^yyJ#gZ%P=Z"> <field name="VAR" id="=C.#MjA5Hx+2SR[8~+%V">idBri</field> </block> </value> </block> </value> <value name="B"> <block type="math_number" id="Z|H$Sq3$*a~R)=dPeBIq"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="timeouts_setinterval" id="~F_s=Wf*]FL7_{}k^%OD"> <field name="NAME">Intervall</field> <field name="INTERVAL">1</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="math_change" id="6~OlY[q8VC@X:|jxDzu`"> <field name="VAR" id="{OcV;9JI[AK?VB^,6ay*">zaehler</field> <value name="DELTA"> <shadow type="math_number" id="kh|G|Vj=nLzvt9YN2Y3P"> <field name="NUM">1</field> </shadow> </value> <next> <block type="control_ex" id="|qUBR7!y7YU!ZQQv14PC" inline="true"> <field name="TYPE">true</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="OID"> <shadow type="field_oid" id="UCRPcfc(~SJ*-~2v197O"> <field name="oid">Object ID</field> </shadow> <block type="variables_get" id="BAs]pv8jM?xm$ojU8_L5"> <field name="VAR" id="p]Q_9:^{p7_mr,W/%`1v">idLicht_Einschaltdauer</field> </block> </value> <value name="VALUE"> <shadow type="logic_boolean" id="33f83ikZ4X?~IJ,RZ~dl"> <field name="BOOL">TRUE</field> </shadow> <block type="procedures_callcustomreturn" id="zs1uP7dC%p9@qx#X9uIi" inline="true"> <mutation name="sec2string"> <arg name="s"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="()0K]w6?1GChH6u`ZB5="> <field name="VAR" id="{OcV;9JI[AK?VB^,6ay*">zaehler</field> </block> </value> </block> </value> <value name="DELAY_MS"> <shadow type="math_number" id="hBYn%e$vq7h#%kIO:,sz"> <field name="NUM">0</field> </shadow> </value> </block> </next> </block> </statement> </block> </statement> <statement name="ELSE"> <block type="timeouts_clearinterval" id="`OYWq]o8YWI0RA)$0vd$"> <field name="NAME">Intervall</field> <next> <block type="control_ex" id=",a$8A.qEVfCUlKqh~Xzk" inline="true"> <field name="TYPE">true</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="OID"> <shadow type="field_oid"> <field name="oid">Object ID</field> </shadow> <block type="variables_get" id="|DE(?b#N7+W/0ZOt@C9w"> <field name="VAR" id=":r5GqANK%Ej~131I)--3">idLicht_letzte_Einschaltdauer</field> </block> </value> <value name="VALUE"> <shadow type="logic_boolean" id="7#`88QrQL{dL[)L9W_LW"> <field name="BOOL">TRUE</field> </shadow> <block type="procedures_callcustomreturn" id="H09rTE~e-~eAQL-{ia/l" inline="true"> <mutation name="sec2string"> <arg name="s"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="TMK@?HrS6WCY?WeVv8o,"> <field name="VAR" id="{OcV;9JI[AK?VB^,6ay*">zaehler</field> </block> </value> </block> </value> <value name="DELAY_MS"> <shadow type="math_number" id="Sjc,M++AP)e4,OK9A8PD"> <field name="NUM">0</field> </shadow> </value> <next> <block type="control_ex" id="aMiW-z/%I.CuLA#,*|CI" inline="true"> <field name="TYPE">true</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="OID"> <shadow type="field_oid"> <field name="oid">Object ID</field> </shadow> <block type="variables_get" id="YW)((OrQkiSL=hKN9CyY"> <field name="VAR" id="p]Q_9:^{p7_mr,W/%`1v">idLicht_Einschaltdauer</field> </block> </value> <value name="VALUE"> <shadow type="logic_boolean" id="@0ES5:;J3Y9t8VdvPj98"> <field name="BOOL">TRUE</field> </shadow> <block type="text" id="ZlL}e[e`gg?q|5MI?@Qm"> <field name="TEXT">0:00:00</field> </block> </value> <value name="DELAY_MS"> <shadow type="math_number" id="n_M4n`|RxOH(ktp|uO;:"> <field name="NUM">0</field> </shadow> </value> <next> <block type="variables_set" id="qp$k(`+r=)fg!`{-s`cj"> <field name="VAR" id="{OcV;9JI[AK?VB^,6ay*">zaehler</field> <value name="VALUE"> <block type="math_number" id="|4.1@jPli@YP_NO7,HSk"> <field name="NUM">0</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> <block type="procedures_defcustomreturn" id=";_1+?A#3w_u2L]X@Br_;" x="687" y="-112"> <mutation statements="false"> <arg name="s" varid="Fj?b^GiMZ`!yB^^;6JeN"></arg> </mutation> <field name="NAME">sec2string</field> <field name="SCRIPT">cmV0dXJuIGZvcm1hdERhdGUoMTAwMCAqIHMsICdoOm1tOnNzJyk7</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> </xml>
-
@dslraser sagte: siehst Du da noch einen Fehler, oder sollte das so passen ?
Es werden mehrere Intervalle gestartet, die sich dann nicht mehr stoppen lassen. Das muss verhindert werden:
-
Nach einem erneuten Start/Stop des Skriptes läuft nun alles genauso, wie ich es mir gewünscht habe!
1000 Dank für Eure Unterstützung! Ich bin begeistert und sprachlos über euer Wissen!!! Mega hilfreich!! -
@hinsen2k
Noch etwas optimiert: -
und übernommen. Danke
Ich bekomme ich log vom Blockly nun noch folgende Meldungen
Kannst Du dir das erklären?
Wenn ich mir den Timer in der VIS anschaue, läuft der recht unregelmäßig. Mein Bauchgefühl sagt mir, dass da ggf. die Zeiten nicht einer echt Sekunde entsprechen. Kann man das ggf. auch über die Datum und Zeit Objekte lösen? Ist das dann genauer?
-
@hinsen2k sagte in Präsenzmelder nach Tageszeit mit bestimmter Helligkeit:
Kannst Du dir das erklären?
was steht denn in der Zeile 46 an Position 7 (js-Ansicht)
-
-
@hinsen2k keine Screenshots, da kann man nicht kopieren.
Aber da werden leere "" gesendet -
@hinsen2k sagte: Wenn ich mir den Timer in der VIS anschaue, läuft der recht unregelmäßig.
Gibt es vielleicht zwei Variablen Intervall (oberste Zeile im Javascript-Code)?
@hinsen2k sagte in Präsenzmelder nach Tageszeit mit bestimmter Helligkeit:
folgende Meldungen
Gibt es im Tab "Log" weitere Informationen?
-
var s, zaehler, iDbri, HUE_command, Praesenzmelder_PRESNECE_DETECTION_STATE, idLicht_Einschaltdauer, idLicht_letzte_Einschaltdauer, HUE_command_Wert, Intervall; // Beschreibe diese Funktion … async function sec2string(s) { return formatDate(1000 * s, 'h:mm:ss'); } setState("0_userdata.0.Timer.Timer"/*Timer*/, 0, true); zaehler = 0; iDbri = 'hue.1.Raum_Badezimmer.bri'; HUE_command = 'hue.1.Raum_Badezimmer.command'; Praesenzmelder_PRESNECE_DETECTION_STATE = 'hm-rpc.0.000C1BE9A24E5C.1.PRESENCE_DETECTION_STATE'; idLicht_Einschaltdauer = '0_userdata.0.Timer.Einschaltdauer'; idLicht_letzte_Einschaltdauer = '0_userdata.0.Timer.letzte_Einschaltdauer'; on({id: Praesenzmelder_PRESNECE_DETECTION_STATE, change: "ne"}, async function (obj) { var value = obj.state.val; var oldValue = obj.oldState.val; if ((obj.state ? obj.state.val : "")) { if (compareTime(getAstroDate("sunriseEnd", undefined, 0), getAstroDate("sunsetStart", undefined, 0), "between", null)) { HUE_command_Wert = '{"on":true,"bri":254,"transitiontime":100}'; } else if (compareTime(getAstroDate("dawn", undefined, 0), getAstroDate("nauticalDusk", undefined, 0), "between", null)) { HUE_command_Wert = '{"on":true,"bri":120,"transitiontime":100}'; } else { HUE_command_Wert = '{"on":true,"bri":10,"transitiontime":50}'; } } else { HUE_command_Wert = '{"on":false,"bri":0,"transitiontime":100}'; } if (HUE_command_Wert != getState(HUE_command).val) { setStateDelayed(HUE_command, HUE_command_Wert, false, parseInt(((0) || "").toString(), 10), false); } }); on({id: iDbri, change: "ne"}, async function (obj) { var value = obj.state.val; var oldValue = obj.oldState.val; if ((obj.state ? obj.state.val : "") == 0) { (function () {if (Intervall) {clearInterval(Intervall); Intervall = null;}})(); setStateDelayed(idLicht_letzte_Einschaltdauer, (await sec2string(zaehler)), true, parseInt(((0) || "").toString(), 10), false); setStateDelayed(idLicht_Einschaltdauer, '0:00:00', true, parseInt(((0) || "").toString(), 10), false); zaehler = 0; } else if (!Intervall) { Intervall = setInterval(async function () { zaehler = (typeof zaehler == 'number' ? zaehler : 0) + 1; setStateDelayed(idLicht_Einschaltdauer, (await sec2string(zaehler)), true, parseInt(((0) || "").toString(), 10), false); setStateDelayed('0_userdata.0.Timer.Timer', (await sec2string(zaehler)), true, parseInt(((0) || "").toString(), 10), false); }, 1000); } });
@paul53
ich sehe eigentlich nicht mehrere intervalle?!Hier das andere Log:
javascript.0 2021-09-19 18:55:18.997 info State value to set for "0_userdata.0.Timer.Timer" has to be type "number" but received type "string" javascript.0 2021-09-19 18:55:18.996 info State value to set for "0_userdata.0.Timer.Einschaltdauer" has to be type "number" but received type "string" javascript.0 2021-09-19 18:55:18.992 warn at Object.<anonymous> (script.js.Badezimmer.Beleuchtungs-Automatik_V2:46:7) javascript.0 2021-09-19 18:55:18.992 warn at setStateDelayed (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1483:25) javascript.0 2021-09-19 18:55:18.992 warn at Object.setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1439:20) javascript.0 2021-09-19 18:55:18.991 warn You are assigning a string to the state "0_userdata.0.Timer.Timer" which expects a number. Please fix your code to use a number or change the state type to string. This warning might become an error in future versions. javascript.0 2021-09-19 18:55:18.991 warn at Object.<anonymous> (script.js.Badezimmer.Beleuchtungs-Automatik_V2:45:7) javascript.0 2021-09-19 18:55:18.991 warn at setStateDelayed (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1483:25) javascript.0 2021-09-19 18:55:18.991 warn at Object.setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1439:20) javascript.0 2021-09-19 18:55:18.990 warn You are assigning a string to the state "0_userdata.0.Timer.Einschaltdauer" which expects a number. Please fix your code to use a number or change the state type to string. This warning might become an error in future versions.
-
@hinsen2k
Hier nochmal komplett (läuft bei mir ohne Fehler)Das hier muß angepasst werden so wie Du es haben willst.
<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="2MW(Q?v%W{m8D-,Y1%.{">id</variable> <variable id="-bk[0hwZ`{OpD:0(jBXg">common</variable> <variable id=";[SK{De$S)e$vxdDvTQl">init</variable> <variable id="g:gs:RRS0fulBR6Z;J.A">s</variable> <variable id="p]Q_9:^{p7_mr,W/%`1v">idLicht_aktuelle_Einschaltdauer</variable> <variable id=":r5GqANK%Ej~131I)--3">idLicht_letzte_Einschaltdauer</variable> <variable id="{OcV;9JI[AK?VB^,6ay*">zaehler</variable> <variable id="=C.#MjA5Hx+2SR[8~+%V">idBri</variable> <variable id="R[Tme+A4^8]zgN@T9eGi">idHUE_command</variable> <variable id="56jVkfRg7_;=([T5D@.(">idPRESENCE</variable> <variable id="2@A~O+K{.tV3zS;N`qAB">HUE_command</variable> <variable type="interval" id="Intervall">Intervall</variable> </variables> <block type="procedures_defcustomnoreturn" id="_KXFhTJGmLuPeL6Ox|Xq" x="13" y="13"> <mutation statements="false"> <arg name="id" varid="2MW(Q?v%W{m8D-,Y1%.{"></arg> <arg name="common" varid="-bk[0hwZ`{OpD:0(jBXg"></arg> <arg name="init" varid=";[SK{De$S)e$vxdDvTQl"></arg> </mutation> <field name="NAME">Datenpunkt_erstellen</field> <field name="SCRIPT">aWYoIWV4aXN0c1N0YXRlKGlkKSkgewogICAgY3JlYXRlU3RhdGUoaWQgLCBKU09OLnBhcnNlKGNvbW1vbiAsaW5pdCkpOwp9ICAgIA==</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="procedures_defcustomreturn" id=";_1+?A#3w_u2L]X@Br_;" x="13" y="63"> <mutation statements="false"> <arg name="s" varid="g:gs:RRS0fulBR6Z;J.A"></arg> </mutation> <field name="NAME">sec2string</field> <field name="SCRIPT">cmV0dXJuIGZvcm1hdERhdGUoMTAwMCAqIHMsICdoOm1tOnNzJyk7</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> </block> <block type="procedures_callcustomnoreturn" id="0E#Mut[XP*-FpsAV+@W|" x="13" y="113"> <mutation name="Datenpunkt_erstellen"> <arg name="id"></arg> <arg name="common"></arg> <arg name="init"></arg> </mutation> <value name="ARG0"> <block type="text" id="wm2qyCgIZRfYw0.*3-s)"> <field name="TEXT">0_userdata.0.Licht.Kueche.Licht_Kueche_aktuelle_Einschaltdauer</field> </block> </value> <value name="ARG1"> <block type="text" id="x@Dp/4Q4bZ`H_4]oCz7p"> <field name="TEXT">{"name":"Licht Kueche eingeschaltet seit...","type":"string","role":"text","read":true,"write":false,"def":"0:00:00"}</field> </block> </value> <value name="ARG2"> <block type="text" id="z;pV2:=Wm=*Z?mo38=.G"> <field name="TEXT">0:00:00</field> </block> </value> <next> <block type="procedures_callcustomnoreturn" id="7:_pH}F7=%X4*64Y]^qj" inline="false"> <mutation name="Datenpunkt_erstellen"> <arg name="id"></arg> <arg name="common"></arg> <arg name="init"></arg> </mutation> <value name="ARG0"> <block type="text" id="EVtYaYw[_Ls?Dg@9CFcE"> <field name="TEXT">0_userdata.0.Licht.Kueche.Licht_Kueche_letzte_Einschaltdauer</field> </block> </value> <value name="ARG1"> <block type="text" id="`upa.Pw5f/b-$jBf=(v?"> <field name="TEXT">{"name":"Licht Kueche letzte Einschaltdauer","type":"string","role":"text","read":true,"write":false,"def":"0:00:00"}</field> </block> </value> <value name="ARG2"> <block type="text" id="M6}I=IX^4Yj?i,T|]XM%"> <field name="TEXT">0:00:00</field> </block> </value> <next> <block type="variables_set" id=",bx.3cM[,_8V[YvmD2Sb"> <field name="VAR" id="p]Q_9:^{p7_mr,W/%`1v">idLicht_aktuelle_Einschaltdauer</field> <value name="VALUE"> <block type="field_oid" id="-=.BvR8stZdG8=MnsQ.R"> <field name="oid">0_userdata.0.Licht.Kueche.Licht_Kueche_aktuelle_Einschaltdauer</field> </block> </value> <next> <block type="variables_set" id="6L-`{Q+yW^Q[?`xNY/pJ"> <field name="VAR" id=":r5GqANK%Ej~131I)--3">idLicht_letzte_Einschaltdauer</field> <value name="VALUE"> <block type="field_oid" id="Ip^#H6aRCS-xvtWWR!^C"> <field name="oid">0_userdata.0.Licht.Kueche.Licht_Kueche_letzte_Einschaltdauer</field> </block> </value> <next> <block type="variables_set" id="CSo7=}pqPg@Q3ZAgjZny"> <field name="VAR" id="{OcV;9JI[AK?VB^,6ay*">zaehler</field> <value name="VALUE"> <block type="math_number" id="ev]Qo2PRH7pm|7Z@MSdG"> <field name="NUM">0</field> </block> </value> <next> <block type="variables_set" id="$syTrXc/u:Kjh|6nGcmE"> <field name="VAR" id="=C.#MjA5Hx+2SR[8~+%V">idBri</field> <value name="VALUE"> <block type="field_oid" id="{h*JQ-(=4N%VeeRU8SR{"> <field name="oid">hue.0.Küchenlampe.bri</field> </block> </value> <next> <block type="variables_set" id="GQmh|l;7~*pG}:S?~7^r"> <field name="VAR" id="R[Tme+A4^8]zgN@T9eGi">idHUE_command</field> <value name="VALUE"> <block type="field_oid" id="K^@T*?Me;9*2Tkr{[mh#"> <field name="oid">hue.0.Küchenlampe.command</field> </block> </value> <next> <block type="variables_set" id="81IoUR6={LX+_w]n,kta"> <field name="VAR" id="56jVkfRg7_;=([T5D@.(">idPRESENCE</field> <value name="VALUE"> <block type="field_oid" id="MIY|+n}Ohw$2qK[k|nx^"> <field name="oid">hm-rpc.0.000C18A996B41F.1.PRESENCE_DETECTION_STATE</field> </block> </value> <next> <block type="on_ext" id=".*n{}kLu_EYHqWfSKNO9"> <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="}88$?|!MiHehDltyR=+y"> <field name="oid">default</field> </shadow> <block type="variables_get" id="hm_7vV!GL.;4#/``id9K"> <field name="VAR" id="56jVkfRg7_;=([T5D@.(">idPRESENCE</field> </block> </value> <statement name="STATEMENT"> <block type="controls_if" id="1*=gPs[40,=!N_0hRWc`"> <mutation else="1"></mutation> <value name="IF0"> <block type="on_source" id="^5^qPS28Y:-wsVZwWvxU"> <field name="ATTR">state.val</field> </block> </value> <statement name="DO0"> <block type="controls_if" id="WpBEaYZB0n9:9u)er:pI"> <mutation elseif="1" else="1"></mutation> <value name="IF0"> <block type="time_compare_ex" id="qBw?hLwW:r[pq_^(K|.|"> <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="yteJQNfl1*r!1Rlf=A9:"> <field name="TEXT">12:00</field> </shadow> <block type="time_astro" id=";w|LeCq`5=RJjGci]jD*"> <field name="TYPE">sunriseEnd</field> <field name="OFFSET">0</field> </block> </value> <value name="END_TIME"> <shadow type="text" id="myBO9xgsi6VvFqHA1Wr%"> <field name="TEXT">18:00</field> </shadow> <block type="time_astro" id="qLYSb,JaJD|nTwX4LO^1"> <field name="TYPE">sunsetStart</field> <field name="OFFSET">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="AaOsctCq6uDCy%}L=vVM"> <field name="VAR" id="2@A~O+K{.tV3zS;N`qAB">HUE_command</field> <value name="VALUE"> <block type="text" id="P|1@(GY)VnU.qH;Am(=7"> <field name="TEXT">{"on":true,"bri":254,"transitiontime":10}</field> </block> </value> </block> </statement> <value name="IF1"> <block type="time_compare_ex" id="d6fQytsi2Nsr6V1AzFF2"> <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"> <field name="TEXT">12:00</field> </shadow> <block type="time_astro" id="X1rS1Nd/Zuz8HZFJu0*A"> <field name="TYPE">dawn</field> <field name="OFFSET">0</field> </block> </value> <value name="END_TIME"> <shadow type="text"> <field name="TEXT">18:00</field> </shadow> <block type="time_astro" id="O--5yLhi;P=K)?e#h|S}"> <field name="TYPE">nauticalDusk</field> <field name="OFFSET">0</field> </block> </value> </block> </value> <statement name="DO1"> <block type="variables_set" id="o-fM]-k5$T:m#dNFyYu)"> <field name="VAR" id="2@A~O+K{.tV3zS;N`qAB">HUE_command</field> <value name="VALUE"> <block type="text" id="V=-_HT-M*}hXbK5Zz2:["> <field name="TEXT">{"on":true,"bri":120,"transitiontime":10}</field> </block> </value> </block> </statement> <statement name="ELSE"> <block type="variables_set" id="Oz7fq-F+O@c}V[NY%2DY"> <field name="VAR" id="2@A~O+K{.tV3zS;N`qAB">HUE_command</field> <value name="VALUE"> <block type="text" id="gGupMQQz1#T$t=YL;e@U"> <field name="TEXT">{"on":true,"bri":10,"transitiontime":10}</field> </block> </value> </block> </statement> </block> </statement> <statement name="ELSE"> <block type="variables_set" id=",H!vbhEivaCe^vw0[UKi"> <field name="VAR" id="2@A~O+K{.tV3zS;N`qAB">HUE_command</field> <value name="VALUE"> <block type="text" id="Az6HQwwrxgR.SQWFG5)1"> <field name="TEXT">{"on":false,"bri":0,"transitiontime":100}</field> </block> </value> </block> </statement> <next> <block type="controls_if" id="T?J!H$p.VDfAmZ6d8-7u"> <value name="IF0"> <block type="logic_compare" id="RgQ*U2XgU=+sUqm)jj3W"> <field name="OP">NEQ</field> <value name="A"> <block type="variables_get" id="|U:sCp-Cnn_~tKC}K!),"> <field name="VAR" id="2@A~O+K{.tV3zS;N`qAB">HUE_command</field> </block> </value> <value name="B"> <block type="get_value_var" id="|~]+?LU3k!!?a#$wIno7"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id="FvsZ~:xA-0WGv1?rVoWM"> <field name="TEXT"></field> </shadow> <block type="variables_get" id="^0hysL4wSLTwF{EKcun$"> <field name="VAR" id="R[Tme+A4^8]zgN@T9eGi">idHUE_command</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="control_ex" id="6zxVMf[6sS;BBuOgvJ*{" inline="true"> <field name="TYPE">false</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="OID"> <shadow type="field_oid" id="A#_aF,$?fY1-ek]a*J=h"> <field name="oid">Object ID</field> </shadow> <block type="variables_get" id="0q#m[E|X0[?rJ./V9tv2"> <field name="VAR" id="R[Tme+A4^8]zgN@T9eGi">idHUE_command</field> </block> </value> <value name="VALUE"> <shadow type="logic_boolean" id="6pN|=hPQU^6D;3xGg])4"> <field name="BOOL">TRUE</field> </shadow> <block type="variables_get" id="U:x3qE`$08H)#4+xUDTa"> <field name="VAR" id="2@A~O+K{.tV3zS;N`qAB">HUE_command</field> </block> </value> <value name="DELAY_MS"> <shadow type="math_number" id="Ga{l)Eq]hZV.SF``:)gM"> <field name="NUM">0</field> </shadow> </value> </block> </statement> </block> </next> </block> </statement> <next> <block type="on_ext" id="Yf[w@OIVV/#hkZHY~sAm"> <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="w6l2B;m6E^2rD8pvp1jz"> <field name="oid">default</field> </shadow> <block type="variables_get" id="L[uz0A,8GP4mcuf%DAe2"> <field name="VAR" id="=C.#MjA5Hx+2SR[8~+%V">idBri</field> </block> </value> <statement name="STATEMENT"> <block type="controls_if" id="g==GuTnIZb`|lRGG`ZM5"> <mutation elseif="1"></mutation> <value name="IF0"> <block type="logic_compare" id="ef:-=UXYJy2:4[uS#@~2"> <field name="OP">EQ</field> <value name="A"> <block type="on_source" id="Fq9.{5PpZTuC2cp~ZJ-m"> <field name="ATTR">state.val</field> </block> </value> <value name="B"> <block type="math_number" id="Z|H$Sq3$*a~R)=dPeBIq"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="timeouts_clearinterval" id="`OYWq]o8YWI0RA)$0vd$"> <field name="NAME">Intervall</field> <next> <block type="control_ex" id=",a$8A.qEVfCUlKqh~Xzk" inline="true"> <field name="TYPE">true</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="OID"> <shadow type="field_oid"> <field name="oid">Object ID</field> </shadow> <block type="variables_get" id="|DE(?b#N7+W/0ZOt@C9w"> <field name="VAR" id=":r5GqANK%Ej~131I)--3">idLicht_letzte_Einschaltdauer</field> </block> </value> <value name="VALUE"> <shadow type="logic_boolean" id="7#`88QrQL{dL[)L9W_LW"> <field name="BOOL">TRUE</field> </shadow> <block type="procedures_callcustomreturn" id="H09rTE~e-~eAQL-{ia/l" inline="true"> <mutation name="sec2string"> <arg name="s"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="TMK@?HrS6WCY?WeVv8o,"> <field name="VAR" id="{OcV;9JI[AK?VB^,6ay*">zaehler</field> </block> </value> </block> </value> <value name="DELAY_MS"> <shadow type="math_number" id="Sjc,M++AP)e4,OK9A8PD"> <field name="NUM">0</field> </shadow> </value> <next> <block type="control_ex" id="aMiW-z/%I.CuLA#,*|CI" inline="true"> <field name="TYPE">true</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="OID"> <shadow type="field_oid"> <field name="oid">Object ID</field> </shadow> <block type="variables_get" id="YW)((OrQkiSL=hKN9CyY"> <field name="VAR" id="p]Q_9:^{p7_mr,W/%`1v">idLicht_aktuelle_Einschaltdauer</field> </block> </value> <value name="VALUE"> <shadow type="logic_boolean" id="@0ES5:;J3Y9t8VdvPj98"> <field name="BOOL">TRUE</field> </shadow> <block type="text" id="ZlL}e[e`gg?q|5MI?@Qm"> <field name="TEXT">0:00:00</field> </block> </value> <value name="DELAY_MS"> <shadow type="math_number" id="n_M4n`|RxOH(ktp|uO;:"> <field name="NUM">0</field> </shadow> </value> <next> <block type="variables_set" id="qp$k(`+r=)fg!`{-s`cj"> <field name="VAR" id="{OcV;9JI[AK?VB^,6ay*">zaehler</field> <value name="VALUE"> <block type="math_number" id="|4.1@jPli@YP_NO7,HSk"> <field name="NUM">0</field> </block> </value> </block> </next> </block> </next> </block> </next> </block> </statement> <value name="IF1"> <block type="logic_negate" id="KU#Zg,C6_^M/QR}(1cPx"> <value name="BOOL"> <block type="variables_get" id="Q9OqG/n_7CnBa*Qwhp09"> <field name="VAR" id="Intervall" variabletype="interval">Intervall</field> </block> </value> </block> </value> <statement name="DO1"> <block type="timeouts_setinterval" id="~F_s=Wf*]FL7_{}k^%OD"> <field name="NAME">Intervall</field> <field name="INTERVAL">1</field> <field name="UNIT">sec</field> <statement name="STATEMENT"> <block type="math_change" id="6~OlY[q8VC@X:|jxDzu`"> <field name="VAR" id="{OcV;9JI[AK?VB^,6ay*">zaehler</field> <value name="DELTA"> <shadow type="math_number" id="kh|G|Vj=nLzvt9YN2Y3P"> <field name="NUM">1</field> </shadow> </value> <next> <block type="control_ex" id="|qUBR7!y7YU!ZQQv14PC" inline="true"> <field name="TYPE">true</field> <field name="CLEAR_RUNNING">FALSE</field> <value name="OID"> <shadow type="field_oid" id="UCRPcfc(~SJ*-~2v197O"> <field name="oid">Object ID</field> </shadow> <block type="variables_get" id="BAs]pv8jM?xm$ojU8_L5"> <field name="VAR" id="p]Q_9:^{p7_mr,W/%`1v">idLicht_aktuelle_Einschaltdauer</field> </block> </value> <value name="VALUE"> <shadow type="logic_boolean" id="33f83ikZ4X?~IJ,RZ~dl"> <field name="BOOL">TRUE</field> </shadow> <block type="procedures_callcustomreturn" id="zs1uP7dC%p9@qx#X9uIi" inline="true"> <mutation name="sec2string"> <arg name="s"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="()0K]w6?1GChH6u`ZB5="> <field name="VAR" id="{OcV;9JI[AK?VB^,6ay*">zaehler</field> </block> </value> </block> </value> <value name="DELAY_MS"> <shadow type="math_number" id="hBYn%e$vq7h#%kIO:,sz"> <field name="NUM">0</field> </shadow> </value> </block> </next> </block> </statement> </block> </statement> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </next> </block> </xml>
-
@hinsen2k sagte: Hier das andere Log:
Ändere den Datenpunkt-Typ von "0_userdata.0.Timer.Timer" und "0_userdata.0.Timer.Einschaltdauer" von "number" in "string".
Im Skript kann ich keinen Fehler finden.
-
Nun läuft es rund - keine Ahnung warum.
Und die String und Number hatte ich nicht geändert, weil ich dachte, dass das ja übers Script gewandelt wird. Aber siehe da: Nach der Änderung sind alle Fehler bzw. Warnungen aus dem Log beseitigt und der Timer läuft auch rund! Juchu.
-
ich habe das Erstellen der Datenpunkte nochmal angepasst.
Hier habe ich die Änderung eingefügt.