Визуализация статуса яндекс‐колонки LED лентой - d51x/openhab-docs-russian GitHub Wiki

Используются биндинги YandexStation и Wifi Led.

Когда вы обращаетесь к яндекс-колонке: - Алиса, ....

А потом продолжаете (или нет) с ней разговор, яндекс-колонка меняет свой статус.

Возможные статуы:

  • IDLE - колонка вас не слушает
  • LISTENING - колонка вас слушает, когда вы к ней обратились
  • SPEACKING - колонка что-то говорит
  • BUSY - колонка выполняет какое-то действие

Создадим правило, что если статус колонки меняется с IDLE на какой либо другой, то будем менять цвет (эффект) на LED ленте, а после того, как колонка перешла в статус IDLE, вернем цвет ленты на тот, который был установлен до начала общения.

Будет работать только тогда, когда лента уже включена (state item (power = ON))

image

Скрипт на Blockly:

image

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: Yandex_Station_Light_Alice_State
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      blockSource: <xml
        xmlns="https://developers.google.com/blockly/xml"><variables><variable
        id=",rszu.g9co#@QL%{sPx.">aliceState</variable><variable
        id="gzCKO-!rJ8otr?^{W,Fq">program</variable><variable
        id=";Q}B+Pu.o}H,ar+M*.wE">speed</variable><variable
        id="=%GLAU[?]?vBg}+}2eR`">state</variable><variable
        id="R5BC]/?#?ggmz9f]ZZDs">color</variable></variables><block
        type="variables_set" id="Aca_ROc9PA%-}IAMkO`_" x="38" y="51"><field
        name="VAR" id=",rszu.g9co#@QL%{sPx.">aliceState</field><value
        name="VALUE"><block type="oh_context_info"
        id="ar[FhHl=i[ee#/YUc|+R"><field
        name="contextInfo">itemState</field><field
        name="asType">asString</field></block></value><next><block
        type="controls_if" id="DMe-(1^yMM1R-5vZB{EJ"><value name="IF0"><block
        type="logic_operation" id="PSnZ9rah5yx}=Q/ivilz"><field
        name="OP">AND</field><value name="A"><block type="logic_compare"
        id="}l)TSJpK?IeL$m:vBDC4"><field name="OP">EQ</field><value
        name="A"><block type="variables_get" id="@WKrUuO.+OHj)`C7lX6["><field
        name="VAR"
        id=",rszu.g9co#@QL%{sPx.">aliceState</field></block></value><value
        name="B"><block type="text" id="Zva)To!*SfY8SMNwcxi."><field
        name="TEXT">LISTENING</field></block></value></block></value><value
        name="B"><block type="logic_compare" id="hJ%,P%bOzRK0#OxYmV}]"><field
        name="OP">EQ</field><value name="A"><block type="oh_context_info"
        id="$`.x=Bfmy7txs*?+n;j7"><field
        name="contextInfo">oldItemState</field><field
        name="asType">asString</field></block></value><value name="B"><block
        type="text" id="08rDlZX@M}W2Xdw%H,yi"><field
        name="TEXT">IDLE</field></block></value></block></value></block></value><statement
        name="DO0"><block type="oh_log" id="t~GwClp^APCSQz%dgzLK"><field
        name="severity">info</field><value name="message"><shadow type="text"
        id="?jqwa8Qimr^TL)rC=/|5"><field name="TEXT">abc</field></shadow><block
        type="text" id="mP=SQld2ec*~+WaATpqR"><field name="TEXT">Алиса начала
        слушать, сохраним предыдущие
        значения</field></block></value><next><block type="variables_set"
        id=";7$azsJEwqEw|@hCaol?"><field name="VAR"
        id="=%GLAU[?]?vBg}+}2eR`">state</field><value name="VALUE"><block
        type="oh_getitem_state" id="c1vp=*`jJ/Zf-KEZXhJX"><value
        name="itemName"><shadow type="oh_item"
        id="q?XCKvrvurkT%[|]x~?="><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="d~Si$t:1.nmxW}#ma#38"><mutation itemName="Bedroom1_LedStrip_State"
        itemLabel="Bedroom1_LedStrip_State"></mutation><field
        name="itemName">Bedroom1_LedStrip_State</field></block></value></block></value><next><block
        type="variables_set" id="N*mQOD9i98AWa_K0l(@A"><field name="VAR"
        id="R5BC]/?#?ggmz9f]ZZDs">color</field><value name="VALUE"><block
        type="oh_getitem_state" id="H{.UUzZs0UPUbnbu)G0i"><value
        name="itemName"><shadow type="oh_item"
        id="q?XCKvrvurkT%[|]x~?="><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="re@W%Ou(pe2~{_qlCI[4"><mutation
        itemName="Bedroom1_LedStrip_RgbColor"
        itemLabel="Bedroom1_LedStrip_RgbColor"></mutation><field
        name="itemName">Bedroom1_LedStrip_RgbColor</field></block></value></block></value><next><block
        type="variables_set" id="LB4J-ZP;)~Cu[Gi.I6FO"><field name="VAR"
        id=";Q}B+Pu.o}H,ar+M*.wE">speed</field><value name="VALUE"><block
        type="oh_getitem_state" id=":wAOhLLH.3f0?/~*..g6"><value
        name="itemName"><shadow type="oh_item"
        id="q?XCKvrvurkT%[|]x~?="><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="0pP0QQsZSV:+D-CQ~nYq"><mutation
        itemName="LedStrip_Bedroom1_Program_Speed" itemLabel="LedStrip Bedroom1
        Program Speed"></mutation><field
        name="itemName">LedStrip_Bedroom1_Program_Speed</field></block></value></block></value><next><block
        type="oh_store_meta_value" id="L@d}*JuQiuryZNqDmYab"><value
        name="value"><shadow type="text" id="5}f4=_q8A-MB|VHT,8Cf"><field
        name="TEXT"></field></shadow><block type="variables_get"
        id="OBM)/FiuT`=v[_Gk:VX("><field name="VAR"
        id="=%GLAU[?]?vBg}+}2eR`">state</field></block></value><value
        name="namespace"><shadow type="text" id="-.z,~H*S8Pg-?K,NaSO+"><field
        name="TEXT"></field></shadow><block type="text"
        id="+h+m8BIRR/*Yf#$l^gSx"><field
        name="TEXT">prev</field></block></value><value name="theItem"><shadow
        type="oh_item" id="-3#S1cZ[NqZHlz}T9FAw"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="Fv}6b=Cfk2gbSM+bjzsK"><mutation itemName="Bedroom1_LedStrip_State"
        itemLabel="Bedroom1_LedStrip_State"></mutation><field
        name="itemName">Bedroom1_LedStrip_State</field></block></value><next><block
        type="oh_store_meta_value" id="t0~Ezg+nKXF2jF-cHuG*"><value
        name="value"><shadow type="text" id="5}f4=_q8A-MB|VHT,8Cf"><field
        name="TEXT"></field></shadow><block type="variables_get"
        id="+//RZW}G:mPW9@w6{F]z"><field name="VAR"
        id="R5BC]/?#?ggmz9f]ZZDs">color</field></block></value><value
        name="namespace"><shadow type="text" id="uY_:4,LAyyy,*mV9%WOs"><field
        name="TEXT"></field></shadow><block type="text"
        id="gTQ=hf%|]dXryT:j63Xb"><field
        name="TEXT">prev</field></block></value><value name="theItem"><shadow
        type="oh_item" id="-3#S1cZ[NqZHlz}T9FAw"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="ssn6j7cNl{4biIl,wWYH"><mutation
        itemName="Bedroom1_LedStrip_RgbColor"
        itemLabel="Bedroom1_LedStrip_RgbColor"></mutation><field
        name="itemName">Bedroom1_LedStrip_RgbColor</field></block></value><next><block
        type="oh_store_meta_value" id="d,f-ikeoo~6J(dQn)$c*"><value
        name="value"><shadow type="text" id="5}f4=_q8A-MB|VHT,8Cf"><field
        name="TEXT"></field></shadow><block type="variables_get"
        id="(V0fe#{gFM8A#g$+JMWq"><field name="VAR"
        id=";Q}B+Pu.o}H,ar+M*.wE">speed</field></block></value><value
        name="namespace"><shadow type="text" id="uY_:4,LAyyy,*mV9%WOs"><field
        name="TEXT"></field></shadow><block type="text"
        id="Sd#^*ZXk{W_2%u[zT6ne"><field
        name="TEXT">prev</field></block></value><value name="theItem"><shadow
        type="oh_item" id="-3#S1cZ[NqZHlz}T9FAw"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="nqH4isW[s7-GLD6%ea?M"><mutation
        itemName="LedStrip_Bedroom1_Program_Speed" itemLabel="LedStrip Bedroom1
        Program Speed"></mutation><field
        name="itemName">LedStrip_Bedroom1_Program_Speed</field></block></value></block></next></block></next></block></next></block></next></block></next></block></next></block></statement><next><block
        type="controls_if" id="{=3.7~STRA[.j[f3`cG{"><mutation
        elseif="3"></mutation><value name="IF0"><block type="logic_compare"
        id="DVt$ALW.E3:RCx`=P|8f"><field name="OP">EQ</field><value
        name="A"><block type="variables_get" id="0pY328:x}8ci62-MNUZZ"><field
        name="VAR"
        id=",rszu.g9co#@QL%{sPx.">aliceState</field></block></value><value
        name="B"><block type="text" id="|b*G+45YZ*]L*m0{2hYR"><field
        name="TEXT">LISTENING</field></block></value></block></value><statement
        name="DO0"><block type="oh_log" id="/Elt~b[Uvx9~R8|lL1C-"><field
        name="severity">info</field><value name="message"><shadow type="text"
        id="Azx;Uf(Ox+tU96wd{fT@"><field name="TEXT">abc</field></shadow><block
        type="text" id="cJ%GaiKh:!1[W#EHW@*F"><field name="TEXT">🎧 Алиса сейча
        слушает ...</field></block></value><next><block
        type="procedures_callnoreturn" id="g8-|S!8lw-n83M`dJlL^"
        inline="true"><mutation name="wifi_led_effect"><arg
        name="program"></arg><arg name="speed"></arg></mutation><value
        name="ARG0"><block type="math_number" id="8PiDehh5asJP1r?qoJt1"><field
        name="NUM">43</field></block></value><value name="ARG1"><block
        type="math_number" id="U-d.-xvtQ;4[U6ULR6*L"><field
        name="NUM">97</field></block></value></block></next></block></statement><value
        name="IF1"><block type="logic_compare" id="Q(^OLZIyj.$A/:?@3u@|"><field
        name="OP">EQ</field><value name="A"><block type="variables_get"
        id="9Kau}OYnn%L{R$H~RYIS"><field name="VAR"
        id=",rszu.g9co#@QL%{sPx.">aliceState</field></block></value><value
        name="B"><block type="text" id="8ZFfxiyIiOj358`#A1}/"><field
        name="TEXT">SPEAKING</field></block></value></block></value><statement
        name="DO1"><block type="oh_log" id="7U5TIb)b_Af1^|AtpLA="><field
        name="severity">info</field><value name="message"><shadow type="text"
        id="K+jS-.6ql4(mv$Rb:+9F"><field name="TEXT">abc</field></shadow><block
        type="text" id="D2b^`ys~#?7@H[xKiF2h"><field name="TEXT">📣 Алиса сейча
        говорит ...</field></block></value><next><block
        type="procedures_callnoreturn" id="6f~iK75KC9%hsA$}3q%-"
        inline="true"><mutation name="wifi_led_effect"><arg
        name="program"></arg><arg name="speed"></arg></mutation><value
        name="ARG0"><block type="math_number" id="+h*oqyVTTU*8N8/p@C`J"><field
        name="NUM">41</field></block></value><value name="ARG1"><block
        type="math_number" id="rmbLbL]JvAQ:QX)FZSl,"><field
        name="NUM">92</field></block></value></block></next></block></statement><value
        name="IF2"><block type="logic_compare" id="n9/9kX:F4Oh#]qXc7Dz)"><field
        name="OP">EQ</field><value name="A"><block type="variables_get"
        id="^^_n7M[XuISq]LIa3%lL"><field name="VAR"
        id=",rszu.g9co#@QL%{sPx.">aliceState</field></block></value><value
        name="B"><block type="text" id="dhPU|$mgY/eCXm%dW0/E"><field
        name="TEXT">BUSY</field></block></value></block></value><statement
        name="DO2"><block type="oh_log" id="XzhA_f=5Xjlw@+}cx3eq"><field
        name="severity">info</field><value name="message"><shadow type="text"
        id="ha24v^K07+wW!nxeiF{4"><field name="TEXT">abc</field></shadow><block
        type="text" id="fO^;*A[I2kNJ7:l_]?W2"><field name="TEXT">⏳ Алиса сейча
        занята ...</field></block></value><next><block
        type="procedures_callnoreturn" id="=}UmVK)X$1+XYi]{.c49"
        inline="true"><mutation name="wifi_led_effect"><arg
        name="program"></arg><arg name="speed"></arg></mutation><value
        name="ARG0"><block type="math_number" id="AN,j%@rFfUS2V(!wc{*k"><field
        name="NUM">38</field></block></value><value name="ARG1"><block
        type="math_number" id="Z`/ab|uqKXZUR01~R,nW"><field
        name="NUM">92</field></block></value></block></next></block></statement><value
        name="IF3"><block type="logic_compare" id="vcno*CYcUVO`28MC2*#."><field
        name="OP">EQ</field><value name="A"><block type="variables_get"
        id="6~@M;fH:X%rr_Jvonrd0"><field name="VAR"
        id=",rszu.g9co#@QL%{sPx.">aliceState</field></block></value><value
        name="B"><block type="text" id="w!R/e-*Fc_Q8@gjmmU2("><field
        name="TEXT">IDLE</field></block></value></block></value><statement
        name="DO3"><block type="oh_log" id=")#Lvf~O*gri0d,R=kw[I"><field
        name="severity">info</field><value name="message"><shadow type="text"
        id="ha24v^K07+wW!nxeiF{4"><field name="TEXT">abc</field></shadow><block
        type="text" id="h]jUDuI2Ee;rmj6RHvl]"><field name="TEXT">💤 Алиса сейча
        ожидает ...</field></block></value><next><block
        type="procedures_callnoreturn" id="[v14{#KvLgl}%P{S$9uq"
        inline="true"><mutation name="wifi_led_effect"><arg
        name="program"></arg><arg name="speed"></arg></mutation><value
        name="ARG0"><block type="math_number" id="[-#+iRLFC|7^2zs9UU!q"><field
        name="NUM">97</field></block></value><value name="ARG1"><block
        type="math_number" id="fii#]M8U%8S;[D`h;0Ko"><field
        name="NUM">100</field></block></value><next><block type="oh_log"
        id="r9h!pplbG*;wq,Q)9/v:"><field name="severity">info</field><value
        name="message"><shadow type="text" id="FTG?ImY4u(2l=GqcF]Vo"><field
        name="TEXT">abc</field></shadow><block type="text"
        id="nu]Yrc=M)GjMkxZn@H0q"><field name="TEXT">Алиса перестала говорить и
        слушать, восстанови значения</field></block></value><next><block
        type="procedures_callnoreturn" id="4KHaoR$t_PR(OpZ5L0cp"><mutation
        name="restore"></mutation></block></next></block></next></block></next></block></statement></block></next></block></next></block><block
        type="procedures_defnoreturn" id="V@Jd$+%W0K:e}?P7ZgLS" x="726"
        y="364"><mutation><arg name="program"
        varid="gzCKO-!rJ8otr?^{W,Fq"></arg><arg name="speed"
        varid=";Q}B+Pu.o}H,ar+M*.wE"></arg></mutation><field
        name="NAME">wifi_led_effect</field><comment pinned="false" h="80"
        w="160">Describe this function...</comment><statement
        name="STACK"><block type="oh_event" id="OLW*Vo}7HD(~fB_0@#cF"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="{=daYT=D-0{GA#4nv2c3"><field
        name="TEXT">value</field></shadow><block type="variables_get"
        id="}Esnt~)Ao:Q%B{v84FH:"><field name="VAR"
        id=";Q}B+Pu.o}H,ar+M*.wE">speed</field></block></value><value
        name="itemName"><shadow type="oh_item"
        id="nA@D87S|#5}0VF5T.%85"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="WivsR1vQT7{}eJb}-D2Y"><mutation
        itemName="LedStrip_Bedroom1_Program_Speed" itemLabel="LedStrip Bedroom1
        Program Speed"></mutation><field
        name="itemName">LedStrip_Bedroom1_Program_Speed</field></block></value><next><block
        type="oh_event" id="LUhV^np:tPum#@#Ud,s^"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="{=daYT=D-0{GA#4nv2c3"><field
        name="TEXT">value</field></shadow><block type="variables_get"
        id="PV+Q`(-6JH1a=g{$g},%"><field name="VAR"
        id="gzCKO-!rJ8otr?^{W,Fq">program</field></block></value><value
        name="itemName"><shadow type="oh_item"
        id="nA@D87S|#5}0VF5T.%85"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="_Ski8*P~]X(Fk7yEf7br"><mutation itemName="LedStrip_Bedroom1_Program"
        itemLabel="LedStrip Bedroom1 Program"></mutation><field
        name="itemName">LedStrip_Bedroom1_Program</field></block></value></block></next></block></statement></block><block
        type="procedures_defnoreturn" id="e_F:qK]HQ8%Rix*u$[im" x="721"
        y="498"><field name="NAME">restore</field><comment pinned="false" h="80"
        w="160">Describe this function...</comment><statement
        name="STACK"><block type="variables_set"
        id="vfQ][vmGk5%8fxRETN~%"><field name="VAR"
        id="=%GLAU[?]?vBg}+}2eR`">state</field><value name="VALUE"><block
        type="oh_get_meta_value" id="N_a;/M8SVywB3zbk~Ctz"><value
        name="theItem"><shadow type="oh_item"
        id="jnVX-n,sC,1.xBXp$f;_"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="(1Z[o]XY9mxT-D$WcPZi"><mutation itemName="Bedroom1_LedStrip_State"
        itemLabel="Bedroom1_LedStrip_State"></mutation><field
        name="itemName">Bedroom1_LedStrip_State</field></block></value><value
        name="namespace"><shadow type="text" id="lDF]w`vJ`[GIdqpbBybH"><field
        name="TEXT"></field></shadow><block type="text"
        id="7wqyM34znP5Pu02KQ{ab"><field
        name="TEXT">prev</field></block></value></block></value><next><block
        type="variables_set" id="%WU!8Qz,,k/rtnwDXwqw"><field name="VAR"
        id="R5BC]/?#?ggmz9f]ZZDs">color</field><value name="VALUE"><block
        type="oh_get_meta_value" id="U@/loNRJg_SoD1~00|+A"><value
        name="theItem"><shadow type="oh_item"
        id="jnVX-n,sC,1.xBXp$f;_"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="?YV-a`XIMiW31,Ri=d[;"><mutation
        itemName="Bedroom1_LedStrip_RgbColor"
        itemLabel="Bedroom1_LedStrip_RgbColor"></mutation><field
        name="itemName">Bedroom1_LedStrip_RgbColor</field></block></value><value
        name="namespace"><shadow type="text" id=":G`pyWsNEx=i64v_=ijQ"><field
        name="TEXT"></field></shadow><block type="text"
        id="YvNX%c3#u*2ED[U:JRY("><field
        name="TEXT">prev</field></block></value></block></value><next><block
        type="variables_set" id="#vcCO2k4S*z+6KRc_FNm"><field name="VAR"
        id=";Q}B+Pu.o}H,ar+M*.wE">speed</field><value name="VALUE"><block
        type="oh_get_meta_value" id="3l8}7ZzU,qbpde16jcT~"><value
        name="theItem"><shadow type="oh_item"
        id="jnVX-n,sC,1.xBXp$f;_"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="s_5Y::ni,RjaVpSzmxC6"><mutation
        itemName="LedStrip_Bedroom1_Program_Speed" itemLabel="LedStrip Bedroom1
        Program Speed"></mutation><field
        name="itemName">LedStrip_Bedroom1_Program_Speed</field></block></value><value
        name="namespace"><shadow type="text" id=":G`pyWsNEx=i64v_=ijQ"><field
        name="TEXT"></field></shadow><block type="text"
        id="J,eZi@lGKyY-%:/$Wb/W"><field
        name="TEXT">prev</field></block></value></block></value><next><block
        type="oh_event" id="O%?g64yJDRfj]HN?.cJT"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="K3DI{15LC04o:#QSz)^7"><field
        name="TEXT">value</field></shadow><block type="variables_get"
        id=":0w#14?DsMArWhfHpk1s"><field name="VAR"
        id="R5BC]/?#?ggmz9f]ZZDs">color</field></block></value><value
        name="itemName"><shadow type="oh_item"
        id="gC(A.bXQ9alM~(o@Ccnu"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="s2TBeigg5x#_5lc:]EE0"><mutation
        itemName="Bedroom1_LedStrip_RgbColor"
        itemLabel="Bedroom1_LedStrip_RgbColor"></mutation><field
        name="itemName">Bedroom1_LedStrip_RgbColor</field></block></value><next><block
        type="oh_event" id="[Swc*jN7gE8e)a$c}Y]d"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="rCau~+)5veZ7P}x3CGZj"><field
        name="TEXT">value</field></shadow><block type="variables_get"
        id="t#pE]h[jNQeRrT~*P5B,"><field name="VAR"
        id=";Q}B+Pu.o}H,ar+M*.wE">speed</field></block></value><value
        name="itemName"><shadow type="oh_item"
        id="nA@D87S|#5}0VF5T.%85"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="cOA7wyZoKJIls..RhV;`"><mutation
        itemName="LedStrip_Bedroom1_Program_Speed" itemLabel="LedStrip Bedroom1
        Program Speed"></mutation><field
        name="itemName">LedStrip_Bedroom1_Program_Speed</field></block></value><next><block
        type="oh_sleep" id=")EqJXmiAhuZX8xb+M8b3"><field
        name="milliseconds">100</field><next><block type="controls_if"
        id="osgr1)f/~bE64I8/MM5C"><mutation else="1"></mutation><value
        name="IF0"><block type="logic_compare" id="8qK~jW=sAJs!o3.x|xtQ"><field
        name="OP">EQ</field><value name="A"><block type="oh_getitem_state"
        id="*m,fv]is6/7VISx_wp~C"><value name="itemName"><shadow type="oh_item"
        id="ZaKP/LvYpPKR#9NZ:rl@"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="ZaKP/LvYpPKR#9NZ:rl@"><mutation itemName="goto_sleep" itemLabel="Go
        to sleep"></mutation><field
        name="itemName">goto_sleep</field></block></value></block></value><value
        name="B"><block type="text" id="vUiie_)g4IF*wqa(2mdc"><field
        name="TEXT">ON</field></block></value></block></value><statement
        name="DO0"><block type="oh_event" id="Ci=t3bOu_)xPLkWTL]q4"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="{=daYT=D-0{GA#4nv2c3"><field
        name="TEXT">value</field></shadow><block type="text"
        id="{=daYT=D-0{GA#4nv2c3"><field
        name="TEXT">OFF</field></block></value><value name="itemName"><shadow
        type="oh_item" id="nA@D87S|#5}0VF5T.%85"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="p,WtNyo2SXJs$#:W^Oh1"><mutation itemName="Bedroom1_LedStrip_State"
        itemLabel="Bedroom1_LedStrip_State"></mutation><field
        name="itemName">Bedroom1_LedStrip_State</field></block></value></block></statement><statement
        name="ELSE"><block type="oh_event" id="/4Rc{5~k|st*w/pDhK.g"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="{=daYT=D-0{GA#4nv2c3"><field
        name="TEXT">value</field></shadow><block type="variables_get"
        id="g0|V$cBRiAT%U*b8g-:J"><field name="VAR"
        id="=%GLAU[?]?vBg}+}2eR`">state</field></block></value><value
        name="itemName"><shadow type="oh_item"
        id="nA@D87S|#5}0VF5T.%85"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="Z0,eW?;_O+b7qDf3=[~D"><mutation itemName="Bedroom1_LedStrip_State"
        itemLabel="Bedroom1_LedStrip_State"></mutation><field
        name="itemName">Bedroom1_LedStrip_State</field></block></value></block></statement></block></next></block></next></block></next></block></next></block></next></block></next></block></statement></block></xml>
      type: application/javascript
      script: >
        var aliceState, program, speed, state, color;


        var itemMetadata;


        // Describe this function...

        function wifi_led_effect(program, speed) {
          items.getItem('LedStrip_Bedroom1_Program_Speed').sendCommand(speed);
          items.getItem('LedStrip_Bedroom1_Program').sendCommand(program);
        }


        var thread = Java.type('java.lang.Thread')


        // Describe this function...

        function restore() {
          state = (items.metadata.getMetadata('Bedroom1_LedStrip_State', 'prev') !== null) ? (items.metadata.getMetadata('Bedroom1_LedStrip_State', 'prev').value) : 'undefined';
          color = (items.metadata.getMetadata('Bedroom1_LedStrip_RgbColor', 'prev') !== null) ? (items.metadata.getMetadata('Bedroom1_LedStrip_RgbColor', 'prev').value) : 'undefined';
          speed = (items.metadata.getMetadata('LedStrip_Bedroom1_Program_Speed', 'prev') !== null) ? (items.metadata.getMetadata('LedStrip_Bedroom1_Program_Speed', 'prev').value) : 'undefined';
          items.getItem('Bedroom1_LedStrip_RgbColor').sendCommand(color);
          items.getItem('LedStrip_Bedroom1_Program_Speed').sendCommand(speed);
          thread.sleep(100);
          if (items.getItem('goto_sleep').state == 'ON') {
            items.getItem('Bedroom1_LedStrip_State').sendCommand('OFF');
          } else {
            items.getItem('Bedroom1_LedStrip_State').sendCommand(state);
          }
        }



        aliceState = event.itemState.toString();

        if (aliceState == 'LISTENING' && event.oldItemState.toString() == 'IDLE') {
          console.info('Алиса начала слушать, сохраним предыдущие значения');
          state = items.getItem('Bedroom1_LedStrip_State').state;
          color = items.getItem('Bedroom1_LedStrip_RgbColor').state;
          speed = items.getItem('LedStrip_Bedroom1_Program_Speed').state;
          itemMetadata = items.metadata.getMetadata('Bedroom1_LedStrip_State', 'prev');
          itemMetadata = (itemMetadata === null) ? { value: '', configuration: {} } : itemMetadata;
          itemMetadata.value = state;
          items.metadata.replaceMetadata('Bedroom1_LedStrip_State', 'prev', itemMetadata.value, itemMetadata.configuration);
          itemMetadata = items.metadata.getMetadata('Bedroom1_LedStrip_RgbColor', 'prev');
          itemMetadata = (itemMetadata === null) ? { value: '', configuration: {} } : itemMetadata;
          itemMetadata.value = color;
          items.metadata.replaceMetadata('Bedroom1_LedStrip_RgbColor', 'prev', itemMetadata.value, itemMetadata.configuration);
          itemMetadata = items.metadata.getMetadata('LedStrip_Bedroom1_Program_Speed', 'prev');
          itemMetadata = (itemMetadata === null) ? { value: '', configuration: {} } : itemMetadata;
          itemMetadata.value = speed;
          items.metadata.replaceMetadata('LedStrip_Bedroom1_Program_Speed', 'prev', itemMetadata.value, itemMetadata.configuration);
        }

        if (aliceState == 'LISTENING') {
          console.info('🎧 Алиса сейча слушает ...');
          wifi_led_effect(43, 97);
        } else if (aliceState == 'SPEAKING') {
          console.info('📣 Алиса сейча говорит ...');
          wifi_led_effect(41, 92);
        } else if (aliceState == 'BUSY') {
          console.info('⏳ Алиса сейча занята ...');
          wifi_led_effect(38, 92);
        } else if (aliceState == 'IDLE') {
          console.info('💤 Алиса сейча ожидает ...');
          wifi_led_effect(97, 100);
          console.info('Алиса перестала говорить и слушать, восстанови значения');
          restore();
        }
    type: script.ScriptAction

⚠️ **GitHub.com Fallback** ⚠️