Hallo!
Ich bin bezüglich der Statusabfrage, hier im Forum schon fündig geworden.
@Matten-Matten hat hier große Arbeit geleistet.
link
Gerne würde ich nun den Rückgabewert true und fals in eine variable schreiben.
Wenn in die variable "fals" geschrieben wird, dann soll folgender http Post gesendet werden.
"http://192.168.1.29/web/powerstate?newstate=5"
Leider scheitere ich aber daran überhaupt die Rückgabe in eine variable zu schreiben.
Bisheriger Aufbau:
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="y3dARA/_o@E|kxjn=A[n">state</variable>
<variable type="timeout" id="timeout">timeout</variable>
<variable id=";9CBz{(BK7Ex27NC:z%r">result</variable>
</variables>
<block type="on" id="2;+{kYg+D^#svH$hLz00" x="113" y="-337">
<field name="OID">hm-rpc.0.LEQ1345108.1.STATE</field>
<field name="CONDITION">any</field>
<field name="ACK_CONDITION"></field>
<statement name="STATEMENT">
<block type="controls_if" id=":*ENAV:f[9[D7aehYSyC">
<value name="IF0">
<block type="logic_compare" id="fj*Fi(Hd/tsuGMPzG~Gh">
<field name="OP">EQ</field>
<value name="A">
<block type="get_value" id="Za=1:SMcD}6zf)LMjFK-">
<field name="ATTR">val</field>
<field name="OID">hm-rpc.0.LEQ1345108.1.STATE</field>
</block>
</value>
<value name="B">
<block type="logic_boolean" id="uFe.tXqgHH+[V1Haqk8Q">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="request" id="uxf0BShS(t!v2mbkO45]">
<mutation xmlns="http://www.w3.org/1999/xhtml" with_statement="true"></mutation>
<field name="WITH_STATEMENT">TRUE</field>
<field name="LOG"></field>
<value name="URL">
<shadow type="text" id="e%[XlWK=k:#`6by40Ozi">
<field name="TEXT">http://192.168.1.29/web/powerstate</field>
</shadow>
</value>
<statement name="STATEMENT">
<block type="variables_set" id="2cL}9M=cvzRwWQ]9u%T0">
<field name="VAR" id="y3dARA/_o@E|kxjn=A[n">state</field>
<value name="VALUE">
<block type="convert_tostring" id="py1IL/=N]C-Q1=h0oZ?.">
<value name="VALUE">
<block type="text_getSubstring" id="hE{L1tLh[K*:MMiJ1Qc2">
<mutation at1="true" at2="true"></mutation>
<field name="WHERE1">FROM_START</field>
<field name="WHERE2">FROM_START</field>
<value name="STRING">
<block type="variables_get" id="dU$XzHsoVl_LAyOI2!9i">
<field name="VAR" id=";9CBz{(BK7Ex27NC:z%r">result</field>
</block>
</value>
<value name="AT1">
<block type="text_indexOf" id="dCY}+}+~4KNIMbHLwthq">
<field name="END">FIRST</field>
<value name="VALUE">
<block type="variables_get" id="Z=G-l$(9CchRC!]Z/JQB">
<field name="VAR" id=";9CBz{(BK7Ex27NC:z%r">result</field>
</block>
</value>
<value name="FIND">
<shadow type="text" id="/e*kLf5?Fj?mI*^Cs/%|">
<field name="TEXT"><e2instandby></field>
</shadow>
</value>
</block>
</value>
<value name="AT2">
<block type="text_indexOf" id="v^3[9u3j*q1XLl2/avuo">
<field name="END">FIRST</field>
<value name="VALUE">
<block type="variables_get" id="J):/+yU+yR?oP*rfkIrw">
<field name="VAR" id=";9CBz{(BK7Ex27NC:z%r">result</field>
</block>
</value>
<value name="FIND">
<shadow type="text" id="e_5rZ=mtCygJxdqK7z(G">
<field name="TEXT"></e2instandby></field>
</shadow>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
<next>
<block type="timeouts_settimeout" id="hSTpoP}Fc_J,w!Ej9La@">
<field name="NAME">timeout</field>
<field name="DELAY">1000</field>
<field name="UNIT">ms</field>
<statement name="STATEMENT">
<block type="debug" id="V/*DU;hnvcw7m=H8M%i_">
<field name="Severity">log</field>
<value name="TEXT">
<shadow type="text" id="#?=XLpp:xAH)V;nt4Znn">
<field name="TEXT">test</field>
</shadow>
<block type="convert_toboolean" id="qqe4L3}wb~5baO@vbZ{]">
<value name="VALUE">
<block type="text_trim" id="V:P]bH0UxB~o68dn-/)/">
<field name="MODE">BOTH</field>
<value name="TEXT">
<shadow xmlns="http://www.w3.org/1999/xhtml" type="text" id="4f0QKBDM7$~@]A|ImT(Q">
<field name="TEXT">abc</field>
</shadow>
<block type="text_getSubstring" id="aryL(bbn{bt/u4s}OMC=">
<mutation at1="true" at2="true"></mutation>
<field name="WHERE1">FROM_START</field>
<field name="WHERE2">FROM_END</field>
<value name="STRING">
<block type="variables_get" id="U=qtyS%EnO45GEQ=1/QV">
<field name="VAR" id="y3dARA/_o@E|kxjn=A[n">state</field>
</block>
</value>
<value name="AT1">
<block type="math_number" id="TUyTOuLW+|J7AlRYT4q|">
<field name="NUM">-7</field>
</block>
</value>
<value name="AT2">
<block type="math_number" id="K89g{7}+.gI|S~J#IJ-*">
<field name="NUM">2</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</statement>
</block>
</statement>
</block>
</statement>
</block>
</xml>