NEWS
[gelöst] Tag und Nacht schaltung geht nicht
-
Hallo,
mein Blockly schaltet nicht ein.
Es sollte um 9:00 uhr bis 20:00 uhr die eingestellte Temperatur halten und dann von 20:00 uhr bis 9:00 uhr die andere Temperatur halten.könnte mir da einer helfen
-
-
hab es jetzt so gemacht
geht aber noch nicht
-
@bullhead
Die falls sonst kannst wie im Beispiel von Paul durch ne einfach sonst ersetzen, wäre schon mal einfacher.
Was geht denn nicht, da ich nicht wirklich ein Fehler sehen kann.
Einzig Deine Schalthystetese ist sehr eng und könnte Probleme machen. -
Hi,
Bin auch nicht der allergrößte Skripter (leider), aber für mich passt der Trigger nicht. Hier wird ja nach Temperatur und nicht nach Uhrzeit getriggert. Somit würde dein Skript nur laufen, wenn sich die Temperatur ändert und nicht die Uhrzeit.
Ich denke du musst den Trigger Zeiplan nehmen:
Sorry für die schlechte Auflösung, komme aber vom iPhone grad nicht in Blockly.
Hoffe du bekommst es schnell gelöst, nicht dass die Schlangen noch versuchen auszubrechen
VG
Leonracer -
@leonracer
Er will die Temperatur zu bestimmte Uhrzeiten anders regeln und was außer die Temperatur soll dann hier der Trigger sein?
Wenn Du hier die Uhrzeit als Trigger nehmen würdest, was theoretisch möglich ist, hättest ne sehr ungenaue Regelung mit recht hoher Systemlast, da man dann schon im Sekundenbereich triggern müsste um die Temperatur vernünftig in dem engen Rahmen zu halten, den er will.Ich tippe hier eher auf die engen Regelgrenzen ohne Timeouts dazwischen, die durch leichte Schwankungen der Temperatur eben das ganze Script etwas überfordern.
@bullhead
Das ganze Thema kommt mir allerdings sehr bekannt vor. Hattest Du nicht schon mal ein Thread zur Terrariensteruerung? Wenn Du das nicht warst, da gibts hier schon was fertiges. -
@Jan1
nein das war ich nicht kannst du mir den Thread mal verlinkenMonatlich wollte ich das auch noch machen, da werde ich große Probleme bekommen
Danke schon mal
-
@bullhead sagte:
geht aber noch nicht
Dann poste mal den vom Blockly erzeugten Javascript-Code ohne die letzte Zeile in Code tags.
@Jan1 sagte in Tag und Nacht schaltung geht nicht:
Deine Schalthystetese ist sehr eng und könnte Probleme machen.
1 K Hysterese sollte nicht zu gering sein.
-
hier das Blockly
kann man da dann das es z.b. vom märz bis mai geht auch noch mit einfügen
on({id: 'mihome.0.devices.weather_v1_158d0002321578.temperature', change: "ne"}, function (obj) { var value = obj.state.val; var oldValue = obj.oldState.val; if (compareTime("09:00", "20:00", "between")) { if ((obj.state ? obj.state.val : "") <= 28 && (obj.oldState ? obj.oldState.val : "") > 28) { setState("sonoff.0.sonoff-Rack-Schlangen.POWER1"/*sonoff-Rack-Schlangen POWER1*/, true); } else if ((obj.state ? obj.state.val : "") >= 29 && (obj.oldState ? obj.oldState.val : "") < 29) { setState("sonoff.0.sonoff-Rack-Schlangen.POWER1"/*sonoff-Rack-Schlangen POWER1*/, false); } } else if (compareTime("20:00", "09:00", "between")) { if ((obj.state ? obj.state.val : "") <= 25 && (obj.oldState ? obj.oldState.val : "") > 25) { setState("sonoff.0.sonoff-Rack-Schlangen.POWER1"/*sonoff-Rack-Schlangen POWER1*/, true); } else if ((obj.state ? obj.state.val : "") >= 26 && (obj.oldState ? obj.oldState.val : "") < 26) { setState("sonoff.0.sonoff-Rack-Schlangen.POWER1"/*sonoff-Rack-Schlangen POWER1*/, false); } } });
<block xmlns="http://www.w3.org/1999/xhtml" type="controls_if" id="zD|B/3lF;QNJg4ILclo^" x="-1616" y="-585"> <mutation elseif="1"></mutation> <value name="IF0"> <block type="time_compare" id="{7U8ww1vqlUE0#2,WNg^"> <mutation end_time="true"></mutation> <field name="OPTION">between</field> <field name="START_TIME">09:00</field> <field name="END_TIME">20:00</field> </block> </value> <statement name="DO0"> <block type="controls_if" id="!ZB-C3F4a~jvkb.D|D8w"> <mutation elseif="1"></mutation> <value name="IF0"> <block type="logic_operation" id="VKC1`9[p8Rr*BleBJ}!}" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="+5B/6!tn8y}VfhP)N{LE"> <field name="OP">LTE</field> <value name="A"> <block type="on_source" id="2|8a8bCC[B?5W2V#uBz2"> <field name="ATTR">state.val</field> </block> </value> <value name="B"> <block type="math_number" id="E/Xf-n88Sy#_}|g?k}R2"> <field name="NUM">28</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="$xVt!a!|wcHU2JH|qS!a"> <field name="OP">GT</field> <value name="A"> <block type="on_source" id="0qq08Dd?lF{v[7~.WL+K"> <field name="ATTR">oldState.val</field> </block> </value> <value name="B"> <block type="math_number" id="6[:n#~82{uE/cYhm.pr7"> <field name="NUM">28</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="mAV9IFI)yXjMtXo2M]D2"> <mutation delay_input="false"></mutation> <field name="OID">sonoff.0.sonoff-Rack-Schlangen.POWER1</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id=".?ucpaU|BCH~wpk^BXcN"> <field name="BOOL">TRUE</field> </block> </value> </block> </statement> <value name="IF1"> <block type="logic_operation" id="G:|JIMsX)7=HbrREq8u@" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="37fhU6%N)+/~AU_5WRy1"> <field name="OP">GTE</field> <value name="A"> <block type="on_source" id="|wgPOLd/d;5|)^`s0E@M"> <field name="ATTR">state.val</field> </block> </value> <value name="B"> <block type="math_number" id="vgmNRxtx~R$B1wD0Vo?h"> <field name="NUM">29</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="AL;l=N%]-}0YJ78+GMj]"> <field name="OP">LT</field> <value name="A"> <block type="on_source" id="KTsDWA6m65IMm8g4WuPB"> <field name="ATTR">oldState.val</field> </block> </value> <value name="B"> <block type="math_number" id="(y5xD-^AIZ,8t=!,z[OE"> <field name="NUM">29</field> </block> </value> </block> </value> </block> </value> <statement name="DO1"> <block type="control" id="s7=@{`70/E1ZK[]?RR7J"> <mutation delay_input="false"></mutation> <field name="OID">sonoff.0.sonoff-Rack-Schlangen.POWER1</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="IaSuQt6pqc4FFX%j16(8"> <field name="BOOL">FALSE</field> </block> </value> </block> </statement> </block> </statement> <value name="IF1"> <block type="time_compare" id="2FBhN?6fkpPW0qTckokB"> <mutation end_time="true"></mutation> <field name="OPTION">between</field> <field name="START_TIME">20:00</field> <field name="END_TIME">09:00</field> </block> </value> <statement name="DO1"> <block type="controls_if" id="7UofBY.^-J#_T43e6g!H"> <mutation elseif="1"></mutation> <value name="IF0"> <block type="logic_operation" id="NORb1QS-u@Cz$/Lb@;xv" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="j88Z%:2I)agv1a%)z?-R"> <field name="OP">LTE</field> <value name="A"> <block type="on_source" id="3:wbGW3K;2dQUr.IjP!$"> <field name="ATTR">state.val</field> </block> </value> <value name="B"> <block type="math_number" id="FZ:ghnLUtoeu/XhoY{SY"> <field name="NUM">25</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id=",|tpq8=##^uMnED+s9T_"> <field name="OP">GT</field> <value name="A"> <block type="on_source" id="k)*MzDBL_2{:UQpJ*Srq"> <field name="ATTR">oldState.val</field> </block> </value> <value name="B"> <block type="math_number" id=";OoOWg%hoW}HfbU|p{S0"> <field name="NUM">25</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="x2;9cRQ`?p(vy4!*u=C1"> <mutation delay_input="false"></mutation> <field name="OID">sonoff.0.sonoff-Rack-Schlangen.POWER1</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="*m},B]WD$kELS:|Tqbsp"> <field name="BOOL">TRUE</field> </block> </value> </block> </statement> <value name="IF1"> <block type="logic_operation" id="{rvkS@Z9$D_Pbg5{`cqh" inline="false"> <field name="OP">AND</field> <value name="A"> <block type="logic_compare" id="X#vJ=veI]Jn%BOw|Cx0o"> <field name="OP">GTE</field> <value name="A"> <block type="on_source" id="lQxZUnyn#*c`zICw;I}k"> <field name="ATTR">state.val</field> </block> </value> <value name="B"> <block type="math_number" id="fY(}.asp=FiJ1)dyf*v*"> <field name="NUM">26</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="FVVzlT,(raA{_bh-:T~B"> <field name="OP">LT</field> <value name="A"> <block type="on_source" id=")`M2XbqnD~iIJ-{GKfW%"> <field name="ATTR">oldState.val</field> </block> </value> <value name="B"> <block type="math_number" id="JsMZ#,F@Lf#VqzFCz`VK"> <field name="NUM">26</field> </block> </value> </block> </value> </block> </value> <statement name="DO1"> <block type="control" id="x*VHn98ltm(aGr7+|(,F"> <mutation delay_input="false"></mutation> <field name="OID">sonoff.0.sonoff-Rack-Schlangen.POWER1</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="?]}`/%:aavasou8WiN{V"> <field name="BOOL">FALSE</field> </block> </value> </block> </statement> </block> </statement> </block>
-
@bullhead sagte:
hier das Blockly
Der Javascript Code entspricht dem Blockly. Das Problem, das ich sehe: Wenn vor 20 Uhr die Heizung eingeschaltet hat, wird nach 20 Uhr die Bedingung "vorheriger Wert < 26" nie erreicht werden und die Heizung bleibt ein. Die Verwendung von "vorheriger Wert" ist bei einem 2-Punkt-Regler nicht angebracht.
Der XML-Export ist unvollständig !
-
@paul53 sagte in Tag und Nacht schaltung geht nicht:
@bullhead sagte:
hier das Blockly
Der Javascript Code entspricht dem Blockly. Das Problem, das ich sehe: Wenn vor 20 Uhr die Heizung eingeschaltet hat, wird nach 20 Uhr die Bedingung "vorheriger Wert < 26" nie erreicht werden und die Heizung bleibt ein. Die Verwendung von "vorheriger Wert" ist bei einem 2-Punkt-Regler nicht angebracht.
Der XML-Export ist unvollständig !
XML unvollständig?
-
@bullhead sagte:
XML unvollständig?
Ja, es fehlt der Trigger-Block.
Mache es besser so:
Dann wird auch nur gesendet, wenn der Aktor schalten soll.
-
-
@paul53 sagte in Tag und Nacht schaltung geht nicht:
@Jan1 sagte in Tag und Nacht schaltung geht nicht:
Deine Schalthystetese ist sehr eng und könnte Probleme machen.
1 K Hysterese sollte nicht zu gering sein.
kommt drauf an, wie schnell die Temperatur wechselt, da ist 1K schon nicht viel. Ich hab da nicht komplett durchgespielt, aber das ist mir eben als erstes in den Sinn gekommen.
Du warst doch auch an der Lösung der anderen Terrarium Steuerung beteiligt, findest Du den Thread noch, da man das Rad ja nicht noch mal erfinden muss.
-
@paul53
Habe es jetzt so gemacht, muss aber leider sagen das es nicht geht
Der sonoff schaltet sich leider nicht ein
Dachte nicht das es so kompliziert wird eine einfache schaltungIch hoffe ihr könnt mir helfen
BlocklyJavascriptTypeScript Skript läuft nicht 06:03:15.423 info javascript.0 (7681) Stop script script.js.Schlangen-Rack.Rack_1.Heizung_Nacht_1 Ausgewählte Blöcke exportieren <xml xmlns="http://www.w3.org/1999/xhtml"> <variables> <variable type="" id="0t+.MBIh.VJb~_OO8p.t">ist</variable> <variable type="" id="//*oIQ2r($TBY]NTG;Yc">soll</variable> <variable type="" id="lS[T.(34r52Ro$RrYf$v">Tagessoll</variable> <variable type="" id="?9qG~uNR}~O*-o9AVAYZ">aktor</variable> <variable type="" id="prt;U,4Y$1:xn})ZeQ71">Nachtsoll</variable> <variable type="" id="FI?EUCIS3PX~=l+m!Tps">Wert</variable> </variables> <block type="on" id="d8M=06k^P_$Yh$j[{8|L" x="-987" y="-587"> <field name="OID">mihome.0.devices.weather_v1_158d0002321578.temperature</field> <field name="CONDITION">any</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="controls_if" id="8-yMOI;phMDsfr~;V[2W"> <mutation elseif="2" else="1"></mutation> <value name="IF0"> <block type="logic_operation" id="g^awKGhR7a,Z3-@C2/|Z" inline="false"> <field name="OP">OR</field> <value name="A"> <block type="logic_compare" id="iUX5rOd`7?w{Umy8Ti8Y"> <field name="OP">EQ</field> <value name="A"> <block type="time_get" id="D3xc7?^_P$8=92I.;5kK"> <mutation format="false" language="false"></mutation> <field name="OPTION">M</field> </block> </value> <value name="B"> <block type="math_number" id="8f^Acdo^6-=3[JI3mJ(p"> <field name="NUM">12</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="}^[sxxzogz{MOBfdfEyS"> <field name="OP">LT</field> <value name="A"> <block type="time_get" id="7^OvZsjNw]hV^Y2zA2yp"> <mutation format="false" language="false"></mutation> <field name="OPTION">M</field> </block> </value> <value name="B"> <block type="math_number" id="*YJ}fF%z43Ez:~c(uw{B"> <field name="NUM">3</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="%.l]Rt_l`]OS,B6Wb(i="> <field name="VAR" id="lS[T.(34r52Ro$RrYf$v" variabletype="">Tagessoll</field> <value name="VALUE"> <block type="math_number" id="Jkf6:GW^!p,rVb,GKkP9"> <field name="NUM">28</field> </block> </value> <next> <block type="variables_set" id="~zXbbWH}7-RHaI{1yL^b"> <field name="VAR" id="prt;U,4Y$1:xn})ZeQ71" variabletype="">Nachtsoll</field> <value name="VALUE"> <block type="math_number" id="ES4v@p@Ix|N/{.j~xe8*"> <field name="NUM">24</field> </block> </value> </block> </next> </block> </statement> <value name="IF1"> <block type="logic_compare" id="8D6(!F^,+d/gvVzRu@!5"> <field name="OP">LT</field> <value name="A"> <block type="time_get" id="]RR)o#6Z(3Isp{G_j3VD"> <mutation format="false" language="false"></mutation> <field name="OPTION">M</field> </block> </value> <value name="B"> <block type="math_number" id="oY^Mli;qUetc_[k^-v@w"> <field name="NUM">6</field> </block> </value> </block> </value> <statement name="DO1"> <block type="variables_set" id="}F@zjdF4Gh_5Ww}hf]PD"> <field name="VAR" id="lS[T.(34r52Ro$RrYf$v" variabletype="">Tagessoll</field> <value name="VALUE"> <block type="math_number" id="vv3~^Fw,PfY*:]]SlP/E"> <field name="NUM">29</field> </block> </value> <next> <block type="variables_set" id="$A{kn#Q)3`^M7+xo~0R,"> <field name="VAR" id="prt;U,4Y$1:xn})ZeQ71" variabletype="">Nachtsoll</field> <value name="VALUE"> <block type="math_number" id="J_#x^in`q`4OtGn5j3=?"> <field name="NUM">26</field> </block> </value> </block> </next> </block> </statement> <value name="IF2"> <block type="logic_compare" id="l8m@TAVItkEcBqf@`e[u"> <field name="OP">LT</field> <value name="A"> <block type="time_get" id="r@V]M]hXw.X*t*Kz/3[8"> <mutation format="false" language="false"></mutation> <field name="OPTION">M</field> </block> </value> <value name="B"> <block type="math_number" id="cu`IR32c;eZe3S~h?l1%"> <field name="NUM">9</field> </block> </value> </block> </value> <statement name="DO2"> <block type="variables_set" id="d1h_q@[A,vableeCu}Pk"> <field name="VAR" id="lS[T.(34r52Ro$RrYf$v" variabletype="">Tagessoll</field> <value name="VALUE"> <block type="math_number" id="5mcGtuJ)/2Q~ha2!cn24"> <field name="NUM">32</field> </block> </value> <next> <block type="variables_set" id="zz8}a-[BRF=gSFiobre,"> <field name="VAR" id="prt;U,4Y$1:xn})ZeQ71" variabletype="">Nachtsoll</field> <value name="VALUE"> <block type="math_number" id=")@[eR9f^o7tZC5jSUDZT"> <field name="NUM">30</field> </block> </value> </block> </next> </block> </statement> <statement name="ELSE"> <block type="variables_set" id="bIip$EC]g?-{~4zPXXkq"> <field name="VAR" id="lS[T.(34r52Ro$RrYf$v" variabletype="">Tagessoll</field> <value name="VALUE"> <block type="math_number" id=":VJ$p)qSL/61CF%M[q;,"> <field name="NUM">30</field> </block> </value> <next> <block type="variables_set" id="5)rGP-sVEC~y!pVGNOLJ"> <field name="VAR" id="prt;U,4Y$1:xn})ZeQ71" variabletype="">Nachtsoll</field> <value name="VALUE"> <block type="math_number" id="dzZU~MjAY{MM$|f/O#]B"> <field name="NUM">28</field> </block> </value> </block> </next> </block> </statement> <next> <block type="controls_if" id="tqj]c9z!29H`!Idm${_a"> <mutation else="1"></mutation> <value name="IF0"> <block type="time_compare" id="Eb8dLv|-1R6XIc`Wru~0"> <mutation end_time="true"></mutation> <field name="OPTION">between</field> <field name="START_TIME">09:00</field> <field name="END_TIME">20:00</field> </block> </value> <statement name="DO0"> <block type="procedures_callnoreturn" id="*wIu7J*/)DB/(MCUvVNF" inline="true"> <mutation name="Regler"> <arg name="ist"></arg> <arg name="soll"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="MPD8ky|QAAEU%7~.Yezf"> <field name="VAR" id="FI?EUCIS3PX~=l+m!Tps" variabletype="">Wert</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="lt{@-X8A3RJF}!E9xg;L"> <field name="VAR" id="lS[T.(34r52Ro$RrYf$v" variabletype="">Tagessoll</field> </block> </value> </block> </statement> <statement name="ELSE"> <block type="procedures_callnoreturn" id="$4k{;]z?~Dp)P*dHGlXS" inline="true"> <mutation name="Regler"> <arg name="ist"></arg> <arg name="soll"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="`lbVb`qU=!bRwrct~7p+"> <field name="VAR" id="FI?EUCIS3PX~=l+m!Tps" variabletype="">Wert</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="R^-+8:6JAd8zy6WuG%xS"> <field name="VAR" id="prt;U,4Y$1:xn})ZeQ71" variabletype="">Nachtsoll</field> </block> </value> </block> </statement> <next> <block type="controls_if" id="7tC3QtnbS[#f[st385TK"> <value name="IF0"> <block type="logic_compare" id="BS[,Cian(C|t#_4^N.^J"> <field name="OP">NEQ</field> <value name="A"> <block type="get_value_var" id="1jo*`VAZdDC+$C,ep3o3"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id="rHk4II?vZ#Ok-buhY-le"> <field name="TEXT">sonoff-Rack-Schlangen POWER1</field> </shadow> </value> </block> </value> <value name="B"> <block type="variables_get" id="BEBiQ4Ne-C.kkXl@mrb|"> <field name="VAR" id="?9qG~uNR}~O*-o9AVAYZ" variabletype="">aktor</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="]2+3.aeXxPWVXlE,;}4q"> <mutation delay_input="false"></mutation> <field name="OID">sonoff.0.sonoff-Rack-Schlangen.POWER1</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="BxOpf1`0=}{|#)BnlW|n"> <field name="VAR" id="?9qG~uNR}~O*-o9AVAYZ" variabletype="">aktor</field> </block> </value> </block> </statement> </block> </next> </block> </next> </block> </statement> </block> <block type="procedures_defnoreturn" id="kb-O}ffpR!p-{y(H{7kn" x="-363" y="-387"> <mutation> <arg name="ist" varid="0t+.MBIh.VJb~_OO8p.t"></arg> <arg name="soll" varid="//*oIQ2r($TBY]NTG;Yc"></arg> </mutation> <field name="NAME">Regler</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> <statement name="STACK"> <block type="controls_if" id="uBXU(T~2C%^)46+Si?7X"> <mutation elseif="1"></mutation> <value name="IF0"> <block type="logic_compare" id="k4D02ADyI/QoRh}r*V%Y"> <field name="OP">LTE</field> <value name="A"> <block type="variables_get" id="Z5E5ZG~r3tAGoNTS5td7"> <field name="VAR" id="0t+.MBIh.VJb~_OO8p.t" variabletype="">ist</field> </block> </value> <value name="B"> <block type="variables_get" id="#an=Dx+1C}BaTs0r,%8;"> <field name="VAR" id="//*oIQ2r($TBY]NTG;Yc" variabletype="">soll</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="DpB@.$tm{{mCxSc$1+0l"> <field name="VAR" id="?9qG~uNR}~O*-o9AVAYZ" variabletype="">aktor</field> <value name="VALUE"> <block type="logic_boolean" id="^D_0pWJUUzH;EN6q{W4,"> <field name="BOOL">TRUE</field> </block> </value> </block> </statement> <value name="IF1"> <block type="logic_compare" id="kZIi4OoR[oz))CJNRC*."> <field name="OP">GTE</field> <value name="A"> <block type="variables_get" id="Fj%$pQV.mnq^!KVAWQ}%"> <field name="VAR" id="0t+.MBIh.VJb~_OO8p.t" variabletype="">ist</field> </block> </value> <value name="B"> <block type="math_arithmetic" id="+W/t_av2pk+^lH0svpWT"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="+odctnC6b23q#EZXBnd:"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="+uqFEF/UH0Q92DU4DDWb"> <field name="VAR" id="//*oIQ2r($TBY]NTG;Yc" variabletype="">soll</field> </block> </value> <value name="B"> <shadow type="math_number" id=")a:3t{4J%_.O(N?$7%N5"> <field name="NUM">1</field> </shadow> </value> </block> </value> </block> </value> <statement name="DO1"> <block type="variables_set" id="E0)N%8C!IC[DGCSSKB7Y"> <field name="VAR" id="?9qG~uNR}~O*-o9AVAYZ" variabletype="">aktor</field> <value name="VALUE"> <block type="logic_boolean" id="c(0Px%3xu=^}z%~#7Qk/"> <field name="BOOL">FALSE</field> </block> </value> </block> </statement> </block> </statement> </block> </xml> <xml xmlns="http://www.w3.org/1999/xhtml"> <variables> <variable type="" id="0t+.MBIh.VJb~_OO8p.t">ist</variable> <variable type="" id="//*oIQ2r($TBY]NTG;Yc">soll</variable> <variable type="" id="lS[T.(34r52Ro$RrYf$v">Tagessoll</variable> <variable type="" id="?9qG~uNR}~O*-o9AVAYZ">aktor</variable> <variable type="" id="prt;U,4Y$1:xn})ZeQ71">Nachtsoll</variable> <variable type="" id="FI?EUCIS3PX~=l+m!Tps">Wert</variable> </variables> <block type="on" id="d8M=06k^P_$Yh$j[{8|L" x="-987" y="-587"> <field name="OID">mihome.0.devices.weather_v1_158d0002321578.temperature</field> <field name="CONDITION">any</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="controls_if" id="8-yMOI;phMDsfr~;V[2W"> <mutation elseif="2" else="1"></mutation> <value name="IF0"> <block type="logic_operation" id="g^awKGhR7a,Z3-@C2/|Z" inline="false"> <field name="OP">OR</field> <value name="A"> <block type="logic_compare" id="iUX5rOd`7?w{Umy8Ti8Y"> <field name="OP">EQ</field> <value name="A"> <block type="time_get" id="D3xc7?^_P$8=92I.;5kK"> <mutation format="false" language="false"></mutation> <field name="OPTION">M</field> </block> </value> <value name="B"> <block type="math_number" id="8f^Acdo^6-=3[JI3mJ(p"> <field name="NUM">12</field> </block> </value> </block> </value> <value name="B"> <block type="logic_compare" id="}^[sxxzogz{MOBfdfEyS"> <field name="OP">LT</field> <value name="A"> <block type="time_get" id="7^OvZsjNw]hV^Y2zA2yp"> <mutation format="false" language="false"></mutation> <field name="OPTION">M</field> </block> </value> <value name="B"> <block type="math_number" id="*YJ}fF%z43Ez:~c(uw{B"> <field name="NUM">3</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="%.l]Rt_l`]OS,B6Wb(i="> <field name="VAR" id="lS[T.(34r52Ro$RrYf$v" variabletype="">Tagessoll</field> <value name="VALUE"> <block type="math_number" id="Jkf6:GW^!p,rVb,GKkP9"> <field name="NUM">28</field> </block> </value> <next> <block type="variables_set" id="~zXbbWH}7-RHaI{1yL^b"> <field name="VAR" id="prt;U,4Y$1:xn})ZeQ71" variabletype="">Nachtsoll</field> <value name="VALUE"> <block type="math_number" id="ES4v@p@Ix|N/{.j~xe8*"> <field name="NUM">24</field> </block> </value> </block> </next> </block> </statement> <value name="IF1"> <block type="logic_compare" id="8D6(!F^,+d/gvVzRu@!5"> <field name="OP">LT</field> <value name="A"> <block type="time_get" id="]RR)o#6Z(3Isp{G_j3VD"> <mutation format="false" language="false"></mutation> <field name="OPTION">M</field> </block> </value> <value name="B"> <block type="math_number" id="oY^Mli;qUetc_[k^-v@w"> <field name="NUM">6</field> </block> </value> </block> </value> <statement name="DO1"> <block type="variables_set" id="}F@zjdF4Gh_5Ww}hf]PD"> <field name="VAR" id="lS[T.(34r52Ro$RrYf$v" variabletype="">Tagessoll</field> <value name="VALUE"> <block type="math_number" id="vv3~^Fw,PfY*:]]SlP/E"> <field name="NUM">29</field> </block> </value> <next> <block type="variables_set" id="$A{kn#Q)3`^M7+xo~0R,"> <field name="VAR" id="prt;U,4Y$1:xn})ZeQ71" variabletype="">Nachtsoll</field> <value name="VALUE"> <block type="math_number" id="J_#x^in`q`4OtGn5j3=?"> <field name="NUM">26</field> </block> </value> </block> </next> </block> </statement> <value name="IF2"> <block type="logic_compare" id="l8m@TAVItkEcBqf@`e[u"> <field name="OP">LT</field> <value name="A"> <block type="time_get" id="r@V]M]hXw.X*t*Kz/3[8"> <mutation format="false" language="false"></mutation> <field name="OPTION">M</field> </block> </value> <value name="B"> <block type="math_number" id="cu`IR32c;eZe3S~h?l1%"> <field name="NUM">9</field> </block> </value> </block> </value> <statement name="DO2"> <block type="variables_set" id="d1h_q@[A,vableeCu}Pk"> <field name="VAR" id="lS[T.(34r52Ro$RrYf$v" variabletype="">Tagessoll</field> <value name="VALUE"> <block type="math_number" id="5mcGtuJ)/2Q~ha2!cn24"> <field name="NUM">32</field> </block> </value> <next> <block type="variables_set" id="zz8}a-[BRF=gSFiobre,"> <field name="VAR" id="prt;U,4Y$1:xn})ZeQ71" variabletype="">Nachtsoll</field> <value name="VALUE"> <block type="math_number" id=")@[eR9f^o7tZC5jSUDZT"> <field name="NUM">30</field> </block> </value> </block> </next> </block> </statement> <statement name="ELSE"> <block type="variables_set" id="bIip$EC]g?-{~4zPXXkq"> <field name="VAR" id="lS[T.(34r52Ro$RrYf$v" variabletype="">Tagessoll</field> <value name="VALUE"> <block type="math_number" id=":VJ$p)qSL/61CF%M[q;,"> <field name="NUM">30</field> </block> </value> <next> <block type="variables_set" id="5)rGP-sVEC~y!pVGNOLJ"> <field name="VAR" id="prt;U,4Y$1:xn})ZeQ71" variabletype="">Nachtsoll</field> <value name="VALUE"> <block type="math_number" id="dzZU~MjAY{MM$|f/O#]B"> <field name="NUM">28</field> </block> </value> </block> </next> </block> </statement> <next> <block type="controls_if" id="tqj]c9z!29H`!Idm${_a"> <mutation else="1"></mutation> <value name="IF0"> <block type="time_compare" id="Eb8dLv|-1R6XIc`Wru~0"> <mutation end_time="true"></mutation> <field name="OPTION">between</field> <field name="START_TIME">09:00</field> <field name="END_TIME">20:00</field> </block> </value> <statement name="DO0"> <block type="procedures_callnoreturn" id="*wIu7J*/)DB/(MCUvVNF" inline="true"> <mutation name="Regler"> <arg name="ist"></arg> <arg name="soll"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="MPD8ky|QAAEU%7~.Yezf"> <field name="VAR" id="FI?EUCIS3PX~=l+m!Tps" variabletype="">Wert</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="lt{@-X8A3RJF}!E9xg;L"> <field name="VAR" id="lS[T.(34r52Ro$RrYf$v" variabletype="">Tagessoll</field> </block> </value> </block> </statement> <statement name="ELSE"> <block type="procedures_callnoreturn" id="$4k{;]z?~Dp)P*dHGlXS" inline="true"> <mutation name="Regler"> <arg name="ist"></arg> <arg name="soll"></arg> </mutation> <value name="ARG0"> <block type="variables_get" id="`lbVb`qU=!bRwrct~7p+"> <field name="VAR" id="FI?EUCIS3PX~=l+m!Tps" variabletype="">Wert</field> </block> </value> <value name="ARG1"> <block type="variables_get" id="R^-+8:6JAd8zy6WuG%xS"> <field name="VAR" id="prt;U,4Y$1:xn})ZeQ71" variabletype="">Nachtsoll</field> </block> </value> </block> </statement> <next> <block type="controls_if" id="7tC3QtnbS[#f[st385TK"> <value name="IF0"> <block type="logic_compare" id="BS[,Cian(C|t#_4^N.^J"> <field name="OP">NEQ</field> <value name="A"> <block type="get_value_var" id="1jo*`VAZdDC+$C,ep3o3"> <field name="ATTR">val</field> <value name="OID"> <shadow type="text" id="rHk4II?vZ#Ok-buhY-le"> <field name="TEXT">sonoff-Rack-Schlangen POWER1</field> </shadow> </value> </block> </value> <value name="B"> <block type="variables_get" id="BEBiQ4Ne-C.kkXl@mrb|"> <field name="VAR" id="?9qG~uNR}~O*-o9AVAYZ" variabletype="">aktor</field> </block> </value> </block> </value> <statement name="DO0"> <block type="control" id="]2+3.aeXxPWVXlE,;}4q"> <mutation delay_input="false"></mutation> <field name="OID">sonoff.0.sonoff-Rack-Schlangen.POWER1</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="variables_get" id="BxOpf1`0=}{|#)BnlW|n"> <field name="VAR" id="?9qG~uNR}~O*-o9AVAYZ" variabletype="">aktor</field> </block> </value> </block> </statement> </block> </next> </block> </next> </block> </statement> </block> <block type="procedures_defnoreturn" id="kb-O}ffpR!p-{y(H{7kn" x="-363" y="-387"> <mutation> <arg name="ist" varid="0t+.MBIh.VJb~_OO8p.t"></arg> <arg name="soll" varid="//*oIQ2r($TBY]NTG;Yc"></arg> </mutation> <field name="NAME">Regler</field> <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment> <statement name="STACK"> <block type="controls_if" id="uBXU(T~2C%^)46+Si?7X"> <mutation elseif="1"></mutation> <value name="IF0"> <block type="logic_compare" id="k4D02ADyI/QoRh}r*V%Y"> <field name="OP">LTE</field> <value name="A"> <block type="variables_get" id="Z5E5ZG~r3tAGoNTS5td7"> <field name="VAR" id="0t+.MBIh.VJb~_OO8p.t" variabletype="">ist</field> </block> </value> <value name="B"> <block type="variables_get" id="#an=Dx+1C}BaTs0r,%8;"> <field name="VAR" id="//*oIQ2r($TBY]NTG;Yc" variabletype="">soll</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="DpB@.$tm{{mCxSc$1+0l"> <field name="VAR" id="?9qG~uNR}~O*-o9AVAYZ" variabletype="">aktor</field> <value name="VALUE"> <block type="logic_boolean" id="^D_0pWJUUzH;EN6q{W4,"> <field name="BOOL">TRUE</field> </block> </value> </block> </statement> <value name="IF1"> <block type="logic_compare" id="kZIi4OoR[oz))CJNRC*."> <field name="OP">GTE</field> <value name="A"> <block type="variables_get" id="Fj%$pQV.mnq^!KVAWQ}%"> <field name="VAR" id="0t+.MBIh.VJb~_OO8p.t" variabletype="">ist</field> </block> </value> <value name="B"> <block type="math_arithmetic" id="+W/t_av2pk+^lH0svpWT"> <field name="OP">ADD</field> <value name="A"> <shadow type="math_number" id="+odctnC6b23q#EZXBnd:"> <field name="NUM">1</field> </shadow> <block type="variables_get" id="+uqFEF/UH0Q92DU4DDWb"> <field name="VAR" id="//*oIQ2r($TBY]NTG;Yc" variabletype="">soll</field> </block> </value> <value name="B"> <shadow type="math_number" id=")a:3t{4J%_.O(N?$7%N5"> <field name="NUM">1</field> </shadow> </value> </block> </value> </block> </value> <statement name="DO1"> <block type="variables_set" id="E0)N%8C!IC[DGCSSKB7Y"> <field name="VAR" id="?9qG~uNR}~O*-o9AVAYZ" variabletype="">aktor</field> <value name="VALUE"> <block type="logic_boolean" id="c(0Px%3xu=^}z%~#7Qk/"> <field name="BOOL">FALSE</field> </block> </value> </block> </statement> </block> </statement> </block> </xml>
var ist, soll, Tagessoll, aktor, Nachtsoll, Wert; /** * Beschreibe diese Funktion … */ function Regler(ist, soll) { if (ist <= soll) { aktor = true; } else if (ist >= soll + 1) { aktor = false; } } on({id: "mihome.0.devices.weather_v1_158d0002321578.temperature"/*Temperature*/, change: "any"}, function (obj) { var value = obj.state.val; var oldValue = obj.oldState.val; if ((new Date().getMonth() + 1) == 12 || (new Date().getMonth() + 1) < 3) { Tagessoll = 28; Nachtsoll = 24; } else if ((new Date().getMonth() + 1) < 6) { Tagessoll = 29; Nachtsoll = 26; } else if ((new Date().getMonth() + 1) < 9) { Tagessoll = 32; Nachtsoll = 30; } else { Tagessoll = 30; Nachtsoll = 28; } if (compareTime("09:00", "20:00", "between")) { Regler(Wert, Tagessoll); } else { Regler(Wert, Nachtsoll); } if (getState('sonoff-Rack-Schlangen POWER1').val != aktor) { setState("sonoff.0.sonoff-Rack-Schlangen.POWER1"/*sonoff-Rack-Schlangen POWER1*/, aktor); } });
-
@bullhead sagte:
Der sonoff schaltet sich leider nicht ein
Am Script liegt es nur, wenn falsche Datenpunkte zugeordnet sind. Die Funktionalität ist i.O.
EDIT: Wert muss die Eigenschaft des Trigger-Datenpunktes sein, keine Variable.
-
jetzt habe ich eine Fehler meldung
Hilft das was
javascript.0 2020-03-12 14:56:38.674 warn (7681) at processImmediate (timers.js:658:5) javascript.0 2020-03-12 14:56:38.674 warn (7681) at tryOnImmediate (timers.js:676:5) javascript.0 2020-03-12 14:56:38.674 warn (7681) at runCallback (timers.js:705:18) javascript.0 2020-03-12 14:56:38.673 warn (7681) at Immediate.setImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:4851:37) javascript.0 2020-03-12 14:56:38.673 warn (7681) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:450:25) javascript.0 2020-03-12 14:56:38.672 warn (7681) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1123:38) javascript.0 2020-03-12 14:56:38.671 warn (7681) at Object.<anonymous> (script.js.Schlangen-Rack.Rack_1.Heizung_Nacht_1:36:7) javascript.0 2020-03-12 14:56:38.669 warn (7681) getState "sonoff-Rack-Schlangen.POWER1" not found (3) javascript.0 2020-03-12 14:56:28.334 warn (7681) at processImmediate (timers.js:658:5) javascript.0 2020-03-12 14:56:28.334 warn (7681) at tryOnImmediate (timers.js:676:5) javascript.0 2020-03-12 14:56:28.333 warn (7681) at runCallback (timers.js:705:18) javascript.0 2020-03-12 14:56:28.333 warn (7681) at Immediate.setImmediate (/opt/iobroker/node_modules/iobroker.js-controller/lib/adapter.js:4851:37) javascript.0 2020-03-12 14:56:28.332 warn (7681) at Object.stateChange (/opt/iobroker/node_modules/iobroker.javascript/main.js:450:25) javascript.0 2020-03-12 14:56:28.332 warn (7681) at Object.callback (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1123:38) javascript.0 2020-03-12 14:56:28.331 warn (7681) at Object.<anonymous> (script.js.Schlangen-Rack.Rack_1.Heizung_Nacht_1:36:7) javascript.0 2020-03-12 14:56:28.329 warn (7681) getState "sonoff-Rack-Schlangen.POWER1" not found (3) javascript.0 2020-03-12 13:55:00.865 info (7681) script.js.Schlangen-Rack.Rack_1.Heizung_Nacht_1: registered 1 subscription and 0 schedules javascript.0 2020-03-12 13:55:00.860 info (7681) Start javascript script.js.Schlangen-Rack.Rack_1.Heizung_Nacht_1
-
@bullhead sagte:
getState "sonoff-Rack-Schlangen.POWER1" not found
Die Datenpunkt-ID ist falsch. Richtig: sonoff.0.sonoff-Rack-Schlangen.POWER1. Außerdem darf Wert keine Variable sein, sondern eine Eigenschaft des Trigger-Datenpunktes.
-
Das geht auch nicht.
hab keinen plan warum das nicht geht -
@bullhead
Poste mal Dein aktuelles Blockly als Screenshot.