Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. Blockly
  5. Alexa2 'powerstate' mit Sprachbefehlen synchronisieren

NEWS

  • Monatsrückblick Januar/Februar 2026 ist online!
    BluefoxB
    Bluefox
    16
    1
    248

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    17
    1
    4.6k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    1.3k

Alexa2 'powerstate' mit Sprachbefehlen synchronisieren

Scheduled Pinned Locked Moved Blockly
1 Posts 1 Posters 181 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • padrinoP Online
    padrinoP Online
    padrino
    Most Active
    wrote on last edited by padrino
    #1

    Wenn ich Geräte ganz ursprünglich, per Sprache :innocent:, schalte, dann wird deren Zustand ja leider nicht im Alexa2 Adapter aktuell gehalten (es fehlt das Feedback von amazon, wenn ich nicht irre :thinking_face:), also habe ich mich mal an einem Blockly versucht, das dies für mich tun sollte.
    Achtung, die Version ist 0.1, d.h. sie funktioniert zwar (soweit ich das bisher beurteilen kann :relieved:), bietet aber keinerlei Komfort, etc. (so wird die Liste nur in eine Variable geschrieben, statt dauerhaft in einen Datenpunkt, legt man neue Geräte an, muss die Liste manuell, durch Skriptstart, neu erzeugt werden, etc....).
    Aber es funktioniert, und wer es luxuriöser mag, der kann ja selbst Hand anlegen - oder warten, bis mich mal die Muse wieder küsst... :sunglasses:

    Ein Dank an @paul53, denn ich verwende seinen Code in der Funktion um an den Gerätenamen zu kommen. :nerd_face:

    Das Blockly sieht so aus (den Code findet im Spoiler :point_down:)...
    intro.PNG
    code.PNG

    <xml xmlns="https://developers.google.com/blockly/xml">
      <variables>
        <variable id="+-WTP]TT#CR{EppNbw!p">id</variable>
        <variable id=",ALhi|paAokGs|ZIPG`y">Liste</variable>
        <variable id="lmE25(rRtf0#2Yq=icQ7">deviceName</variable>
        <variable id="%Gcx.{z6G{RQtt{-]|ED">strippedLast</variable>
        <variable id="e=rp$%p%-AxArJb`]=Yr">deviceID</variable>
      </variables>
      <block type="comment" id="lCc{$Ue^.:vB0ZIR+J.m" x="-362" y="-137">
        <field name="COMMENT">$VER: SyncAlexa2ioBroker 0.1 (12.04.2022) by padrino</field>
      </block>
      <block type="procedures_defcustomreturn" id="P~MN/[XcQ;`C+mMo~KDh" x="-362" y="-87">
        <mutation statements="false">
          <arg name="id" varid="+-WTP]TT#CR{EppNbw!p"></arg>
        </mutation>
        <field name="NAME">parentName</field>
        <field name="SCRIPT">aWQgPSBpZC5zdWJzdHJpbmcoMCwgaWQubGFzdEluZGV4T2YoJy4nKSk7DQppZihleGlzdHNPYmplY3QoaWQpKSByZXR1cm4gZ2V0T2JqZWN0KGlkKS5jb21tb24ubmFtZTs=</field>
        <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
      </block>
      <block type="variables_set" id="0@bI7Lgbt[#MI8pzTbDd" x="-363" y="-37">
        <field name="VAR" id=",ALhi|paAokGs|ZIPG`y">Liste</field>
        <value name="VALUE">
          <block type="lists_create_with" id="eKVi@NMpA:=T0HknO9G6">
            <mutation items="0"></mutation>
          </block>
        </value>
        <next>
          <block type="controls_forEach" id="#z?*$3r[^U03f]4K?2oi">
            <field name="VAR" id="+-WTP]TT#CR{EppNbw!p">id</field>
            <value name="LIST">
              <block type="selector" id="6C=fB:fYGnfC,#,`Y.=G">
                <field name="TEXT">alexa2.0.Smart-Home-Devices.*.#enabled</field>
              </block>
            </value>
            <statement name="DO">
              <block type="variables_set" id=",^f,Rl3WKrqM|zu`rknw">
                <field name="VAR" id="lmE25(rRtf0#2Yq=icQ7">deviceName</field>
                <value name="VALUE">
                  <block type="procedures_callcustomreturn" id="vS1z6_qzWVQ5]p+`UVs`">
                    <mutation name="parentName">
                      <arg name="id"></arg>
                    </mutation>
                    <value name="ARG0">
                      <block type="variables_get" id="lf./Bzdw|6%SAq(}pMx-">
                        <field name="VAR" id="+-WTP]TT#CR{EppNbw!p">id</field>
                      </block>
                    </value>
                  </block>
                </value>
                <next>
                  <block type="lists_setIndex" id="/UhvJ(u.#4*Ez:]uLWI+">
                    <mutation at="false"></mutation>
                    <field name="MODE">INSERT</field>
                    <field name="WHERE">LAST</field>
                    <value name="LIST">
                      <block type="variables_get" id="@K7iVV@JM1DS+DHtAo@W">
                        <field name="VAR" id=",ALhi|paAokGs|ZIPG`y">Liste</field>
                      </block>
                    </value>
                    <value name="TO">
                      <block type="text_changeCase" id="UAp9YlrIiwN:FEJe`%/O">
                        <field name="CASE">LOWERCASE</field>
                        <value name="TEXT">
                          <shadow type="text" id="MOeo2X=p)shLsCOysU7b">
                            <field name="TEXT">abc</field>
                          </shadow>
                          <block type="variables_get" id="UbQT#Z,B+8oxXs2U,79N">
                            <field name="VAR" id="lmE25(rRtf0#2Yq=icQ7">deviceName</field>
                          </block>
                        </value>
                      </block>
                    </value>
                    <next>
                      <block type="variables_set" id="H_YUsbFjsxDTvBT:7F}A">
                        <field name="VAR" id="%Gcx.{z6G{RQtt{-]|ED">strippedLast</field>
                        <value name="VALUE">
                          <block type="text_getSubstring" id="Pu)E+[H%BTl3IEiikRc5" inline="false">
                            <mutation at1="false" at2="true"></mutation>
                            <field name="WHERE1">FIRST</field>
                            <field name="WHERE2">FROM_START</field>
                            <value name="STRING">
                              <block type="variables_get" id="8vDvA9bRVDC%_Os)-QEl">
                                <field name="VAR" id="+-WTP]TT#CR{EppNbw!p">id</field>
                              </block>
                            </value>
                            <value name="AT2">
                              <block type="math_arithmetic" id="Vj9[fBYr4!#qIqUpQTZI">
                                <field name="OP">MINUS</field>
                                <value name="A">
                                  <shadow type="math_number">
                                    <field name="NUM">1</field>
                                  </shadow>
                                  <block type="text_indexOf" id="x}11_V_NWIV[cID7Lss#">
                                    <field name="END">LAST</field>
                                    <value name="VALUE">
                                      <block type="variables_get" id="{h71Sou!JVs7+In#Z5Eu">
                                        <field name="VAR" id="+-WTP]TT#CR{EppNbw!p">id</field>
                                      </block>
                                    </value>
                                    <value name="FIND">
                                      <shadow type="text" id=")`%$O9)gcC_ZCO;wD3bv">
                                        <field name="TEXT">.</field>
                                      </shadow>
                                    </value>
                                  </block>
                                </value>
                                <value name="B">
                                  <shadow type="math_number" id="g65+2L#|[EV@dafq2,du">
                                    <field name="NUM">1</field>
                                  </shadow>
                                </value>
                              </block>
                            </value>
                          </block>
                        </value>
                        <next>
                          <block type="variables_set" id="*SJkJIbG0}p+zRJrQ;zy">
                            <field name="VAR" id="e=rp$%p%-AxArJb`]=Yr">deviceID</field>
                            <value name="VALUE">
                              <block type="text_getSubstring" id="Up5@4JfW(Og:ykQZ[T,z" inline="false">
                                <mutation at1="true" at2="false"></mutation>
                                <field name="WHERE1">FROM_START</field>
                                <field name="WHERE2">LAST</field>
                                <value name="STRING">
                                  <block type="variables_get" id="Ejx]Ezg1BnI(tPC0jW`$">
                                    <field name="VAR" id="%Gcx.{z6G{RQtt{-]|ED">strippedLast</field>
                                  </block>
                                </value>
                                <value name="AT1">
                                  <block type="math_arithmetic" id="6-[wj3|qfm;dxa*!:GDE">
                                    <field name="OP">ADD</field>
                                    <value name="A">
                                      <shadow type="math_number">
                                        <field name="NUM">1</field>
                                      </shadow>
                                      <block type="text_indexOf" id="D4O7@[|-Ms2k{tHo1P*[">
                                        <field name="END">LAST</field>
                                        <value name="VALUE">
                                          <block type="variables_get" id="ZTDVz]ox,@Q3/T={g#:v">
                                            <field name="VAR" id="%Gcx.{z6G{RQtt{-]|ED">strippedLast</field>
                                          </block>
                                        </value>
                                        <value name="FIND">
                                          <shadow type="text" id="-Tlu7XP7nP^unjzQp2b@">
                                            <field name="TEXT">.</field>
                                          </shadow>
                                        </value>
                                      </block>
                                    </value>
                                    <value name="B">
                                      <shadow type="math_number" id="rJJ{i0hC|rJ?HFnf6a?V">
                                        <field name="NUM">1</field>
                                      </shadow>
                                    </value>
                                  </block>
                                </value>
                              </block>
                            </value>
                            <next>
                              <block type="lists_setIndex" id="u(y?6=X[K%bY]ljDb]OU">
                                <mutation at="false"></mutation>
                                <field name="MODE">INSERT</field>
                                <field name="WHERE">LAST</field>
                                <value name="LIST">
                                  <block type="variables_get" id="0~xcuQ(w}3B2d^qdSYVF">
                                    <field name="VAR" id=",ALhi|paAokGs|ZIPG`y">Liste</field>
                                  </block>
                                </value>
                                <value name="TO">
                                  <block type="variables_get" id="YK0!,]wT/@Sw~39N=T.6">
                                    <field name="VAR" id="e=rp$%p%-AxArJb`]=Yr">deviceID</field>
                                  </block>
                                </value>
                              </block>
                            </next>
                          </block>
                        </next>
                      </block>
                    </next>
                  </block>
                </next>
              </block>
            </statement>
            <next>
              <block type="on" id="lA:h##}{q,3O{BJMtvGP">
                <field name="OID">alexa2.0.History.summary</field>
                <field name="CONDITION">ne</field>
                <field name="ACK_CONDITION"></field>
                <statement name="STATEMENT">
                  <block type="controls_if" id="XZm^!jGTG^I55h~|ejSS">
                    <value name="IF0">
                      <block type="logic_operation" id=";Pk:Kn$r-BNp,%1*MeR`" inline="false">
                        <field name="OP">OR</field>
                        <value name="A">
                          <block type="logic_compare" id="i60!4l/Vm~(Pu0nLz08P">
                            <field name="OP">GT</field>
                            <value name="A">
                              <block type="text_indexOf" id="x[jg{U=xx3-A85SJf~_q">
                                <field name="END">FIRST</field>
                                <value name="VALUE">
                                  <block type="on_source" id="T%AhOD}^_PRB-yv#RdI3">
                                    <field name="ATTR">state.val</field>
                                  </block>
                                </value>
                                <value name="FIND">
                                  <shadow type="text" id="^a6YSXG)W:n.SZ=JP47G">
                                    <field name="TEXT"> aus</field>
                                  </shadow>
                                </value>
                              </block>
                            </value>
                            <value name="B">
                              <block type="math_number" id="l)-Cqouuur2YlHoiKDQQ">
                                <field name="NUM">0</field>
                              </block>
                            </value>
                          </block>
                        </value>
                        <value name="B">
                          <block type="logic_operation" id="mL^d_70[HEp,*q6FI5o^" inline="false">
                            <field name="OP">OR</field>
                            <value name="A">
                              <block type="logic_compare" id="Kfz8xr^V)r[$DZEiY;2f">
                                <field name="OP">GT</field>
                                <value name="A">
                                  <block type="text_indexOf" id="n!L`[R#V:f~JnRYds6L2">
                                    <field name="END">FIRST</field>
                                    <value name="VALUE">
                                      <block type="on_source" id="ACR3p+K*o/eY_TsXJhNR">
                                        <field name="ATTR">state.val</field>
                                      </block>
                                    </value>
                                    <value name="FIND">
                                      <shadow type="text" id=";$V%~f]7lzS`|;~tWv9%">
                                        <field name="TEXT"> an</field>
                                      </shadow>
                                    </value>
                                  </block>
                                </value>
                                <value name="B">
                                  <block type="math_number" id=".hb.UgD*`nBMa#Z15aCr">
                                    <field name="NUM">0</field>
                                  </block>
                                </value>
                              </block>
                            </value>
                            <value name="B">
                              <block type="logic_compare" id="I(@z|%`Rj{DK+uxubVG!">
                                <field name="OP">GT</field>
                                <value name="A">
                                  <block type="text_indexOf" id="N=`@4,+Ygh+K{w/(Q7~F">
                                    <field name="END">FIRST</field>
                                    <value name="VALUE">
                                      <block type="on_source" id="zFe}gFh#RDSM/s0_K`kN">
                                        <field name="ATTR">state.val</field>
                                      </block>
                                    </value>
                                    <value name="FIND">
                                      <shadow type="text" id="U]k(5`yak,`F30o4eb0?">
                                        <field name="TEXT"> auf</field>
                                      </shadow>
                                    </value>
                                  </block>
                                </value>
                                <value name="B">
                                  <block type="math_number" id="QQn^u3}*7ruI1`Oh2uDs">
                                    <field name="NUM">0</field>
                                  </block>
                                </value>
                              </block>
                            </value>
                          </block>
                        </value>
                      </block>
                    </value>
                    <statement name="DO0">
                      <block type="variables_set" id="Ykhc|IwuZE6k}sp]r=v:">
                        <field name="VAR" id="lmE25(rRtf0#2Yq=icQ7">deviceName</field>
                        <value name="VALUE">
                          <block type="text_getSubstring" id="Kc,s1;*#zRbNh6z)AOU{">
                            <mutation at1="false" at2="true"></mutation>
                            <field name="WHERE1">FIRST</field>
                            <field name="WHERE2">FROM_START</field>
                            <value name="STRING">
                              <block type="on_source" id="AQ~Lw$9E7kxdR70rnEJe">
                                <field name="ATTR">state.val</field>
                              </block>
                            </value>
                            <value name="AT2">
                              <block type="math_arithmetic" id="KY|CRk0CdV%xMzx2||ha">
                                <field name="OP">MINUS</field>
                                <value name="A">
                                  <shadow type="math_number" id="NxbRf(BueLrK@|7BGHxo">
                                    <field name="NUM">1</field>
                                  </shadow>
                                  <block type="text_indexOf" id="vE^yX2tPQOLl~%)g12`i">
                                    <field name="END">FIRST</field>
                                    <value name="VALUE">
                                      <block type="on_source" id="DD^,g59n9eX0H]5|wZc4">
                                        <field name="ATTR">state.val</field>
                                      </block>
                                    </value>
                                    <value name="FIND">
                                      <shadow type="text" id="[%OyZP^^`mC4(9pQ[=r6">
                                        <field name="TEXT"> </field>
                                      </shadow>
                                    </value>
                                  </block>
                                </value>
                                <value name="B">
                                  <shadow type="math_number" id="Fz-fc}(OZ%orzgQTlYxM">
                                    <field name="NUM">1</field>
                                  </shadow>
                                </value>
                              </block>
                            </value>
                          </block>
                        </value>
                        <next>
                          <block type="controls_if" id="l{I(X)nG{~/UC00iixd*">
                            <value name="IF0">
                              <block type="logic_compare" id="P^cr4NM:BdWPrflV~5wh">
                                <field name="OP">GT</field>
                                <value name="A">
                                  <block type="lists_indexOf" id="U?b%E6h1lu|jpqJJGtc~">
                                    <field name="END">FIRST</field>
                                    <value name="VALUE">
                                      <block type="variables_get" id="{woL!Om].b)]~,EU1RS-">
                                        <field name="VAR" id=",ALhi|paAokGs|ZIPG`y">Liste</field>
                                      </block>
                                    </value>
                                    <value name="FIND">
                                      <block type="variables_get" id="^Ks|=fl4hP,,XZSY%S8|">
                                        <field name="VAR" id="lmE25(rRtf0#2Yq=icQ7">deviceName</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                                <value name="B">
                                  <block type="math_number" id="n%{XqX_FN#67YLSx4$kj">
                                    <field name="NUM">0</field>
                                  </block>
                                </value>
                              </block>
                            </value>
                            <statement name="DO0">
                              <block type="control_ex" id="~-muT*(`s%LIZ(pt85K*">
                                <field name="TYPE">true</field>
                                <field name="CLEAR_RUNNING">FALSE</field>
                                <value name="OID">
                                  <shadow type="field_oid" id="Op7O=@UW-N?BHV)cw~DQ">
                                    <field name="oid">Object ID</field>
                                  </shadow>
                                  <block type="text_join" id="qxBbpGkXALBY$C_sRQ0s">
                                    <mutation items="3"></mutation>
                                    <value name="ADD0">
                                      <block type="text" id="r6WGEc9Q}Hc.*X!s/Xee">
                                        <field name="TEXT">alexa2.0.Smart-Home-Devices.</field>
                                      </block>
                                    </value>
                                    <value name="ADD1">
                                      <block type="lists_getIndex" id="G~VAD6d0fdSziqi5m+@[" inline="false">
                                        <mutation statement="false" at="true"></mutation>
                                        <field name="MODE">GET</field>
                                        <field name="WHERE">FROM_START</field>
                                        <value name="VALUE">
                                          <block type="variables_get" id="#PW!-1NhucNVq`!{_^tq">
                                            <field name="VAR" id=",ALhi|paAokGs|ZIPG`y">Liste</field>
                                          </block>
                                        </value>
                                        <value name="AT">
                                          <block type="math_arithmetic" id="r5.=k)F_J((:kLQk4~2/" inline="false">
                                            <field name="OP">ADD</field>
                                            <value name="A">
                                              <shadow type="math_number" id="v})@L=nw{rhx1vb`~PrO">
                                                <field name="NUM">1</field>
                                              </shadow>
                                              <block type="lists_indexOf" id="wp(5!JnlEFd#wRL{VaE*">
                                                <field name="END">FIRST</field>
                                                <value name="VALUE">
                                                  <block type="variables_get" id="I[/74||dvM;uFcW]_-f-">
                                                    <field name="VAR" id=",ALhi|paAokGs|ZIPG`y">Liste</field>
                                                  </block>
                                                </value>
                                                <value name="FIND">
                                                  <block type="variables_get" id="o%P7jm,B?FE+Y5Mx)m1s">
                                                    <field name="VAR" id="lmE25(rRtf0#2Yq=icQ7">deviceName</field>
                                                  </block>
                                                </value>
                                              </block>
                                            </value>
                                            <value name="B">
                                              <shadow type="math_number" id="RTeZ!%`hjsLW40t]](zC">
                                                <field name="NUM">1</field>
                                              </shadow>
                                            </value>
                                          </block>
                                        </value>
                                      </block>
                                    </value>
                                    <value name="ADD2">
                                      <block type="text" id="D@McR5jrAB?|BIslz5Qh">
                                        <field name="TEXT">.powerState</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                                <value name="VALUE">
                                  <shadow type="logic_boolean" id="$k}N?yCxexDCm`x9bXTk">
                                    <field name="BOOL">TRUE</field>
                                  </shadow>
                                  <block type="logic_ternary" id="D*+y#I;@x.xx*,90lz^[">
                                    <value name="IF">
                                      <block type="logic_operation" id="#f0|oTDyI.}wS;mF.gIb" inline="false">
                                        <field name="OP">OR</field>
                                        <value name="A">
                                          <block type="logic_compare" id="!JeF3Tr/NxMmn`=7%J{8">
                                            <field name="OP">GT</field>
                                            <value name="A">
                                              <block type="text_indexOf" id="*v-A^)3PUhwMc)jK!4sw">
                                                <field name="END">FIRST</field>
                                                <value name="VALUE">
                                                  <block type="on_source" id="QXE_Au_1{l7aVVaY8wu}">
                                                    <field name="ATTR">state.val</field>
                                                  </block>
                                                </value>
                                                <value name="FIND">
                                                  <shadow type="text" id=";{e*ej_DBXaqFqMVKQWo">
                                                    <field name="TEXT"> an</field>
                                                  </shadow>
                                                </value>
                                              </block>
                                            </value>
                                            <value name="B">
                                              <block type="math_number" id="k_Nj-93-j8--:j)hM.qm">
                                                <field name="NUM">0</field>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                        <value name="B">
                                          <block type="logic_compare" id="c7;gHM2-I7v+lC`Py(W;">
                                            <field name="OP">GT</field>
                                            <value name="A">
                                              <block type="text_indexOf" id="XmOu]~kLS*,](W?e6`bs">
                                                <field name="END">FIRST</field>
                                                <value name="VALUE">
                                                  <block type="on_source" id="^xxsz`8HT[X9by{uCB;h">
                                                    <field name="ATTR">state.val</field>
                                                  </block>
                                                </value>
                                                <value name="FIND">
                                                  <shadow type="text" id="[i7fSdE-C(Q%[~dHt}(l">
                                                    <field name="TEXT"> auf</field>
                                                  </shadow>
                                                </value>
                                              </block>
                                            </value>
                                            <value name="B">
                                              <block type="math_number" id="6l(`+%{7IC!XR27wJN^R">
                                                <field name="NUM">0</field>
                                              </block>
                                            </value>
                                          </block>
                                        </value>
                                      </block>
                                    </value>
                                    <value name="THEN">
                                      <block type="logic_boolean" id="r(yWLH6mNe|FQ?zB1Jt)">
                                        <field name="BOOL">TRUE</field>
                                      </block>
                                    </value>
                                    <value name="ELSE">
                                      <block type="logic_boolean" id="qShlmznW@Wf5V`[P9?%|">
                                        <field name="BOOL">FALSE</field>
                                      </block>
                                    </value>
                                  </block>
                                </value>
                                <value name="DELAY_MS">
                                  <shadow type="math_number" id="gyaRFO)nE*?d=Urx)b6*">
                                    <field name="NUM">0</field>
                                  </shadow>
                                </value>
                              </block>
                            </statement>
                          </block>
                        </next>
                      </block>
                    </statement>
                  </block>
                </statement>
              </block>
            </next>
          </block>
        </next>
      </block>
    </xml>
    

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    Support us

    ioBroker
    Community Adapters
    Donate

    300

    Online

    32.7k

    Users

    82.5k

    Topics

    1.3m

    Posts
    Community
    Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
    ioBroker Community 2014-2025
    logo
    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Home
    • Recent
    • Tags
    • Unread 0
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe