Version 0.2 
metadata:
value: A
config:
systemCode: "01111"
Pulse: "346"
hexCodeOn: "0x154551"
Bits: "24"
hexCodeOff: "0x154554"
Protocol: "1"
A simple preparation Rule without Trigger (by Hand)
configuration: {}
triggers:
- id: "1"
configuration:
groupName: RadioFrequenz
type: core.GroupStateChangeTrigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
blockSource: <xml
xmlns="https://developers.google.com/blockly/xml"><variables><variable
id="mQ9Ux!i@pkT9NPIuZq*f">namespace</variable><variable
id="8JhW.q,5Mn@8+sh8dIU%">i</variable><variable
id="eV+@`%DHz3ugkEY4E7I!">button</variable><variable
id="WD/QNl;1`t;pD;6m4R)b">systemCode</variable><variable
id="hUrc_QuCyWY.B^m;#x~x">pushButton</variable><variable
id="+oRRIaGJ$Ealv?.B:,kA">reducedCode</variable><variable
id="a_U?bR||v=`,lCs`2JPz">fullCode</variable><variable
id="))@ztf%OrWk^)xc5e;Y|">j</variable><variable
id="qutA=6nbjL[I7cYv=)(5">hexCodeOn</variable><variable
id="6)e}PhgqcpKDkfLq05pH">hexCodeOff</variable><variable
id="!D/Pt,-?hd]S-J[Xab6q">hexValue</variable></variables><block
type="variables_set" id="jJ.7=Zxd7c7ZpZhRV:6B" x="-571" y="-410"><field
name="VAR" id="mQ9Ux!i@pkT9NPIuZq*f">namespace</field><value
name="VALUE"><block type="text" id=",a}:i}WTXU{BS^.1g,l*"><field
name="TEXT">rfsend</field></block></value><next><block
type="controls_forEach" id=",E+pLGl4*-/xh,wlZ+:N"><field name="VAR"
id="8JhW.q,5Mn@8+sh8dIU%">i</field><value name="LIST"><block
type="oh_groupmembers" id="ny?AMyE-{8SQ%qGr4y@S"><value
name="groupName"><shadow type="oh_item"
id="MjGru-L]O4Iu=z+}:/qj"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="oh_item"
id="Sp4vTLwbRkK3$SMPH@@y"><mutation itemName="RadioFrequenz"
itemLabel="433,99 Mhz Steckdosen"></mutation><field
name="itemName">RadioFrequenz</field></block></value></block></value><statement
name="DO"><block type="variables_set" id="xz*9`nOJGPK;l~Y=G!qt"><field
name="VAR" id="eV+@`%DHz3ugkEY4E7I!">button</field><value
name="VALUE"><block type="oh_get_meta_value"
id=":oWn5_:CaqTVKCNV#d4U"><value name="theItem"><shadow type="oh_item"
id="K9r]|rbTm2iWD$@m~eS2"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="lT1M;x5Z:h1hXZ0Ew2+T"><field name="VAR"
id="8JhW.q,5Mn@8+sh8dIU%">i</field></block></value><value
name="namespace"><shadow type="text" id="LVf2TH-69)cXc{ZLgut."><field
name="TEXT"></field></shadow><block type="variables_get"
id="`hM48JLSc:QJ~.rV39@o"><field name="VAR"
id="mQ9Ux!i@pkT9NPIuZq*f">namespace</field></block></value></block></value><next><block
type="variables_set" id="H-}HhYHDOMe053Xw!*Jt"><field name="VAR"
id="WD/QNl;1`t;pD;6m4R)b">systemCode</field><value name="VALUE"><block
type="oh_get_meta_config" id="f^ZxLIk77p2uAACsz3U0"><value
name="configKey"><shadow type="text" id="(#`+r?)p+Y?,1d57)#sx"><field
name="TEXT"></field></shadow><block type="text"
id="D`VzXxFAQ`;{]){KsN$e"><field
name="TEXT">systemCode</field></block></value><value
name="theItem"><shadow type="oh_item"
id="LQI%9RQm.2dhs-~7@$fT"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="g?Rzhpg{EtW9i[vA%+!5"><field name="VAR"
id="8JhW.q,5Mn@8+sh8dIU%">i</field></block></value><value
name="namespace"><shadow type="text" id="XI}%l6jFj.k5{;,98$if"><field
name="TEXT"></field></shadow><block type="variables_get"
id="bX*ct-4t{Q3xW-0eW5K5"><field name="VAR"
id="mQ9Ux!i@pkT9NPIuZq*f">namespace</field></block></value></block></value><next><block
type="text_append" id="6+gIWDBm}05EqY(hv*7]"><field name="VAR"
id="WD/QNl;1`t;pD;6m4R)b">systemCode</field><value name="TEXT"><shadow
type="text" id=";5kM}Tg}=Okky!j}3SC."><field
name="TEXT"></field></shadow><block type="text"
id="E=D]|,+Z`tp9DIqN!t@`"><field
name="TEXT">0</field></block></value><next><block type="controls_if"
id="khOk?Aq=E9gY$ztR0cKr"><value name="IF0"><block type="logic_negate"
id="QW|ri2!g-jC!pHh5b_c5"><value name="BOOL"><block type="text_isEmpty"
id="=R3#Lh4j:;h!%8G%er#Y"><value name="VALUE"><shadow type="text"
id="}[T|E=+w~h@y*k87;B^^"><field name="TEXT"></field></shadow><block
type="variables_get" id="`eHsP_76DUq~#uXV1W[4"><field name="VAR"
id="eV+@`%DHz3ugkEY4E7I!">button</field></block></value></block></value></block></value><statement
name="DO0"><block type="oh_log" id="so)!=.+}u5U}`tEJfkgF"><field
name="severity">warn</field><value name="message"><shadow type="text"
id="FGglb5l:h87:DhYA=]sv"><field name="TEXT">abc</field></shadow><block
type="variables_get" id="9ydlhRM[h?MfCo(JbiV7"><field name="VAR"
id="eV+@`%DHz3ugkEY4E7I!">button</field></block></value><next><block
type="variables_set" id=",:a$}/|S[c}i.+j!}5fT"><field name="VAR"
id="hUrc_QuCyWY.B^m;#x~x">pushButton</field><value name="VALUE"><block
type="dicts_create_with" id="HF|M}5#C~2_tmHg)^-0]"><mutation
items="5"></mutation><field name="KEY0">A</field><field
name="KEY1">B</field><field name="KEY2">C</field><field
name="KEY3">D</field><field name="KEY4">E</field><value
name="ADD0"><block type="text" id="XBL9R.GAik+lt7/wJu{b"><field
name="TEXT">1111</field></block></value><value name="ADD1"><block
type="text" id="x?KD!m2zrHusAY%DVz1a"><field
name="TEXT">0111</field></block></value><value name="ADD2"><block
type="text" id="pg|nEy_(e=%-.EkI[e$("><field
name="TEXT">1011</field></block></value><value name="ADD3"><block
type="text" id=",c4F_nw^m~e(pMQ}odMI"><field
name="TEXT">1101</field></block></value><value name="ADD4"><block
type="text" id="kURMDsA7aY$+i{zD?Z(I"><field
name="TEXT">1110</field></block></value></block></value><next><block
type="variables_set" id="*`ZvhW%K{Y|oj{t6.:cw"><field name="VAR"
id="+oRRIaGJ$Ealv?.B:,kA">reducedCode</field><value name="VALUE"><block
type="text_join" id="I}]f|/I|5$xtvdb.V?0X"><mutation
items="2"></mutation><value name="ADD0"><block type="variables_get"
id="]BIsr3NsuaGwwa)*8.rC"><field name="VAR"
id="WD/QNl;1`t;pD;6m4R)b">systemCode</field></block></value><value
name="ADD1"><block type="dicts_get" id="4EnJ9H5Cit{7]vr/F_xr"><value
name="key"><shadow type="text" id="}m3g#/|iFdDZtZ;$Zvn!"><field
name="TEXT">key</field></shadow><block type="variables_get"
id="_q]:b!+Fk:OApXyAaM2v"><field name="VAR"
id="eV+@`%DHz3ugkEY4E7I!">button</field></block></value><value
name="varName"><block type="variables_get"
id="g%|u_}*4sH9unF,;Sz^P"><field name="VAR"
id="hUrc_QuCyWY.B^m;#x~x">pushButton</field></block></value></block></value></block></value><next><block
type="variables_set" id="lOPJaUvmByb*hQLG/|vp"><field name="VAR"
id="a_U?bR||v=`,lCs`2JPz">fullCode</field><value name="VALUE"><block
type="text" id="X!h5$TXBIK/[^|AKi3Ln"><field
name="TEXT"></field></block></value><next><block type="controls_forEach"
id="9JoBcsp^#?}Y6o-kT+!G"><field name="VAR"
id="))@ztf%OrWk^)xc5e;Y|">j</field><value name="LIST"><block
type="lists_split" id="J)J1g:u$-B(r}H@MUJl]"><mutation
mode="SPLIT"></mutation><field name="MODE">SPLIT</field><value
name="INPUT"><block type="variables_get"
id="*T/PQq]x6G[LHGR^lc_F"><field name="VAR"
id="+oRRIaGJ$Ealv?.B:,kA">reducedCode</field></block></value><value
name="DELIM"><shadow type="text" id="7Sn!GO1SNJ(ke;ZbXiq}"><field
name="TEXT">,</field></shadow><block type="text"
id="C?-?2O^nV6)0(c4Xv^fd"><field
name="TEXT"></field></block></value></block></value><statement
name="DO"><block type="text_append" id="2*tTpp#MI{H]JP5`#@=6"><field
name="VAR" id="a_U?bR||v=`,lCs`2JPz">fullCode</field><value
name="TEXT"><shadow type="text" id="pG9;vw@w(Pvg6iF*0[kl"><field
name="TEXT"></field></shadow><block type="text_join"
id="+3wS=$ZQ-#XZni^=$G;p"><mutation items="2"></mutation><value
name="ADD0"><block type="text" id="T#~MR]0{G4aP`VSJc6);"><field
name="TEXT">0</field></block></value><value name="ADD1"><block
type="variables_get" id="B=:tk3Iq{M0aMp#coE%t"><field name="VAR"
id="))@ztf%OrWk^)xc5e;Y|">j</field></block></value></block></value></block></statement><next><block
type="oh_log" id="3(h.OpCa9l]v_E!HfH;x"><field
name="severity">warn</field><value name="message"><shadow type="text"
id="FGglb5l:h87:DhYA=]sv"><field name="TEXT">abc</field></shadow><block
type="variables_get" id="Gz;#_5L$o^T-ma#!)os1"><field name="VAR"
id="a_U?bR||v=`,lCs`2JPz">fullCode</field></block></value><next><block
type="oh_script_inline" id="n*?~dJW+ip#:fnux;nsw"><field
name="inlineScript"> var decimalValue = parseInt(fullCode,
2);&#10; hexValue = '0x' +
decimalValue.toString(16).toUpperCase();</field><next><block
type="variables_set" id="Kf`cZFB6Mq}[OU}`2q0X"><field name="VAR"
id="qutA=6nbjL[I7cYv=)(5">hexCodeOn</field><value name="VALUE"><block
type="text_join" id="5hg2;[X(*a7s{^e6Qx{~"><mutation
items="2"></mutation><value name="ADD0"><block type="variables_get"
id=";VZ#n5pSRS8bCX@I#G?;"><field name="VAR"
id="!D/Pt,-?hd]S-J[Xab6q">hexValue</field></block></value><value
name="ADD1"><block type="text" id="WgVkWfvRp?mcEjNw_MAD"><field
name="TEXT">1</field></block></value></block></value><next><block
type="variables_set" id="wIm8KP1eFOVAzzyWKApi"><field name="VAR"
id="6)e}PhgqcpKDkfLq05pH">hexCodeOff</field><value name="VALUE"><block
type="text_join" id="74cG@~166*R+W;yrf-Vb"><mutation
items="2"></mutation><value name="ADD0"><block type="variables_get"
id="RS@i0YK5cT7s3dgqbp$Y"><field name="VAR"
id="!D/Pt,-?hd]S-J[Xab6q">hexValue</field></block></value><value
name="ADD1"><block type="text" id="v%6@yC}vNW4M8Fa=J0k("><field
name="TEXT">4</field></block></value></block></value><next><block
type="oh_log" id="!Gw`7-j8yjJ6n%|/Sq/!"><field
name="severity">warn</field><value name="message"><shadow type="text"
id="FGglb5l:h87:DhYA=]sv"><field name="TEXT">abc</field></shadow><block
type="variables_get" id="jHdu^Q[Jk[PEStUvkebZ"><field name="VAR"
id="qutA=6nbjL[I7cYv=)(5">hexCodeOn</field></block></value><next><block
type="oh_log" id="ZW4vJjcTLIbvWf@RunLW"><field
name="severity">warn</field><value name="message"><shadow type="text"
id="FGglb5l:h87:DhYA=]sv"><field name="TEXT">abc</field></shadow><block
type="variables_get" id="Q#wn;qu63k`Zub~b2CG`"><field name="VAR"
id="6)e}PhgqcpKDkfLq05pH">hexCodeOff</field></block></value><next><block
type="oh_store_meta_config" id="*H!*NBHB2z)4Z@?EED~e"><value
name="value"><shadow type="text" id="uORqO^U;6dXBE/n#Rk)3"><field
name="TEXT"></field></shadow><block type="variables_get"
id=".n.ya.9~%0*xs|ssn1}@"><field name="VAR"
id="qutA=6nbjL[I7cYv=)(5">hexCodeOn</field></block></value><value
name="configKey"><shadow type="text" id="nLc`:-I+$pf{b%UO/gr-"><field
name="TEXT"></field></shadow><block type="text"
id="a0!d30oqu@-|8WrdsjOB"><field
name="TEXT">hexCodeOn</field></block></value><value
name="namespace"><shadow type="text" id="ElgH6uC0QXj99V(CaezJ"><field
name="TEXT"></field></shadow><block type="variables_get"
id=")S#G.`_}ed^IyW4dfALx"><field name="VAR"
id="mQ9Ux!i@pkT9NPIuZq*f">namespace</field></block></value><value
name="theItem"><shadow type="oh_item"
id="K8BABI#I2g.ID.0}.!BO"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="U^bK%-b},!#:t|CTKS:0"><field name="VAR"
id="8JhW.q,5Mn@8+sh8dIU%">i</field></block></value><next><block
type="oh_store_meta_config" id="wuWTe~922V?%p^i=}oIT"><value
name="value"><shadow type="text" id="tUcb+2D,ebTQ2c7urEC."><field
name="TEXT"></field></shadow><block type="variables_get"
id="*ZiFgP`,yPnlVQRklN]n"><field name="VAR"
id="6)e}PhgqcpKDkfLq05pH">hexCodeOff</field></block></value><value
name="configKey"><shadow type="text" id="RP8z{dDneY)ec2UemAM%"><field
name="TEXT"></field></shadow><block type="text"
id="B{$A+q{FQhFGHV9k|(WP"><field
name="TEXT">hexCodeOff</field></block></value><value
name="namespace"><shadow type="text" id="ElgH6uC0QXj99V(CaezJ"><field
name="TEXT"></field></shadow><block type="variables_get"
id="6P|L!45ZaryzW,bdcnoC"><field name="VAR"
id="mQ9Ux!i@pkT9NPIuZq*f">namespace</field></block></value><value
name="theItem"><shadow type="oh_item"
id="K8BABI#I2g.ID.0}.!BO"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="$SO)G9.5)D}[~4{$*P#E"><field name="VAR"
id="8JhW.q,5Mn@8+sh8dIU%">i</field></block></value></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></statement></block></next></block></next></block></next></block></statement></block></next></block></xml>
type: application/javascript
script: >
var namespace, i, button, systemCode, pushButton, reducedCode, fullCode,
j, hexCodeOn, hexCodeOff, hexValue;
function getItemMetaConfigValue(itemName, namespace, prop) {
if (items.metadata.getMetadata(itemName, namespace) === null) {
return 'undefined';
};
let props = prop.split('.');
let value = items.metadata.getMetadata(itemName, namespace).configuration;
props.forEach(property => {
value = value[property];
});
return value;
}
var itemMetadata;
namespace = 'rfsend';
var i_list = items.getItem('RadioFrequenz').members;
for (var i_index in i_list) {
i = i_list[i_index];
button = (items.metadata.getMetadata(i, namespace) !== null) ? (items.metadata.getMetadata(i, namespace).value) : 'undefined';
systemCode = getItemMetaConfigValue(i, namespace, 'systemCode');
systemCode += '0';
if (!!button.length) {
console.warn(button);
pushButton = {'A': '1111', 'B': '0111', 'C': '1011', 'D': '1101', 'E': '1110'};
reducedCode = String(systemCode) + String(pushButton[button]);
fullCode = '';
var j_list = reducedCode.split('');
for (var j_index in j_list) {
j = j_list[j_index];
fullCode += String('0' + String(j));
}
console.warn(fullCode);
var decimalValue = parseInt(fullCode, 2);
hexValue = '0x' + decimalValue.toString(16).toUpperCase();
hexCodeOn = String(hexValue) + '1';
hexCodeOff = String(hexValue) + '4';
console.warn(hexCodeOn);
console.warn(hexCodeOff);
itemMetadata = items.metadata.getMetadata(i, namespace);
itemMetadata = (itemMetadata === null) ? { value: '', configuration: {} } : itemMetadata;
itemMetadata.configuration.hexCodeOn = hexCodeOn;
items.metadata.replaceMetadata(i, namespace, itemMetadata.value, itemMetadata.configuration);
itemMetadata = items.metadata.getMetadata(i, namespace);
itemMetadata = (itemMetadata === null) ? { value: '', configuration: {} } : itemMetadata;
itemMetadata.configuration.hexCodeOff = hexCodeOff;
items.metadata.replaceMetadata(i, namespace, itemMetadata.value, itemMetadata.configuration);
}
}
type: script.ScriptAction
The reduced sender Rule
configuration: {}
triggers:
- id: "3"
configuration:
groupName: RadioFrequenz
type: core.GroupStateUpdateTrigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
blockSource: <xml
xmlns="https://developers.google.com/blockly/xml"><variables><variable
id="zRxan3Ar${T-02S=30JT">triggerItem</variable><variable
id="mQ9Ux!i@pkT9NPIuZq*f">namespace</variable><variable
id="h?DWa,DTh3+mez^+X1A|">data</variable><variable
id="]abUv(y%F+A.I7$qy9^-">Rfsend</variable></variables><block
type="variables_set" id="ssNk)iRorQ3fGSYm_=3n" x="92" y="113"><field
name="VAR" id="zRxan3Ar${T-02S=30JT">triggerItem</field><value
name="VALUE"><block type="oh_getitem" id="l|*X}^pl$U+i-_V:)3[5"><value
name="itemName"><shadow type="oh_item"
id=")*0J^5Z{A!g!2t|hg.ao"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="oh_context_info"
id="58.12D~2P4mX.i6B[!Si"><mutation asType="null"
contextInfo="itemName"></mutation><field
name="contextInfo">itemName</field></block></value></block></value><next><block
type="variables_set" id="jJ.7=Zxd7c7ZpZhRV:6B"><field name="VAR"
id="mQ9Ux!i@pkT9NPIuZq*f">namespace</field><value name="VALUE"><block
type="text" id=",a}:i}WTXU{BS^.1g,l*"><field
name="TEXT">rfsend</field></block></value><next><block
type="variables_set" id="(}.eV{t_eC2oXpwQYL!-"><field name="VAR"
id="h?DWa,DTh3+mez^+X1A|">data</field><value name="VALUE"><block
type="oh_get_meta_config" id="XyAI4_Hip;{5,w,0O:1W"><value
name="configKey"><shadow type="text" id="{JqT@+du;C}([~{DB`D#"><field
name="TEXT"></field></shadow><block type="text"
id="~YQFu6K!%vxw|/E/5WA0"><field
name="TEXT">Data</field></block></value><value name="theItem"><shadow
type="oh_item" id="n#oPw@*{d%Y[}d~(L9Bh"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="lT1M;x5Z:h1hXZ0Ew2+T"><field name="VAR"
id="zRxan3Ar${T-02S=30JT">triggerItem</field></block></value><value
name="namespace"><shadow type="text" id="`%CL2?u`.OR]!~b-nyRN"><field
name="TEXT"></field></shadow><block type="variables_get"
id="i;Y^kwvsOLSakqmcZe#E"><field name="VAR"
id="mQ9Ux!i@pkT9NPIuZq*f">namespace</field></block></value></block></value><next><block
type="controls_if" id=",u4aONs`;bC}JTziMuYy"><mutation
else="1"></mutation><value name="IF0"><block type="logic_compare"
id="^pM!y9q(Y,z)f|j?eh7="><field name="OP">EQ</field><value
name="A"><block type="oh_context_info"
id="uXs3-iP*08{pJ;8s-=H["><mutation asType="asString"
contextInfo="itemState"></mutation><field
name="contextInfo">itemState</field><field
name="asType">asString</field></block></value><value name="B"><block
type="text" id="/skH`X[mxX]Q-6b3,f)0"><field
name="TEXT">OFF</field></block></value></block></value><statement
name="DO0"><block type="variables_set" id="8O~U]2G*)1zy0m7DieDO"><field
name="VAR" id="h?DWa,DTh3+mez^+X1A|">data</field><value
name="VALUE"><block type="oh_get_meta_config"
id="wraCcy$[l*d58p`@rs(!"><value name="configKey"><shadow type="text"
id="7Iw,1Tzv~193,r00Ux_d"><field name="TEXT"></field></shadow><block
type="text" id="A`FIU*NRrSMmKfPG*LyE"><field
name="TEXT">hexCodeOff</field></block></value><value
name="theItem"><shadow type="oh_item"
id="n#oPw@*{d%Y[}d~(L9Bh"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="Kx#RK=Zm)gq}!xYAyhnt"><field name="VAR"
id="zRxan3Ar${T-02S=30JT">triggerItem</field></block></value><value
name="namespace"><shadow type="text" id="`%CL2?u`.OR]!~b-nyRN"><field
name="TEXT"></field></shadow><block type="variables_get"
id="TmL]hPFHmULsTny7^r5L"><field name="VAR"
id="mQ9Ux!i@pkT9NPIuZq*f">namespace</field></block></value></block></value></block></statement><statement
name="ELSE"><block type="variables_set" id="iGG,upFx*%jiY/*(TewH"><field
name="VAR" id="h?DWa,DTh3+mez^+X1A|">data</field><value
name="VALUE"><block type="oh_get_meta_config"
id="drJw8+Cw8E|SzcWZC?7r"><value name="configKey"><shadow type="text"
id="7Iw,1Tzv~193,r00Ux_d"><field name="TEXT"></field></shadow><block
type="text" id="YmCwpkW??@wcamltnu}#"><field
name="TEXT">hexCodeOn</field></block></value><value
name="theItem"><shadow type="oh_item"
id="n#oPw@*{d%Y[}d~(L9Bh"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="Cj9+xw/1{.I$V:q**CmY"><field name="VAR"
id="zRxan3Ar${T-02S=30JT">triggerItem</field></block></value><value
name="namespace"><shadow type="text" id="`%CL2?u`.OR]!~b-nyRN"><field
name="TEXT"></field></shadow><block type="variables_get"
id="0#Up]+Dklp-;4YP.a_I/"><field name="VAR"
id="mQ9Ux!i@pkT9NPIuZq*f">namespace</field></block></value></block></value></block></statement><next><block
type="oh_log" id="BnL`+x{47d@p1q;GqL[O"><field
name="severity">warn</field><value name="message"><shadow type="text"
id="@gkZZwrwMaYV,Gk8V|$I"><field name="TEXT">abc</field></shadow><block
type="variables_get" id="I:veZFC+13TQ)0f*_]Ci"><field name="VAR"
id="h?DWa,DTh3+mez^+X1A|">data</field></block></value><next><block
type="variables_set" id="+3[(!!^VL]J|LEg_6#{G"><field name="VAR"
id="]abUv(y%F+A.I7$qy9^-">Rfsend</field><value name="VALUE"><block
type="text_join" id="`Vg6O$@|d~m|lLZ.RZ9`"><mutation
items="9"></mutation><value name="ADD0"><block type="text"
id=":bDb6_gMQUr=z@6~2Z|1"><field
name="TEXT">{"Data":"</field></block></value><value name="ADD1"><block
type="variables_get" id="O~DILXs[;=B)E%lCas6Z"><field name="VAR"
id="h?DWa,DTh3+mez^+X1A|">data</field></block></value><value
name="ADD2"><block type="text" id="!UoT-vQ8G8NlP0f~Kxi+"><field
name="TEXT">","Bits":</field></block></value><value name="ADD3"><block
type="oh_get_meta_config" id="0b}Wdzt$Y4Cpk8K=KX?M"><value
name="configKey"><shadow type="text" id="7Iw,1Tzv~193,r00Ux_d"><field
name="TEXT"></field></shadow><block type="text"
id="[$,]J4xhMCzK]pHHfaT-"><field
name="TEXT">Bits</field></block></value><value name="theItem"><shadow
type="oh_item" id="n#oPw@*{d%Y[}d~(L9Bh"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="BHQdv4B4Zu2}aaIYU#C]"><field name="VAR"
id="zRxan3Ar${T-02S=30JT">triggerItem</field></block></value><value
name="namespace"><shadow type="text" id="`%CL2?u`.OR]!~b-nyRN"><field
name="TEXT"></field></shadow><block type="variables_get"
id="r8c=uyYL8*2?,u@0s+KW"><field name="VAR"
id="mQ9Ux!i@pkT9NPIuZq*f">namespace</field></block></value></block></value><value
name="ADD4"><block type="text" id="1C~X$FS@OJz1,qu?Uv!c"><field
name="TEXT">,"Protocol":</field></block></value><value
name="ADD5"><block type="oh_get_meta_config"
id="?psXYF(r?Fud,N^R63S/"><value name="configKey"><shadow type="text"
id="Xc%doPlVpGy`M,dPAyem"><field name="TEXT"></field></shadow><block
type="text" id="KEL4hhJaWee-$u5hx@dl"><field
name="TEXT">Protocol</field></block></value><value
name="theItem"><shadow type="oh_item"
id="n#oPw@*{d%Y[}d~(L9Bh"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="w3hrv:=Vi;Mpa-8~n]%A"><field name="VAR"
id="zRxan3Ar${T-02S=30JT">triggerItem</field></block></value><value
name="namespace"><shadow type="text" id="`%CL2?u`.OR]!~b-nyRN"><field
name="TEXT"></field></shadow><block type="variables_get"
id="O#:O1`R3g6dl{xAG9_%a"><field name="VAR"
id="mQ9Ux!i@pkT9NPIuZq*f">namespace</field></block></value></block></value><value
name="ADD6"><block type="text" id="cs`.e_N:gVqh4lp$qaZY"><field
name="TEXT">,"Pulse":</field></block></value><value name="ADD7"><block
type="oh_get_meta_config" id="xnsMr9J?3@xYj:C|UMHF"><value
name="configKey"><shadow type="text" id="[:y$lv#XwbKz32tkm2%:"><field
name="TEXT"></field></shadow><block type="text"
id="D1`-AysmpKbma^rAmU,)"><field
name="TEXT">Pulse</field></block></value><value name="theItem"><shadow
type="oh_item" id="n#oPw@*{d%Y[}d~(L9Bh"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="variables_get"
id="1Wwve%s?k70G.!YZ~^D_"><field name="VAR"
id="zRxan3Ar${T-02S=30JT">triggerItem</field></block></value><value
name="namespace"><shadow type="text" id="`%CL2?u`.OR]!~b-nyRN"><field
name="TEXT"></field></shadow><block type="variables_get"
id="bzm|KM8rxA3^*M-*)H6="><field name="VAR"
id="mQ9Ux!i@pkT9NPIuZq*f">namespace</field></block></value></block></value><value
name="ADD8"><block type="text" id="4_@abfJl]m-,t9?2^[u("><field
name="TEXT">}</field></block></value></block></value><next><block
type="oh_event" id="rkpz=o`d)Us.``4,]}p|"><field
name="eventType">sendCommand</field><value name="value"><shadow
type="text" id="JbvJ=:pP?PX^GKKP^VTf"><field
name="TEXT">value</field></shadow><block type="variables_get"
id="?s?:7?+ZOe;v`+3e5N~p"><field name="VAR"
id="]abUv(y%F+A.I7$qy9^-">Rfsend</field></block></value><value
name="itemName"><shadow type="oh_item"
id="Z8#EcEd26+f2b]o7h`mH"><mutation itemName="MyItem"
itemLabel="MyItem"></mutation><field
name="itemName">MyItem</field></shadow><block type="oh_item"
id="eR2YNJVz^Mf(a4FiMEGQ"><mutation itemName="RadioFrequenz_Transmitter"
itemLabel="433 Transmitter"></mutation><field
name="itemName">RadioFrequenz_Transmitter</field></block></value></block></next></block></next></block></next></block></next></block></next></block></next></block></xml>
type: application/javascript
script: >
var triggerItem, namespace, data, Rfsend;
function getItemMetaConfigValue(itemName, namespace, prop) {
if (items.metadata.getMetadata(itemName, namespace) === null) {
return 'undefined';
};
let props = prop.split('.');
let value = items.metadata.getMetadata(itemName, namespace).configuration;
props.forEach(property => {
value = value[property];
});
return value;
}
triggerItem = items.getItem(event.itemName);
namespace = 'rfsend';
data = getItemMetaConfigValue(triggerItem, namespace, 'Data');
if (event.itemState.toString() == 'OFF') {
data = getItemMetaConfigValue(triggerItem, namespace, 'hexCodeOff');
} else {
data = getItemMetaConfigValue(triggerItem, namespace, 'hexCodeOn');
}
console.warn(data);
Rfsend = ['{"Data":"',data,'","Bits":',getItemMetaConfigValue(triggerItem, namespace, 'Bits'),',"Protocol":',getItemMetaConfigValue(triggerItem, namespace, 'Protocol'),',"Pulse":',getItemMetaConfigValue(triggerItem, namespace, 'Pulse'),'}'].join('');
items.getItem('RadioFrequenz_Transmitter').sendCommand(Rfsend);
type: script.ScriptAction