Code here
configuration: {}
triggers:
- id: "6"
configuration:
groupName: RollosG
type: core.GroupCommandTrigger
- id: "7"http://rapi:8080/settings/rules/Warema_convert#
configuration:
groupName: RollosG
type: core.GroupStateChangeTrigger
conditions: []
actions:
- inputs: {}
id: "4"
label: blockly
configuration:
blockSource: <xml
xmlns="https://developers.google.com/blockly/xml"><variables><variable
id="1GuWq(r%xpn4^V258(%1">item</variable><variable
id="S5_{Nrcw-SQ.8;O1n]nj">item_p</variable><variable
id="nmJ!b=JOZ]*|7QJthfkl">item_s</variable><variable
id="vG=$oN^2P62#SZ/4N6K{">command</variable></variables><block
type="variables_set" id="T%?j#n9o/Osf]=|]iT,(" x="116" y="437"><field
name="VAR" id="1GuWq(r%xpn4^V258(%1">item</field><value
name="VALUE"><block type="oh_context_info"
id="p(zCIkc98$wfZR?yiB5R"><mutation asType="null"
contextInfo="itemName"></mutation><field
name="contextInfo">itemName</field></block></value><next><block
type="variables_set" id="^1GO!g=eE5F(rS6`?_Xa"><field name="VAR"
id="S5_{Nrcw-SQ.8;O1n]nj">item_p</field><value name="VALUE"><block
type="oh_getitem" id="G(`=!ctF58M;Hqb-,QvQ"><value
name="itemName"><shadow type="oh_item"
id="[HoMd5ushb{O*$LxRISX"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="text_join"
id="b!,h%OcoVC,9i:I{[e/v" inline="true"><mutation
items="2"></mutation><value name="ADD0"><block type="variables_get"
id="nRvq{z.t6/Lpj)Q$B5(q"><field name="VAR"
id="1GuWq(r%xpn4^V258(%1">item</field></block></value><value
name="ADD1"><block type="text" id="vMcQQ-O3M~X3~q0s`+QB"><field
name="TEXT">p</field></block></value></block></value></block></value><next><block
type="variables_set" id="U?FSGK*0Z$j*WKCn`N]c"><field name="VAR"
id="nmJ!b=JOZ]*|7QJthfkl">item_s</field><value name="VALUE"><block
type="oh_getitem" id="G~:BD==q{[siR8:YF?0+"><value
name="itemName"><shadow type="oh_item"
id="[HoMd5ushb{O*$LxRISX"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="text_join"
id="VX|_^Kw%fj84SF[|H^W;" inline="true"><mutation
items="2"></mutation><value name="ADD0"><block type="variables_get"
id="3{HRj4$)n;V4@|sPHtDC"><field name="VAR"
id="1GuWq(r%xpn4^V258(%1">item</field></block></value><value
name="ADD1"><block type="text" id=";L%$Y`J3C:s*W)opd1XL"><field
name="TEXT">stop</field></block></value></block></value></block></value><next><block
type="controls_if" id="Hdh-s2l1j{csau+/If46"><mutation
elseif="1"></mutation><value name="IF0"><block type="logic_compare"
id="?5OH{lhj^Vzxk3+YU8.B"><field name="OP">EQ</field><value
name="A"><block type="oh_context_info"
id="`3jNhx6;:L{@jP^hnWOB"><mutation asType="null"
contextInfo="type"></mutation><field
name="contextInfo">type</field></block></value><value name="B"><block
type="text" id="ekilBJ4MQ6H$y|MLrJ5|"><field
name="TEXT">ItemCommandEvent</field></block></value></block></value><statement
name="DO0"><block type="variables_set" id="%%{KyVKIj}Dym8FplNf)"><field
name="VAR" id="vG=$oN^2P62#SZ/4N6K{">command</field><value
name="VALUE"><block type="oh_context_info"
id="b.B]ywaYlYQuuxfcDt3N"><mutation asType="asString"
contextInfo="itemCommand"></mutation><field
name="contextInfo">itemCommand</field><field
name="asType">asString</field></block></value><next><block
type="controls_if" id="L?6?WjiIx$up78_3Vp34"><value name="IF0"><block
type="logic_operation" id="w3[n}Z}_$wNE,|;L}e0-"><field
name="OP">AND</field><value name="A"><block type="logic_compare"
id="O%5o#l[C-CX~G3RweW,J"><field name="OP">LT</field><value
name="A"><block type="math_number" id="u.;aOQcE|J{*_W*Cqr+("><field
name="NUM">0</field></block></value><value name="B"><block
type="variables_get" id="$M?W`F5;essgZpKnB]xN"><field name="VAR"
id="vG=$oN^2P62#SZ/4N6K{">command</field></block></value></block></value><value
name="B"><block type="logic_compare" id="gs`Z=Jhk_K+9U)66S.=#"><field
name="OP">LT</field><value name="A"><block type="variables_get"
id="obVBf*.UBN8g=O5pdDzB"><field name="VAR"
id="vG=$oN^2P62#SZ/4N6K{">command</field></block></value><value
name="B"><block type="math_number" id="f|QN_@2z@zQg(}NLcJ{a"><field
name="NUM">100</field></block></value></block></value></block></value><statement
name="DO0"><block type="oh_store_meta_value"
id="c,;]s`dW:wD,a%bSTbRB"><value name="value"><shadow type="text"
id="r7}n8DK3oMAR5W`c;2C4"><field name="TEXT"></field></shadow><block
type="variables_get" id="!x{k3uPh3bn|-/*HC6QO"><field name="VAR"
id="vG=$oN^2P62#SZ/4N6K{">command</field></block></value><value
name="namespace"><shadow type="text" id="DzUG7WAtc,#:]44ceDr1"><field
name="TEXT"></field></shadow><block type="text"
id="a^7Em-eI/e$|7=Y]Q?{p"><field
name="TEXT">shs</field></block></value><value name="theItem"><shadow
type="oh_item" id="#l_jXCTOp;$DiP!}V(#K"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="oNK5n5xaQ~Jt#HU@2fA|"><field name="VAR"
id="1GuWq(r%xpn4^V258(%1">item</field></block></value><next><block
type="controls_if" id="=!emT:SskaJA0LMIEViv"><mutation
elseif="1"></mutation><value name="IF0"><block type="logic_compare"
id=")`]JeU%%NRKKV@_sj-B6"><field name="OP">LT</field><value
name="A"><block type="variables_get" id="A^7}w`k*HA6eypO@[9,P"><field
name="VAR"
id="vG=$oN^2P62#SZ/4N6K{">command</field></block></value><value
name="B"><block type="oh_toNumber" id="+O_i6PkeeURj@=2hw$~/"><value
name="valueAsText"><shadow type="text" id="wd{bx3~RUOhe_rZ6@;u|"><field
name="TEXT">123</field></shadow><block type="oh_getitem_state"
id="5xCSl8V5ezb@s4wh}KBN"><value name="itemName"><shadow type="oh_item"
id=",[U-f$GQSRm#`4fu!:hI"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="}I#ItrvFvK~uKq+4-?[6"><field name="VAR"
id="1GuWq(r%xpn4^V258(%1">item</field></block></value></block></value></block></value></block></value><statement
name="DO0"><block type="oh_event" id="@td:$dbBC9,1Y-0BZT]|"><field
name="eventType">sendCommand</field><value name="value"><shadow
type="text" id="I3T1?#Frv{i7hDNy^=Sp"><field
name="TEXT">ON</field></shadow><block type="text"
id="I~/)|UluC5#4),$NOB#D"><field
name="TEXT">ON</field></block></value><value name="itemName"><shadow
type="oh_item" id="7B61cRm1eUvmNg[a0Km."><mutation itemName="Warema1"
itemLabel="Warema1"></mutation><field
name="itemName">Warema1</field></shadow><block type="variables_get"
id="gs/{p4x,7^5*~TeDrOee"><field name="VAR"
id="S5_{Nrcw-SQ.8;O1n]nj">item_p</field></block></value></block></statement><value
name="IF1"><block type="logic_compare" id=":lQP,0d=^$(;Rhm,fBf-"><field
name="OP">GT</field><value name="A"><block type="variables_get"
id="YYUJRKv(/9wVw@yJ#WMX"><field name="VAR"
id="vG=$oN^2P62#SZ/4N6K{">command</field></block></value><value
name="B"><block type="oh_toNumber" id="](IZ~{n@:.|g8RNl;`KF"><value
name="valueAsText"><shadow type="text" id="wd{bx3~RUOhe_rZ6@;u|"><field
name="TEXT">123</field></shadow><block type="oh_getitem_state"
id="jWjDm*yveeCKHGIg%YMd"><value name="itemName"><shadow type="oh_item"
id=",[U-f$GQSRm#`4fu!:hI"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="``qNmD;2(xT]j?BUCf(o"><field name="VAR"
id="1GuWq(r%xpn4^V258(%1">item</field></block></value></block></value></block></value></block></value><statement
name="DO1"><block type="oh_event" id="j:nNu^gKd^o/Mxn}n80$"><field
name="eventType">sendCommand</field><value name="value"><shadow
type="text" id="f_9:~+~niDeBM_X)3%}o"><field
name="TEXT">OFF</field></shadow><block type="text"
id="YLhb;C:u,mGD{oIr{4w["><field
name="TEXT">OFF</field></block></value><value name="itemName"><shadow
type="oh_item" id=".#cz*QgZt0iD-,h7|b_a"><mutation itemName="Warema1"
itemLabel="Warema1"></mutation><field
name="itemName">Warema1</field></shadow><block type="variables_get"
id="Eo[vFF2xf6d0BP0fJN.="><field name="VAR"
id="S5_{Nrcw-SQ.8;O1n]nj">item_p</field></block></value></block></statement></block></next></block></statement><next><block
type="controls_if" id="IU5{QcAa;LERgqn72S,x"><mutation
elseif="2"></mutation><value name="IF0"><block type="logic_operation"
id="%[#;$-_g7vwQOvh{9kj6"><field name="OP">OR</field><value
name="A"><block type="logic_compare" id="082$yw.WjA-NW;CJ@}F}"><field
name="OP">EQ</field><value name="A"><block type="text"
id="6KMbuK{nM+(BZd%7:au*"><field
name="TEXT">UP</field></block></value><value name="B"><block
type="variables_get" id="?oFQ]+1:6[BTq.3]ZAk{"><field name="VAR"
id="vG=$oN^2P62#SZ/4N6K{">command</field></block></value></block></value><value
name="B"><block type="logic_compare" id="yT=`~{DYUK5t`IX+xPR}"><field
name="OP">EQ</field><value name="A"><block type="math_number"
id="2!7Y=ymZ9{(dc)Et)?rO"><field
name="NUM">0</field></block></value><value name="B"><block
type="variables_get" id="du.VBlq[SH,KDh=tBG|B"><field name="VAR"
id="vG=$oN^2P62#SZ/4N6K{">command</field></block></value></block></value></block></value><statement
name="DO0"><block type="oh_store_meta_value"
id="#cv*:rOJZi-Jp@$.JOuN"><value name="value"><shadow type="text"
id="S!Uy7l]S1%n1zSh5=}GO"><field name="TEXT"></field></shadow><block
type="text" id="T!-YEtGFP:%Twtjcs7Ql"><field
name="TEXT"></field></block></value><value name="namespace"><shadow
type="text" id="_a:Td)@abbrhYz|v{WsX"><field
name="TEXT"></field></shadow><block type="text"
id=":;%]Tc8yS`@NPLo#@71:"><field
name="TEXT">shs</field></block></value><value name="theItem"><shadow
type="oh_item" id="#l_jXCTOp;$DiP!}V(#K"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="x/8z`0}~+2VtW]zhyr=B"><field name="VAR"
id="1GuWq(r%xpn4^V258(%1">item</field></block></value><next><block
type="oh_event" id="f6pKNnuY.DFQml%k2.It"><field
name="eventType">sendCommand</field><value name="value"><shadow
type="text" id="OQgNPg{JCEp.P`z,pfx9"><field
name="TEXT">ON</field></shadow><block type="text"
id="%_^w`ZU}he-R_Cb3[}^G"><field
name="TEXT">ON</field></block></value><value name="itemName"><shadow
type="oh_item" id="!mtdyY*OgX=|Z*IE]Rip"><mutation itemName="Warema1"
itemLabel="Warema1"></mutation><field
name="itemName">Warema1</field></shadow><block type="variables_get"
id="`~Fcu6svJN?e_7.lhm$s"><field name="VAR"
id="S5_{Nrcw-SQ.8;O1n]nj">item_p</field></block></value></block></next></block></statement><value
name="IF1"><block type="logic_operation"
id="n/A20{ts`]N{TDuQ;fOA"><field name="OP">OR</field><value
name="A"><block type="logic_compare" id="~ak]y4DtxP**m]SPPze|"><field
name="OP">EQ</field><value name="A"><block type="text"
id="4y!LXz3KPq2-hSv4nl(U"><field
name="TEXT">DOWN</field></block></value><value name="B"><block
type="variables_get" id="][knS%JpLlhvD{,2/8#D"><field name="VAR"
id="vG=$oN^2P62#SZ/4N6K{">command</field></block></value></block></value><value
name="B"><block type="logic_compare" id="KI!maSy4iepqsM8hLwtT"><field
name="OP">EQ</field><value name="A"><block type="math_number"
id="?g{jwtV*FB8z/H_/GeI*"><field
name="NUM">100</field></block></value><value name="B"><block
type="variables_get" id="d?_{tgMlb)RWy)p=;LIj"><field name="VAR"
id="vG=$oN^2P62#SZ/4N6K{">command</field></block></value></block></value></block></value><statement
name="DO1"><block type="oh_store_meta_value"
id="d@~0v~}{CYO`Q03Ue`xn"><value name="value"><shadow type="text"
id="[uOdmFQ!hcSXz^KT}2oV"><field name="TEXT"></field></shadow><block
type="text" id="lhPnldz,P+ux_LoZ!Xpp"><field
name="TEXT"></field></block></value><value name="namespace"><shadow
type="text" id="_a:Td)@abbrhYz|v{WsX"><field
name="TEXT"></field></shadow><block type="text"
id="ZL6F?!Pi9uO=M0yw{`Q!"><field
name="TEXT">shs</field></block></value><value name="theItem"><shadow
type="oh_item" id="#l_jXCTOp;$DiP!}V(#K"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="@k$xsO/zv8EQ!D(tTS|V"><field name="VAR"
id="1GuWq(r%xpn4^V258(%1">item</field></block></value><next><block
type="oh_event" id="jnjC3Y`{TUN-9E#G_|ki"><field
name="eventType">sendCommand</field><value name="value"><shadow
type="text" id="Ln]e6r[oj$|T2_G)7?p+"><field
name="TEXT">OFF</field></shadow><block type="text"
id="}vM!dHX+Oi88AHT2@PpA"><field
name="TEXT">OFF</field></block></value><value name="itemName"><shadow
type="oh_item" id="ZH9-qus74dZ0`4DHBxoY"><mutation itemName="Warema1"
itemLabel="Warema1"></mutation><field
name="itemName">Warema1</field></shadow><block type="variables_get"
id="W86;j.:OU.TrYZNwTiK}"><field name="VAR"
id="S5_{Nrcw-SQ.8;O1n]nj">item_p</field></block></value></block></next></block></statement><value
name="IF2"><block type="logic_compare" id=",kVq0nWo9hrgpZ3QzlIN"><field
name="OP">EQ</field><value name="A"><block type="text"
id="~-JMH^/i1CY{lhU1CW.U"><field
name="TEXT">STOP</field></block></value><value name="B"><block
type="variables_get" id="+_%,:,%c2q3f7stgwVOP"><field name="VAR"
id="vG=$oN^2P62#SZ/4N6K{">command</field></block></value></block></value><statement
name="DO2"><block type="oh_store_meta_value"
id="PBLfU)_qqU)J%aP:_]xR"><value name="value"><shadow type="text"
id="N${x,jRi8d/ztH)Xs{7O"><field name="TEXT"></field></shadow><block
type="text" id="]U`J14r_]/,nmHk2:+Ql"><field
name="TEXT"></field></block></value><value name="namespace"><shadow
type="text" id="_a:Td)@abbrhYz|v{WsX"><field
name="TEXT"></field></shadow><block type="text"
id="vWJ$fqIoU5RB^lte+69~"><field
name="TEXT">shs</field></block></value><value name="theItem"><shadow
type="oh_item" id="#l_jXCTOp;$DiP!}V(#K"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="|+9#XECq,5=OhL=ds)#O"><field name="VAR"
id="1GuWq(r%xpn4^V258(%1">item</field></block></value><next><block
type="oh_event" id="m@`~Q8u-,P%,p^J8Elm8"><field
name="eventType">sendCommand</field><value name="value"><shadow
type="text" id=";5p?!dnJX.ku,,ny}daA"><field
name="TEXT">ON</field></shadow><block type="text"
id="xLZ1y(.jbV7g0X4Ijw;c"><field
name="TEXT">ON</field></block></value><value name="itemName"><shadow
type="oh_item" id="$PEaY6xUwb5-}=3ggGai"><mutation
itemName="Warema1stop" itemLabel="Warema1stop"></mutation><field
name="itemName">Warema1stop</field></shadow><block type="variables_get"
id="KlptMEJ4_@2VP-.|-P(]"><field name="VAR"
id="nmJ!b=JOZ]*|7QJthfkl">item_s</field></block></value></block></next></block></statement></block></next></block></next></block></statement><value
name="IF1"><block type="logic_compare" id="*%OAu-E%55;D_UU`ntme"><field
name="OP">EQ</field><value name="A"><block type="text"
id="L`13PW!B-Vsyj{62.}[]"><field
name="TEXT">ItemStateChangedEvent</field></block></value><value
name="B"><block type="oh_context_info"
id=":W?BqNWg{T;`BA/.:})D"><mutation asType="null"
contextInfo="type"></mutation><field
name="contextInfo">type</field></block></value></block></value><statement
name="DO1"><block type="controls_if" id="Hhz(k%r0f{+/K5e{Kmb!"><value
name="IF0"><block type="logic_compare" id="I).cO9TqE[63i[yda@)E"
inline="false"><field name="OP">EQ</field><value name="A"><block
type="oh_getitem_state" id="pSRr^b!JX_asa/Vp2#xE"><value
name="itemName"><shadow type="oh_item"
id="Q.;Z1aoBpoi=JLfTNHB["><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="A.nG,[$hgf~q1Ae;Bap3"><field name="VAR"
id="1GuWq(r%xpn4^V258(%1">item</field></block></value></block></value><value
name="B"><block type="oh_get_meta_value"
id="!@;^rpB6*pU)`:OJ-%w4"><value name="theItem"><shadow type="oh_item"
id=":-~Pq(I.V85[H@`UqC@$"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="yECw^8/lZdyXRt.4~Td+"><field name="VAR"
id="1GuWq(r%xpn4^V258(%1">item</field></block></value><value
name="namespace"><shadow type="text" id="gk?`;J-=11ajY]BIv,#@"><field
name="TEXT"></field></shadow><block type="text"
id="/$8isXo79)?i{gUm$RJE"><field
name="TEXT">shs</field></block></value></block></value></block></value><statement
name="DO0"><block type="oh_event" id="=IA0a`D7S1BJnEmL/m:B"><field
name="eventType">sendCommand</field><value name="value"><shadow
type="text" id="jiEqt?{`|bzV^l[39w^@"><field
name="TEXT">value</field></shadow><block type="text"
id="U)iOv{im0?[z`P-JlEQ."><field
name="TEXT">ON</field></block></value><value name="itemName"><shadow
type="oh_item" id="[=%Rbu0zDx2rje-NKe-}"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id=",~`kf`j?~!*,~;BL1MxS"><field name="VAR"
id="nmJ!b=JOZ]*|7QJthfkl">item_s</field></block></value><next><block
type="oh_store_meta_value" id="`URr]Y3|wukp@Jmp.`_5"><value
name="value"><shadow type="text" id="eQ3kcB,rLJ]q#90Uq2C@"><field
name="TEXT"></field></shadow><block type="text"
id="2u_/*m)nx3+K/1jU[y#="><field
name="TEXT"></field></block></value><value name="namespace"><shadow
type="text" id="_a:Td)@abbrhYz|v{WsX"><field
name="TEXT"></field></shadow><block type="text"
id="(l6mmd.,Exxz{-sJIljA"><field
name="TEXT">shs</field></block></value><value name="theItem"><shadow
type="oh_item" id="#l_jXCTOp;$DiP!}V(#K"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="#W^bY$87*oS~:L9K7k#f"><field name="VAR"
id="1GuWq(r%xpn4^V258(%1">item</field></block></value></block></next></block></statement></block></statement></block></next></block></next></block></next></block></xml>
type: application/javascript
script: >
var item, item_p, item_s, command;
var itemMetadata;
item = event.itemName;
item_p = items.getItem((String(item) + 'p'));
item_s = items.getItem((String(item) + 'stop'));
if (event.type == 'ItemCommandEvent') {
command = event.itemCommand.toString();
if (0 < command && command < 100) {
itemMetadata = items.metadata.getMetadata(item, 'shs');
itemMetadata = (itemMetadata === null) ? { value: '', configuration: {} } : itemMetadata;
itemMetadata.value = command;
items.metadata.replaceMetadata(item, 'shs', itemMetadata.value, itemMetadata.configuration);
if (command < parseFloat(items.getItem(item).state)) {
item_p.sendCommand('ON');
} else if (command > parseFloat(items.getItem(item).state)) {
item_p.sendCommand('OFF');
}
}
if ('UP' == command || 0 == command) {
itemMetadata = items.metadata.getMetadata(item, 'shs');
itemMetadata = (itemMetadata === null) ? { value: '', configuration: {} } : itemMetadata;
itemMetadata.value = '';
items.metadata.replaceMetadata(item, 'shs', itemMetadata.value, itemMetadata.configuration);
item_p.sendCommand('ON');
} else if ('DOWN' == command || 100 == command) {
itemMetadata = items.metadata.getMetadata(item, 'shs');
itemMetadata = (itemMetadata === null) ? { value: '', configuration: {} } : itemMetadata;
itemMetadata.value = '';
items.metadata.replaceMetadata(item, 'shs', itemMetadata.value, itemMetadata.configuration);
item_p.sendCommand('OFF');
} else if ('STOP' == command) {
itemMetadata = items.metadata.getMetadata(item, 'shs');
itemMetadata = (itemMetadata === null) ? { value: '', configuration: {} } : itemMetadata;
itemMetadata.value = '';
items.metadata.replaceMetadata(item, 'shs', itemMetadata.value, itemMetadata.configuration);
item_s.sendCommand('ON');
}
} else if ('ItemStateChangedEvent' == event.type) {
if (items.getItem(item).state == ((items.metadata.getMetadata(item, 'shs') !== null) ? (items.metadata.getMetadata(item, 'shs').value) : 'undefined')) {
item_s.sendCommand('ON');
itemMetadata = items.metadata.getMetadata(item, 'shs');
itemMetadata = (itemMetadata === null) ? { value: '', configuration: {} } : itemMetadata;
itemMetadata.value = '';
items.metadata.replaceMetadata(item, 'shs', itemMetadata.value, itemMetadata.configuration);
}
}
type: script.ScriptAction