Skip to content

Instantly share code, notes, and snippets.

@der-pw
Created August 27, 2021 09:02
Show Gist options
  • Save der-pw/68320491071189e8e9c0bc1e07491350 to your computer and use it in GitHub Desktop.
Save der-pw/68320491071189e8e9c0bc1e07491350 to your computer and use it in GitHub Desktop.
Aqara Wasserdetektoren Zigbee Adapter IOBroker/Blockly
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="7a8W2[q^VaG[UvvHsKOH">id</variable>
<variable id="rO52IFbCnvA#=1(/F[re">Sensor_HB</variable>
<variable id="$1FN`#rI#Y1pS$=;btpt">Parent</variable>
<variable id="KLPNy`gV`Ui}3E~@n$yi">Parent_Name</variable>
<variable id="XWVm9Uh^jf2VaLD70A=h">Threshold</variable>
</variables>
<block type="procedures_defcustomreturn" id="{YMU)#$}hHnV=RldXR64" x="63" y="-662">
<mutation statements="false">
<arg name="id" varid="7a8W2[q^VaG[UvvHsKOH"></arg>
</mutation>
<field name="NAME">func_ObjectID</field>
<field name="SCRIPT">cmV0dXJuIGdldE9iamVjdChpZCk7</field>
<comment pinned="false" h="80" w="160">simple Funktion um die Object-ID zu erhalten um später den Parent-Name zu bilden.</comment>
</block>
<block type="comment" id="=Ho`=5}}gCYhM=7,KXP]" x="62" y="-612">
<field name="COMMENT">Meldung bei Wasserleck</field>
<next>
<block type="on_ext" id="c:}f%O.PAiZGkZ6F**])">
<mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
<field name="CONDITION">true</field>
<field name="ACK_CONDITION"></field>
<value name="OID0">
<shadow type="field_oid" id="}ob(X?i@P2#nRY1+}2XQ">
<field name="oid">zigbee.0.00158d00047bbf69.detected</field>
</shadow>
<block type="selector" id="tk*m0vmlI1i=$1lca{(O">
<field name="TEXT">state[id=*.detected](functions=wasserleck)</field>
</block>
</value>
<statement name="STATEMENT">
<block type="debug" id="c~D4Pr=7U=ltCJ=s?,H^">
<field name="Severity">warn</field>
<value name="TEXT">
<shadow type="text" id="tp=F$7Bw$!Hc^=@lKr~e">
<field name="TEXT">test</field>
</shadow>
<block type="text_join" id="VQYei@4BK9`n?GloaG=`">
<mutation items="3"></mutation>
<value name="ADD0">
<block type="text" id="0GjY5Oo^h)nN|g^244(g">
<field name="TEXT">Wasserleck detektiert an </field>
</block>
</value>
<value name="ADD1">
<block type="on_source" id="u[MzGf4w{nkNB?%PR3on">
<field name="ATTR">channelName</field>
</block>
</value>
<value name="ADD2">
<block type="text" id="$AX=Y;oEz:+~GLf`:Yu6">
<field name="TEXT">!</field>
</block>
</value>
</block>
</value>
</block>
</statement>
<next>
<block type="comment" id="+VG:a.wl_GL$[Ef,)/e[">
<field name="COMMENT">Check ob das Teil noch lebt</field>
<next>
<block type="schedule" id="Go6Sb[9M[rUZNF{r}ry5">
<field name="SCHEDULE">*/30 * * * *</field>
<statement name="STATEMENT">
<block type="controls_forEach" id="O/^0O|)l`^ir?PVk6jIl">
<field name="VAR" id="rO52IFbCnvA#=1(/F[re">Sensor_HB</field>
<value name="LIST">
<block type="selector" id="}JpH$D?mhUE4TXefqft@">
<field name="TEXT">state[id=*.link_quality](functions=wasserleck)</field>
</block>
</value>
<statement name="DO">
<block type="variables_set" id="^;5@$AvBV%|P}lTpah%F">
<field name="VAR" id="$1FN`#rI#Y1pS$=;btpt">Parent</field>
<value name="VALUE">
<block type="text_getSubstring" id="73pJp9Y0s%orgWnA0ahl">
<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="O#B.j`R^E)G,0sEz:I{|">
<field name="VAR" id="rO52IFbCnvA#=1(/F[re">Sensor_HB</field>
</block>
</value>
<value name="AT1">
<block type="math_number" id="T+C/CqRBr3Jum-u:yO;7">
<field name="NUM">1</field>
</block>
</value>
<value name="AT2">
<block type="math_arithmetic" id="(hFU-bMcIm$vdzF*BNKY">
<field name="OP">MINUS</field>
<value name="A">
<shadow type="math_number" id="_q%CwH[g(pY{:AT|WM(v">
<field name="NUM">1</field>
</shadow>
<block type="text_indexOf" id="QB9Xk$%CIibBwM/fZpX,">
<field name="END">LAST</field>
<value name="VALUE">
<block type="variables_get" id="Bpp,eZIb0/Vx4TDz?)}p">
<field name="VAR" id="rO52IFbCnvA#=1(/F[re">Sensor_HB</field>
</block>
</value>
<value name="FIND">
<shadow type="text" id="S;iCReSTAukI`+u:2nut">
<field name="TEXT">.</field>
</shadow>
</value>
</block>
</value>
<value name="B">
<shadow type="math_number" id="0QYedtN@#_#U6N45mMw~">
<field name="NUM">1</field>
</shadow>
</value>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" id="C%D?E,d4(pgKPW.m7xYr">
<field name="VAR" id="KLPNy`gV`Ui}3E~@n$yi">Parent_Name</field>
<value name="VALUE">
<block type="get_attr" id="WbVYnBZ2a3#T|cAHF=Dc">
<value name="PATH">
<shadow type="text" id="z{i!iqOKGWqYyZ@^rgYc">
<field name="TEXT">common.name</field>
</shadow>
</value>
<value name="OBJECT">
<block type="procedures_callcustomreturn" id="NWi)dCTg;lR3G$t?k5]B">
<mutation name="func_ObjectID">
<arg name="id"></arg>
</mutation>
<value name="ARG0">
<block type="variables_get" id=";t)-9=Hf,iytKc%V7R.M">
<field name="VAR" id="$1FN`#rI#Y1pS$=;btpt">Parent</field>
</block>
</value>
</block>
</value>
</block>
</value>
<next>
<block type="comment" id="2AChi)kQK^YMpX9%%3%(">
<field name="COMMENT">Schwellenwert für Meldung in Minuten angeben (Aqara &gt; 50 Minuten)</field>
<next>
<block type="variables_set" id="cY6GIDIBQ{QPUQwEkn+{">
<field name="VAR" id="XWVm9Uh^jf2VaLD70A=h">Threshold</field>
<value name="VALUE">
<block type="math_number" id="f1dq`dRvsWK-BS7:ndgA">
<field name="NUM">70</field>
</block>
</value>
<next>
<block type="comment" id="y/BUoCf.!8dgU,?veW@6">
<field name="COMMENT">Wenn Zeitstempel von "link_quality" älter als Schwellenwert (60000 weil ms)</field>
<next>
<block type="controls_if" id="~Ip%#.UZnETyU$!h64Iw">
<value name="IF0">
<block type="logic_compare" id="u7lX9uM=;)^n!4@5cF:[">
<field name="OP">LT</field>
<value name="A">
<block type="math_arithmetic" id="CDo([^hvcL2LQ~QZa@GK">
<field name="OP">MULTIPLY</field>
<value name="A">
<shadow type="math_number" id="hjo.=]pPlx%(Tj26NKQ5">
<field name="NUM">70</field>
</shadow>
<block type="variables_get" id="2s3ZXzr`bPAWj7JX+jr/">
<field name="VAR" id="XWVm9Uh^jf2VaLD70A=h">Threshold</field>
</block>
</value>
<value name="B">
<shadow type="math_number" id="%%!7eTL]4n61-6QyFh!$">
<field name="NUM">60000</field>
</shadow>
</value>
</block>
</value>
<value name="B">
<block type="math_arithmetic" id="!-qOBx|;=LZHMQ5E(^Of">
<field name="OP">MINUS</field>
<value name="A">
<shadow type="math_number" id="lEUdT^:KMZhelaTyYWV5">
<field name="NUM">1</field>
</shadow>
<block type="time_get" id="*vO(ZQ1nd+:0CRkY4W[J">
<mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
<field name="OPTION">object</field>
</block>
</value>
<value name="B">
<shadow type="math_number" id="hywmL/)1q?:9)oy+i!]M">
<field name="NUM">1</field>
</shadow>
<block type="get_value_var" id=")1zuK=p2#P+Z3c)}fU/H">
<field name="ATTR">ts</field>
<value name="OID">
<shadow type="text" id="0K*WD~IaWCFn$5sH=YRj">
<field name="TEXT"></field>
</shadow>
<block type="variables_get" id="{JlR4:-n/CLKl14AbN*-">
<field name="VAR" id="rO52IFbCnvA#=1(/F[re">Sensor_HB</field>
</block>
</value>
</block>
</value>
</block>
</value>
</block>
</value>
<statement name="DO0">
<block type="debug" id="[Ibq+j[2K+x?bL!Ij+%G">
<field name="Severity">warn</field>
<value name="TEXT">
<shadow type="text" id="NVu.#tD=~5T-)c8Wuj^8">
<field name="TEXT">test</field>
</shadow>
<block type="text_join" id="XBX3yZjd(_HqoJ#i2AR_">
<mutation items="4"></mutation>
<value name="ADD0">
<block type="variables_get" id="@-{upK/SPLKawnM|*w3:">
<field name="VAR" id="KLPNy`gV`Ui}3E~@n$yi">Parent_Name</field>
</block>
</value>
<value name="ADD1">
<block type="text" id="hCY?=;@*[wkVa~`@k+d]">
<field name="TEXT"> ist seit mehr als </field>
</block>
</value>
<value name="ADD2">
<block type="variables_get" id="7Qjw{tf~Z08{ViW)75~%">
<field name="VAR" id="XWVm9Uh^jf2VaLD70A=h">Threshold</field>
</block>
</value>
<value name="ADD3">
<block type="text" id="Unk0AqeJ?[pUG|X:Mj,k">
<field name="TEXT"> Minuten nicht mehr aktiv gewesen!</field>
</block>
</value>
</block>
</value>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</xml>
@der-pw
Copy link
Author

der-pw commented Aug 27, 2021

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment