Use rollershutter_position_profile for rollershutter-item without channel

I use the great rollershutter-position-emulation from Jeff James that’s in the Add-On-Store for all my dumb somfy rollershutters. Works great.

But: I have one shutter (warema) where I have to send the rf-signals low-level by a rule. This rule is triggered if the corresponding rollershutter item changed. So this item is not connected to a thing but has it’s hardware connection only via rule.

Is it somehow possible to use the rollershutter_position_profile for this item although it’s not connected to a channel?

No. Profiles live on the Link, not on the Item or the Channel. If you don’t have a Link, you can’t have a profile.

Yes, understood.
I was looking for a trick to use the profile (because it’s great) anyway.
Wouldn’t it be possible to connect a dummy-channel (just anything without function) and then check the updates of the item that are done by the profile?
I’ll give that a try and report.

And do what with it?

The Profile intercepts and modifies state updates coming from the Channel to the Item, and in some cases from the Item to the Channel (e.g. transform Profile). The follow profile links two Channels (i.e. an update from one Channel becomes a command to another Channel in addition to an update to the Item).

How could a dummy Channel be used here? The profile is only going to change the data going back and forth between the Item and the dummy Channel. Your rule won’t see it.

I would like to use the position-emulation that is implemented in the profile, so that I don’t have to re-implement it. (Actually I already did that, but the profile works better than my emulation)

The profile works in both directions:
It processes the commands to the items and updates the state of the item.
Here the a part with the callbacks from the source-code of the profile:

        if (targetPos == position && !isMoving()) {
            logger.debug("moveTo() position already current: {}", targetPos);
            if (targetPos == 0) { // always send command if either 0 or 100 in case it is not already in that position
                callback.handleCommand(UpDownType.UP);
...
        } else if (Math.abs(posOffset) < configuration.precision) {
            callback.sendUpdate(new PercentType(position));
            } 

I’ll give it a try tomorrow.

Got it working (thanks for the push by telling me it’s not possible :wink:). The rule processes position commands by starting the motion and then waiting for the matching change event caused by the profile. UP, DOWN and STOP are just passed through.
If anybody is interessted here the rule as blockly:

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

and here the image:

@Larsen sorry to necromance this thread but I’m very interested in your solution because I want to do the same thing. However, I’m struggling to follow how you got it to work.

Firstly, do you mind explaining what Items you have? Do I understand that you have 2x shadow items:

  1. Blind1_p which gets sent ON and OFF commands, and a rule elsewhere which triggers on those and sends up and down by IR, and
  2. a Blind1_s which gets sent ON to stop that blind?

Would it be possible (cleaner?) to have the shadow Item be a RollerShutter, and send IR/RF messages on the DOWN, UP, and STOP commands? This is what I do, very successfully, and I’ve pasted the DSL below.

Secondly, the main issue seemed to be that without a link between the Channel and the Item, the profile won’t work. Is that not the case? It would be great to see how your Items are configured, if there’s anything special you’ve done to them to get around this issue. Do you even need a shadow item(s)?

rule "iSmartWindow blinds & curtains RF"
when 
	Member of dBlinds received command 
	or Member of dCurtains received command
then

	var channel = transform("MAP", "blinds.map", triggeringItem.name)
	var command = receivedCommand
	
	switch ( command ) {
		case UP: {
			Hallway_Broadlink_RF_Command.sendCommand(channel+"_Up")
		}
		case 0: {
			Hallway_Broadlink_RF_Command.sendCommand(channel+"_Up")
		}
		case DOWN: {
			Hallway_Broadlink_RF_Command.sendCommand(channel+"_Down")
		}
		case 100: {
			Hallway_Broadlink_RF_Command.sendCommand(channel+"_Down")
		}
		case STOP: {
			Hallway_Broadlink_RF_Command.sendCommand(channel+"_Stop")
		}
	}
end

The trick is is that you need to create a dummy-thing, go to a channel and then create the new shadow rollershutter-item and select the rollershutter-profile. With this trick you’ve got an rollershutter-item that can use the rollershutter-profile. You have to configure the up-and down timings of course.

That’s exactly what happens with that rule. It listens to commands to the rollershutter-shadow-item. It passes through commands and sends the stop command when the rollershutter-state reaches the target partition. The only thing that is different to your use case is that I have to send rf-signals via the rfxcom-binding instead of ir-signals. As the rfxcom-binding only knows switches for recorded code-sequences and as a switch only has two states I do need a second item for the stop command. But that might be different for you if you send ir-signals.

Sorry, but what is a ‘dummy-thing’? Is there a binding that provides such a Thing?

The RFXCOM binding has a channel called ‘shutter’ which is a RollerShutter type - maybe it’s new, and could streamline your rule?

I think we stil got some misunderstandings.
You need:

  • 1 thing that provides a channel for the rollershutter-item (not connected to any hardware). I use rfxcom-binding (because it’s already used in my installation) with an arbitrary id.
    You can use the magic-binding for this virtual device if you don’t have rfxcom running.
  • 1 rollershutter item connected to this channel via rollershutterposition-profile
  • 1 rule that listens to commands to that item and passes up, down, stop, 0, 100 (just like yours). Additionally you need to store the target position so that the event rule below is able to access it. I use metadata for that purpose. In DSL you need something different I guess.
  • 1 rule that listens to change-events and sends stop as soon as the stored target position is reached (that’s the key-part!). Afterwards it deletes the stored target value.

In my example 4 posts above I combined the two rules in one rule but that’s a matter of taste.

Don’t get confused by my additional items (item_p, item_s). They’re only necessary because there is no easier way to send raw rf-codes with rfxcom.