Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. [VORLAGE] Philips HUE - Benachrichtigung bei Lampen Ausfall

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    [VORLAGE] Philips HUE - Benachrichtigung bei Lampen Ausfall

    This topic has been deleted. Only users with topic management privileges can see it.
    • Spegeli
      Spegeli last edited by

      Servus liebe Community,
      ich habe hier ein kleines Blocky Script für euch was all eure Philips HUE Lampen überwacht und sobald eine oder mehrere Lampen nicht mehr erreichbar sind weil Defekt oder durch Kompletten Strom Verlust, wird man per WhatsApp Benachrichtigt.

      WICHTIG: Es benachrichtigt euch nicht wenn die Lampen nur Ausgeschaltet werden, sondern wirklich nur wenn diese gar nicht mehr Erreichbar sind.

      Unbenannt.png

      <xml xmlns="https://developers.google.com/blockly/xml">
        <variables>
          <variable id="EX]LYsG8PM_-@gtsLI3z">x</variable>
          <variable id="a_L0Hey%qu{Z|Pq|*6(m">disableTrigger</variable>
          <variable type="timeout" id="timeout">timeout</variable>
          <variable id="FO2pipHT}g7wO)`0c_N]">list</variable>
          <variable id="[Gbxk;.a[5i*y(D^f1qv">id</variable>
        </variables>
        <block type="on_ext" id="*,7?x)AnJ%#(Q4@ZQRrm" x="-2287" y="-637">
          <mutation xmlns="http://www.w3.org/1999/xhtml" items="1"></mutation>
          <field name="CONDITION">ne</field>
          <field name="ACK_CONDITION"></field>
          <value name="OID0">
            <shadow type="field_oid" id="ZkksXP[i]R_DJ}gNR(04">
              <field name="oid">hue-extended.0.lights.004-hue_ambiance_spot_1.state.reachable</field>
            </shadow>
            <block type="selector" id="odgvIVTBF{`?9#a6y_E%">
              <field name="TEXT">[state.id=hue-extended.0.lights.*.state.reachable]</field>
            </block>
          </value>
          <statement name="STATEMENT">
            <block type="controls_if" id="2yUjv71uC`~T1c~lk$,q">
              <value name="IF0">
                <block type="logic_negate" id="n?q;1Tyg`|B}Y#UNe,.8">
                  <value name="BOOL">
                    <block type="variables_get" id="nx-C$-8qv7#/|x97b.}v">
                      <field name="VAR" id="a_L0Hey%qu{Z|Pq|*6(m">disableTrigger</field>
                    </block>
                  </value>
                </block>
              </value>
              <statement name="DO0">
                <block type="variables_set" id="a?KyY`?1q;;`Zqni9]VQ">
                  <field name="VAR" id="a_L0Hey%qu{Z|Pq|*6(m">disableTrigger</field>
                  <value name="VALUE">
                    <block type="logic_boolean" id="[)5WeD;7}1cA9^$nLk3@">
                      <field name="BOOL">TRUE</field>
                    </block>
                  </value>
                  <next>
                    <block type="timeouts_settimeout" id="sm5uLDQ*iP}{m6MQ+!hM">
                      <field name="NAME">timeout</field>
                      <field name="DELAY">30</field>
                      <field name="UNIT">sec</field>
                      <statement name="STATEMENT">
                        <block type="variables_set" id="=~M$eg/mq)6fysd;+1h3">
                          <field name="VAR" id="FO2pipHT}g7wO)`0c_N]">list</field>
                          <value name="VALUE">
                            <block type="text" id="XEXUpvb9i%[L0VNSUZ+P">
                              <field name="TEXT"></field>
                            </block>
                          </value>
                          <next>
                            <block type="controls_forEach" id="QmD8=Y]w/:P2#FL7xy}3">
                              <field name="VAR" id="[Gbxk;.a[5i*y(D^f1qv">id</field>
                              <value name="LIST">
                                <block type="selector" id="tU7,q~v)!JL?b*cFWeSt">
                                  <field name="TEXT">hue-extended.0.lights.*.state.reachable</field>
                                </block>
                              </value>
                              <statement name="DO">
                                <block type="controls_if" id="J5+R{~PD1[%6NM{!s7~{">
                                  <value name="IF0">
                                    <block type="logic_negate" id="%XT]H@nD[(Sx`d;dVk}w">
                                      <value name="BOOL">
                                        <block type="get_value_var" id="d0=U:1JB`ancP)Y0_Nn$">
                                          <field name="ATTR">val</field>
                                          <value name="OID">
                                            <shadow type="text" id="m:Dv;`Jh9=4;E`f$0a:(">
                                              <field name="TEXT"></field>
                                            </shadow>
                                            <block type="variables_get" id="U1:-%iJ;+38UgV`OTm7R">
                                              <field name="VAR" id="[Gbxk;.a[5i*y(D^f1qv">id</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <statement name="DO0">
                                    <block type="text_append" id="P{`mX$LV8Z+/.2cB,htY">
                                      <field name="VAR" id="FO2pipHT}g7wO)`0c_N]">list</field>
                                      <value name="TEXT">
                                        <shadow type="text" id="Qv`!(-J;y@H}Y|y.b`dM">
                                          <field name="TEXT"></field>
                                        </shadow>
                                        <block type="text_join" id="U;:=cU5jfzKvzc-GGsng">
                                          <mutation items="2"></mutation>
                                          <value name="ADD0">
                                            <block type="procedures_callcustomreturn" id="yk3au;E5vTU~YH#URT?`">
                                              <mutation name="deviceName">
                                                <arg name="x"></arg>
                                              </mutation>
                                              <value name="ARG0">
                                                <block type="variables_get" id="vMAS51O[Cxng0gz0d.Q+">
                                                  <field name="VAR" id="[Gbxk;.a[5i*y(D^f1qv">id</field>
                                                </block>
                                              </value>
                                            </block>
                                          </value>
                                          <value name="ADD1">
                                            <block type="text_newline" id="u8cH`W-q2$7EJFEOBlrv">
                                              <field name="Type">\n</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                    </block>
                                  </statement>
                                </block>
                              </statement>
                              <next>
                                <block type="controls_if" id="7+27pFM.tHyvUXT=MJIr">
                                  <value name="IF0">
                                    <block type="logic_compare" id="|va{t${+vLfjx{UE+N@t">
                                      <field name="OP">EQ</field>
                                      <value name="A">
                                        <block type="lists_isEmpty" id="]2AuOSn6hN)vxo$:q0Gz">
                                          <value name="VALUE">
                                            <block type="variables_get" id="U)vPzD5tE?0S5:dk$fdT">
                                              <field name="VAR" id="FO2pipHT}g7wO)`0c_N]">list</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <value name="B">
                                        <block type="logic_boolean" id="ScaQ{J%*2|Ex:/jrz%8K">
                                          <field name="BOOL">FALSE</field>
                                        </block>
                                      </value>
                                    </block>
                                  </value>
                                  <statement name="DO0">
                                    <block type="whatsapp-cmb" id="od#*JdVo*`GMTn9rQZmx">
                                      <field name="INSTANCE"></field>
                                      <field name="LOG"></field>
                                      <value name="MESSAGE">
                                        <shadow type="text" id="zpZNP~2/-+A%!O~/h,,g">
                                          <field name="TEXT">text</field>
                                        </shadow>
                                        <block type="text_join" id="MA-uFEVdUEBD=m2-tD@J">
                                          <mutation items="3"></mutation>
                                          <value name="ADD0">
                                            <block type="text" id="pi:fnC7TP41BB:jMx)tJ">
                                              <field name="TEXT">Es gehen folgende Lampen nicht: </field>
                                            </block>
                                          </value>
                                          <value name="ADD1">
                                            <block type="text_newline" id="JhUPg;fo_6Tya)]}s^bd">
                                              <field name="Type">\n</field>
                                            </block>
                                          </value>
                                          <value name="ADD2">
                                            <block type="variables_get" id="E=JmHVgN]0Wk;?qZowG.">
                                              <field name="VAR" id="FO2pipHT}g7wO)`0c_N]">list</field>
                                            </block>
                                          </value>
                                        </block>
                                      </value>
                                      <next>
                                        <block type="variables_set" id="3Dd@?o}(bZT15WZ*nQ$v">
                                          <field name="VAR" id="a_L0Hey%qu{Z|Pq|*6(m">disableTrigger</field>
                                          <value name="VALUE">
                                            <block type="logic_boolean" id="@@{in4Ky`go,Sw^5UAJg">
                                              <field name="BOOL">FALSE</field>
                                            </block>
                                          </value>
                                        </block>
                                      </next>
                                    </block>
                                  </statement>
                                </block>
                              </next>
                            </block>
                          </next>
                        </block>
                      </statement>
                    </block>
                  </next>
                </block>
              </statement>
            </block>
          </statement>
        </block>
        <block type="procedures_defcustomreturn" id="N[:/N@x2QXRmdKeh;k2w" x="-1462" y="-313">
          <mutation statements="false">
            <arg name="x" varid="EX]LYsG8PM_-@gtsLI3z"></arg>
          </mutation>
          <field name="NAME">deviceName</field>
          <field name="SCRIPT">aWQgPSBpZC5zdWJzdHJpbmcoMCwgaWQubGFzdEluZGV4T2YoJy4nKSk7DQppZCA9IGlkLnN1YnN0cmluZygwLCBpZC5sYXN0SW5kZXhPZignLicpKTsNCmlmKGV4aXN0c09iamVjdChpZCkgJiYgZ2V0T2JqZWN0KGlkKS50eXBlID09ICdjaGFubmVsJykgcmV0dXJuIGdldE9iamVjdChpZCkuY29tbW9uLm5hbWU7</field>
          <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
        </block>
      </xml>
      

      Hier noch der JS Code:

      id = id.substring(0, id.lastIndexOf('.'));
      id = id.substring(0, id.lastIndexOf('.'));
      if(existsObject(id) && getObject(id).type == 'channel') return getObject(id).common.name;
      

      Für die Kommunikation wird in diesem Script der HUE-Extend Adapter benutzt.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      Support us

      ioBroker
      Community Adapters
      Donate

      407
      Online

      31.9k
      Users

      80.1k
      Topics

      1.3m
      Posts

      1
      1
      297
      Loading More Posts
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      Community
      Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
      The ioBroker Community 2014-2023
      logo