NEWS
Autom. TV-Licht um Timeout erweitern
-
Hallo,
habe ein kleines Blockly erstellt,
das TV Licht soll autom. abgehen, wenn die TV-Ecke "Strom" verbraucht (TV ist an) und es draussen dunkel ist (über aktuelle PV-Erzeugung).
Damit nicht jede Wolke das Licht zum ein/aussschalten bringt würde ich gerne einen 5 minütigen Timeout einbauen,
so das der Status des TV Lichts max. alle 5 Minuten sich ändert.Aber wie und wo einbauen?

<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="hE~ajD3aP|ifgbLDr[vv">vStatus</variable> </variables> <block type="controls_if" id="RGGS|jhJOqFa~*%h^#ly" x="-363" y="-738"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="Kk/M^*[FK3ow%nn;s1}="> <field name="OP">EQ</field> <value name="A"> <block type="get_value" id=");WD|pX42ZY-t.xLP@zJ"> <field name="ATTR">val</field> <field name="OID">alias.0.EG.Licht.Wohnzimmer.TV_Licht.Status</field> </block> </value> <value name="B"> <block type="logic_boolean" id="s!{e(GJ?|xnj4okJk)$0"> <field name="BOOL">TRUE</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="X+/oyz:/!Y^jg^v4LZ8J"> <field name="VAR" id="hE~ajD3aP|ifgbLDr[vv">vStatus</field> <value name="VALUE"> <block type="math_number" id="i[t.t(}$(x=@;:gMu?=i"> <field name="NUM">1</field> </block> </value> </block> </statement> <statement name="ELSE"> <block type="variables_set" id="QuT|6NpF{3yR0Fq#;_)N"> <field name="VAR" id="hE~ajD3aP|ifgbLDr[vv">vStatus</field> <value name="VALUE"> <block type="math_number" id="c-OjQma7|m~6xf)b23.1"> <field name="NUM">0</field> </block> </value> </block> </statement> <next> <block type="debug" id="NdE}mmmy`Y~Lq-WuOV*."> <field name="Severity">info</field> <value name="TEXT"> <shadow type="text" id="3tPkkNmHx(?]C^6qE;N0"> <field name="TEXT">Startwert: </field> </shadow> </value> <next> <block type="debug" id="5^)9`0$tW1{2[6r55:Vd"> <field name="Severity">info</field> <value name="TEXT"> <shadow type="text" id="/*r%lpcq+QVcP3[#1d4R"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="{sBuMB(J.pi,?-:rudpW"> <field name="VAR" id="hE~ajD3aP|ifgbLDr[vv">vStatus</field> </block> </value> <next> <block type="on" id="[cigSU}85##.a7agk3yA"> <field name="OID">sonoff.0.Fernseheecke #s04.ENERGY_Power</field> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="debug" id="iMDa,@p%C[%yyCA7Z{up"> <field name="Severity">info</field> <value name="TEXT"> <shadow type="text" id="b/,7kvGBakrpS7pnwCcq"> <field name="TEXT">test</field> </shadow> <block type="on_source" id="i^8UT.Cn!._X2sTHtMKq"> <field name="ATTR">state.val</field> </block> </value> <next> <block type="controls_if" id="-_6ht3$/`O2E^]5+m8|`"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_multi_and" id="6|l$6-kYgpd3snAMH/mw"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="3"></mutation> <value name="AND0"> <block type="logic_compare" id="1Ve]/%VQCd;$xthy7RaF"> <field name="OP">GT</field> <value name="A"> <block type="on_source" id="e5m-C$KV@PI;fPi4THEr"> <field name="ATTR">state.val</field> </block> </value> <value name="B"> <block type="math_number" id="w$.ZzSjd0Tl@WyTpprVn"> <field name="NUM">65</field> </block> </value> </block> </value> <value name="AND1"> <block type="logic_compare" id="k;D^*?Y6|I{+{Q-$VbF5"> <field name="OP">LT</field> <value name="A"> <block type="get_value" id="+n%eVR`9RkC:V7pv!60S"> <field name="ATTR">val</field> <field name="OID">alias.0.Solar.PV.Erzeugung_Aktuell</field> </block> </value> <value name="B"> <block type="math_number" id=":w$c9(A-eZmK6c5w2O}4"> <field name="NUM">150</field> </block> </value> </block> </value> <value name="AND2"> <block type="logic_compare" id="R#1V9q76SrK-Wb{2`4Lx"> <field name="OP">EQ</field> <value name="A"> <block type="get_value" id="{^Jyuf1nU}:CX-mZE3e2"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Hilfs-DP.Licht.dp_TV_Licht_Automatik</field> </block> </value> <value name="B"> <block type="logic_boolean" id="F-aWwx]Ic[z9ZL@Z8gx-"> <field name="BOOL">TRUE</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="controls_if" id="0?;=88Wz~f]fWt?`f7Da"> <value name="IF0"> <block type="logic_compare" id="4.4Noc/_-G3rxWRqD}ms"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="*WZ^F!!cZ@wLs1?v$aIS"> <field name="VAR" id="hE~ajD3aP|ifgbLDr[vv">vStatus</field> </block> </value> <value name="B"> <block type="math_number" id="U*vQ)~s@m8^{O2$fUoo;"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="debug" id="HpNIM4NH)$@ym)#pq}H$"> <field name="Severity">info</field> <value name="TEXT"> <shadow type="text" id="N)?g=g4]+)/E2Z5!`spN"> <field name="TEXT">Lampe an</field> </shadow> </value> <next> <block type="variables_set" id="`SadT#fALL}dp`z!Tp|k"> <field name="VAR" id="hE~ajD3aP|ifgbLDr[vv">vStatus</field> <value name="VALUE"> <block type="math_number" id="tji0GPh@0WP-+%_dT_E5"> <field name="NUM">1</field> </block> </value> <next> <block type="control" id="s:{.H=Z[[ck8gl2#j]@B"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">alias.0.EG.Licht.Wohnzimmer.TV_Licht.Status</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="I-wF99qegW[N[7_UVs=l"> <field name="BOOL">TRUE</field> </block> </value> </block> </next> </block> </next> </block> </statement> </block> </statement> <statement name="ELSE"> <block type="controls_if" id="jLuq7b+%:S)?xliJbmh#"> <value name="IF0"> <block type="logic_compare" id="3_m!,{dQiPBc5kKJy9,0"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="*L~$.@Y!~Vv93EqRbJma"> <field name="VAR" id="hE~ajD3aP|ifgbLDr[vv">vStatus</field> </block> </value> <value name="B"> <block type="math_number" id="mf~}yM6BB~;e/=6?OV`t"> <field name="NUM">1</field> </block> </value> </block> </value> <statement name="DO0"> <block type="debug" id="lmI=,HQ,k;W!76WRyU1w"> <field name="Severity">info</field> <value name="TEXT"> <shadow type="text" id="p@J$m?nT?DU2t$kht_l?"> <field name="TEXT">Lampe aus</field> </shadow> </value> <next> <block type="variables_set" id="aT:7CA7z+Y3K6?WRGGq4"> <field name="VAR" id="hE~ajD3aP|ifgbLDr[vv">vStatus</field> <value name="VALUE"> <block type="math_number" id="ge}wCv)Oi$YcP%1))Fke"> <field name="NUM">0</field> </block> </value> <next> <block type="control" id="Ghj6%smer~;FbH}%x^}}"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">alias.0.EG.Licht.Wohnzimmer.TV_Licht.Status</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="-%lI;BR8BboN6pVAazk$"> <field name="BOOL">FALSE</field> </block> </value> </block> </next> </block> </next> </block> </statement> </block> </statement> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </xml> -
Hallo,
habe ein kleines Blockly erstellt,
das TV Licht soll autom. abgehen, wenn die TV-Ecke "Strom" verbraucht (TV ist an) und es draussen dunkel ist (über aktuelle PV-Erzeugung).
Damit nicht jede Wolke das Licht zum ein/aussschalten bringt würde ich gerne einen 5 minütigen Timeout einbauen,
so das der Status des TV Lichts max. alle 5 Minuten sich ändert.Aber wie und wo einbauen?

<xml xmlns="https://developers.google.com/blockly/xml"> <variables> <variable id="hE~ajD3aP|ifgbLDr[vv">vStatus</variable> </variables> <block type="controls_if" id="RGGS|jhJOqFa~*%h^#ly" x="-363" y="-738"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_compare" id="Kk/M^*[FK3ow%nn;s1}="> <field name="OP">EQ</field> <value name="A"> <block type="get_value" id=");WD|pX42ZY-t.xLP@zJ"> <field name="ATTR">val</field> <field name="OID">alias.0.EG.Licht.Wohnzimmer.TV_Licht.Status</field> </block> </value> <value name="B"> <block type="logic_boolean" id="s!{e(GJ?|xnj4okJk)$0"> <field name="BOOL">TRUE</field> </block> </value> </block> </value> <statement name="DO0"> <block type="variables_set" id="X+/oyz:/!Y^jg^v4LZ8J"> <field name="VAR" id="hE~ajD3aP|ifgbLDr[vv">vStatus</field> <value name="VALUE"> <block type="math_number" id="i[t.t(}$(x=@;:gMu?=i"> <field name="NUM">1</field> </block> </value> </block> </statement> <statement name="ELSE"> <block type="variables_set" id="QuT|6NpF{3yR0Fq#;_)N"> <field name="VAR" id="hE~ajD3aP|ifgbLDr[vv">vStatus</field> <value name="VALUE"> <block type="math_number" id="c-OjQma7|m~6xf)b23.1"> <field name="NUM">0</field> </block> </value> </block> </statement> <next> <block type="debug" id="NdE}mmmy`Y~Lq-WuOV*."> <field name="Severity">info</field> <value name="TEXT"> <shadow type="text" id="3tPkkNmHx(?]C^6qE;N0"> <field name="TEXT">Startwert: </field> </shadow> </value> <next> <block type="debug" id="5^)9`0$tW1{2[6r55:Vd"> <field name="Severity">info</field> <value name="TEXT"> <shadow type="text" id="/*r%lpcq+QVcP3[#1d4R"> <field name="TEXT">test</field> </shadow> <block type="variables_get" id="{sBuMB(J.pi,?-:rudpW"> <field name="VAR" id="hE~ajD3aP|ifgbLDr[vv">vStatus</field> </block> </value> <next> <block type="on" id="[cigSU}85##.a7agk3yA"> <field name="OID">sonoff.0.Fernseheecke #s04.ENERGY_Power</field> <field name="CONDITION">ne</field> <field name="ACK_CONDITION"></field> <statement name="STATEMENT"> <block type="debug" id="iMDa,@p%C[%yyCA7Z{up"> <field name="Severity">info</field> <value name="TEXT"> <shadow type="text" id="b/,7kvGBakrpS7pnwCcq"> <field name="TEXT">test</field> </shadow> <block type="on_source" id="i^8UT.Cn!._X2sTHtMKq"> <field name="ATTR">state.val</field> </block> </value> <next> <block type="controls_if" id="-_6ht3$/`O2E^]5+m8|`"> <mutation else="1"></mutation> <value name="IF0"> <block type="logic_multi_and" id="6|l$6-kYgpd3snAMH/mw"> <mutation xmlns="http://www.w3.org/1999/xhtml" items="3"></mutation> <value name="AND0"> <block type="logic_compare" id="1Ve]/%VQCd;$xthy7RaF"> <field name="OP">GT</field> <value name="A"> <block type="on_source" id="e5m-C$KV@PI;fPi4THEr"> <field name="ATTR">state.val</field> </block> </value> <value name="B"> <block type="math_number" id="w$.ZzSjd0Tl@WyTpprVn"> <field name="NUM">65</field> </block> </value> </block> </value> <value name="AND1"> <block type="logic_compare" id="k;D^*?Y6|I{+{Q-$VbF5"> <field name="OP">LT</field> <value name="A"> <block type="get_value" id="+n%eVR`9RkC:V7pv!60S"> <field name="ATTR">val</field> <field name="OID">alias.0.Solar.PV.Erzeugung_Aktuell</field> </block> </value> <value name="B"> <block type="math_number" id=":w$c9(A-eZmK6c5w2O}4"> <field name="NUM">150</field> </block> </value> </block> </value> <value name="AND2"> <block type="logic_compare" id="R#1V9q76SrK-Wb{2`4Lx"> <field name="OP">EQ</field> <value name="A"> <block type="get_value" id="{^Jyuf1nU}:CX-mZE3e2"> <field name="ATTR">val</field> <field name="OID">0_userdata.0.Hilfs-DP.Licht.dp_TV_Licht_Automatik</field> </block> </value> <value name="B"> <block type="logic_boolean" id="F-aWwx]Ic[z9ZL@Z8gx-"> <field name="BOOL">TRUE</field> </block> </value> </block> </value> </block> </value> <statement name="DO0"> <block type="controls_if" id="0?;=88Wz~f]fWt?`f7Da"> <value name="IF0"> <block type="logic_compare" id="4.4Noc/_-G3rxWRqD}ms"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="*WZ^F!!cZ@wLs1?v$aIS"> <field name="VAR" id="hE~ajD3aP|ifgbLDr[vv">vStatus</field> </block> </value> <value name="B"> <block type="math_number" id="U*vQ)~s@m8^{O2$fUoo;"> <field name="NUM">0</field> </block> </value> </block> </value> <statement name="DO0"> <block type="debug" id="HpNIM4NH)$@ym)#pq}H$"> <field name="Severity">info</field> <value name="TEXT"> <shadow type="text" id="N)?g=g4]+)/E2Z5!`spN"> <field name="TEXT">Lampe an</field> </shadow> </value> <next> <block type="variables_set" id="`SadT#fALL}dp`z!Tp|k"> <field name="VAR" id="hE~ajD3aP|ifgbLDr[vv">vStatus</field> <value name="VALUE"> <block type="math_number" id="tji0GPh@0WP-+%_dT_E5"> <field name="NUM">1</field> </block> </value> <next> <block type="control" id="s:{.H=Z[[ck8gl2#j]@B"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">alias.0.EG.Licht.Wohnzimmer.TV_Licht.Status</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="I-wF99qegW[N[7_UVs=l"> <field name="BOOL">TRUE</field> </block> </value> </block> </next> </block> </next> </block> </statement> </block> </statement> <statement name="ELSE"> <block type="controls_if" id="jLuq7b+%:S)?xliJbmh#"> <value name="IF0"> <block type="logic_compare" id="3_m!,{dQiPBc5kKJy9,0"> <field name="OP">EQ</field> <value name="A"> <block type="variables_get" id="*L~$.@Y!~Vv93EqRbJma"> <field name="VAR" id="hE~ajD3aP|ifgbLDr[vv">vStatus</field> </block> </value> <value name="B"> <block type="math_number" id="mf~}yM6BB~;e/=6?OV`t"> <field name="NUM">1</field> </block> </value> </block> </value> <statement name="DO0"> <block type="debug" id="lmI=,HQ,k;W!76WRyU1w"> <field name="Severity">info</field> <value name="TEXT"> <shadow type="text" id="p@J$m?nT?DU2t$kht_l?"> <field name="TEXT">Lampe aus</field> </shadow> </value> <next> <block type="variables_set" id="aT:7CA7z+Y3K6?WRGGq4"> <field name="VAR" id="hE~ajD3aP|ifgbLDr[vv">vStatus</field> <value name="VALUE"> <block type="math_number" id="ge}wCv)Oi$YcP%1))Fke"> <field name="NUM">0</field> </block> </value> <next> <block type="control" id="Ghj6%smer~;FbH}%x^}}"> <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation> <field name="OID">alias.0.EG.Licht.Wohnzimmer.TV_Licht.Status</field> <field name="WITH_DELAY">FALSE</field> <value name="VALUE"> <block type="logic_boolean" id="-%lI;BR8BboN6pVAazk$"> <field name="BOOL">FALSE</field> </block> </value> </block> </next> </block> </next> </block> </statement> </block> </statement> </block> </next> </block> </statement> </block> </next> </block> </next> </block> </next> </block> </xml>@topsurfer sagte: Status des TV Lichts max. alle 5 Minuten sich ändert
Versuche es mal so:

Anmerkung: Ich hätte den Licht-Alias mit Typ "Logikwert" erstellt.
-
@topsurfer sagte: Status des TV Lichts max. alle 5 Minuten sich ändert
Versuche es mal so:

Anmerkung: Ich hätte den Licht-Alias mit Typ "Logikwert" erstellt.
Danke dir, Paul.
@paul53 sagte in Autom. TV-Licht um Timeout erweitern:
Anmerkung: Ich hätte den Licht-Alias mit Typ "Logikwert" erstellt.
Der Alias / DP ist vom Typ Bollean (muss er auch sein),
die (Hilfs) Variable vStatus (0, 1) hab ich nur eingebaut, um (für mich) das Script einfacher gestalten zu können.
(aber im Prinzip könnte man auch hang auf vStatus verzichten und immer direkt den Wert vom DP prüfen).Hatte deine Version schon komplett eingetippt,
jetzt sehe ich aber das es ja so nicht funktionieren kann, denn du setzt ja den vStatus (0 oder 1) auf den Licht-Status, der Boolean verlangt.

-
Danke dir, Paul.
@paul53 sagte in Autom. TV-Licht um Timeout erweitern:
Anmerkung: Ich hätte den Licht-Alias mit Typ "Logikwert" erstellt.
Der Alias / DP ist vom Typ Bollean (muss er auch sein),
die (Hilfs) Variable vStatus (0, 1) hab ich nur eingebaut, um (für mich) das Script einfacher gestalten zu können.
(aber im Prinzip könnte man auch hang auf vStatus verzichten und immer direkt den Wert vom DP prüfen).Hatte deine Version schon komplett eingetippt,
jetzt sehe ich aber das es ja so nicht funktionieren kann, denn du setzt ja den vStatus (0 oder 1) auf den Licht-Status, der Boolean verlangt.

@topsurfer sagte: Der Alias / DP ist vom Typ Bollean (muss er auch sein),
Dann ändere es so:

@topsurfer sagte in Autom. TV-Licht um Timeout erweitern:
auf vStatus verzichten und immer direkt den Wert vom DP prüfen
Bei dir wie bei mir dient die Variable dazu, nur dann zu senden, wenn geschaltet werden soll. Wenn ein Wert mehr als einmal verwendet wird, ist eine Variable die effektivste Lösung.
Meine Version ist auch Voraussetzung für die Verwendung nur eines Timeout. Die komplexe Funktion "steuere" sollte nur so oft verwendet werden, wie unbedingt nötig (Ressourcen).