Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Datenpunkt schalten wenn Licht an oder aus ist

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Datenpunkt schalten wenn Licht an oder aus ist

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

      Hallo Leute,

      Ich habe das Problem das ich bestimmte Datenpunkte ein bzw ausschalten möchte wenn im Raum das Licht an oder ausgeschaltet wird. Die jeweilige Lampe soll die Alias ausführen wenn Sie z.B. im Script angestellt wird, aber genauso reagieren wenn ich über Alexa oder App die Lampe einschalte oder ausschalte.
      Bei meinem Script wird der Datenpunkt auch auf wahr geschaltet wenn das Licht angemacht wird, wenn ich es aber ausgeschalte bleibt der Datenpunkt auf true

      <block xmlns="https://developers.google.com/blockly/xml" type="controls_if" id=".;/-(1p()HG_H.gGO1`5" x="84" y="524">
        <mutation elseif="7"></mutation>
        <value name="IF0">
          <block type="logic_operation" id="[*5^hIbdB0#-BIG7h#5]" inline="false">
            <field name="OP">OR</field>
            <value name="A">
              <block type="logic_compare" id="/#C-gJ|}~/)8m=$:NUc0">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="e/]-.{m]=}Lc.u~e7IsM">
                    <field name="ATTR">val</field>
                    <field name="OID">alias.0.huehnerlampe.hühnerlampe</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="]o%9g+;V#j(bie;8:/Q0">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
            <value name="B">
              <block type="logic_compare" id="hZnfsLT=ZkPuyzi)mjB^">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="(Y}bICY.-]n,x#gK*s75">
                    <field name="ATTR">val</field>
                    <field name="OID">tuya.0.7716560384f3eb673e33.1</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="Jwp1!3_b05]@5T%PKLt%">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO0">
          <block type="control" id="f}2sVHUVIW4gC^+ZO1P+">
            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
            <field name="OID">0_userdata.0.Lampen.Hühnerlampe</field>
            <field name="WITH_DELAY">FALSE</field>
            <value name="VALUE">
              <block type="logic_boolean" id="59ZcUp@N1#Ni#HC*PVBs">
                <field name="BOOL">FALSE</field>
              </block>
            </value>
          </block>
        </statement>
        <value name="IF1">
          <block type="logic_operation" id="S5yvJRJ^V9sxn3g~ra^=" inline="false">
            <field name="OP">OR</field>
            <value name="A">
              <block type="logic_compare" id="JLd_j]V9HY{Tk6)|N7A+">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="8BkG,kN.#*P[?as6J?E4">
                    <field name="ATTR">val</field>
                    <field name="OID">hue.0.Sofalampe.on</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id=",X~1![jB]|C~{uVe1Qzq">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
            <value name="B">
              <block type="logic_compare" id="5EUtfwzq!Z.N]L7n9X}0">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="*UC2BADzM4E5#_fcW0Yw">
                    <field name="ATTR">val</field>
                    <field name="OID">alias.0.sofalampe.sofalampe</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="fqm.Y{?q--5r;ty+mVam">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO1">
          <block type="control" id="wchG(dd0s81;`gn(aeGx">
            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
            <field name="OID">0_userdata.0.Lampen.Sofalampe</field>
            <field name="WITH_DELAY">FALSE</field>
            <value name="VALUE">
              <block type="logic_boolean" id="/){KKhm/AnK]KsH(~(My">
                <field name="BOOL">FALSE</field>
              </block>
            </value>
          </block>
        </statement>
        <value name="IF2">
          <block type="logic_operation" id="-ESS~Hl=xc#hlQ|g*4j=" inline="false">
            <field name="OP">OR</field>
            <value name="A">
              <block type="logic_compare" id="V}|`/rFLl.{l3X%jj@{`">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="t4[PPYeY[=l=o4)m5g!m">
                    <field name="ATTR">val</field>
                    <field name="OID">alias.0.kinolampe.kinolampe</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="azw#m|}Yh1q|xTu#~q$,">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
            <value name="B">
              <block type="logic_compare" id="a:mZ,A,kT)7FTaVTLzw[">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="Bv/$CbkJN#^^TZ|5!swx">
                    <field name="ATTR">val</field>
                    <field name="OID">tuya.0.0757082684f3eb672f93.1</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="4z_uD`?0!EV8j9k8Mm#(">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO2">
          <block type="update" id="]-V:i6BIYmAkZjyJ4k./">
            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
            <field name="OID">0_userdata.0.Lampen.Kinolampe</field>
            <field name="WITH_DELAY">FALSE</field>
            <value name="VALUE">
              <block type="logic_boolean" id="v}C#R*rU^HKZS1Zp6j8J">
                <field name="BOOL">FALSE</field>
              </block>
            </value>
          </block>
        </statement>
        <value name="IF3">
          <block type="logic_operation" id="zs`nI:Dtx)X|F|92z~.2" inline="false">
            <field name="OP">OR</field>
            <value name="A">
              <block type="logic_compare" id="@Lrulg%%Nyy#7x@f0:J_">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="Ojlg?C(cS?1r!/7G{Pr^">
                    <field name="ATTR">val</field>
                    <field name="OID">hue.0.Zwischenbau.on</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="5W[BpcEah9!bLc)M})he">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
            <value name="B">
              <block type="logic_compare" id="sD6KoVbh[Q~(Awpac7l$">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="VVc2X=T)IGOk+~lxzEoP">
                    <field name="ATTR">val</field>
                    <field name="OID">hue.0.Zwischenbau.on</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="2[@zn/F-(w`WR@/ORqv)">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO3">
          <block type="update" id="D__37q2/yreH?+_8y~Vr">
            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
            <field name="OID">0_userdata.0.Lampen.Zwischenbau-Außenlampe</field>
            <field name="WITH_DELAY">FALSE</field>
            <value name="VALUE">
              <block type="logic_boolean" id=":/jDCoow^3x0WW$NT6@h">
                <field name="BOOL">FALSE</field>
              </block>
            </value>
          </block>
        </statement>
        <value name="IF4">
          <block type="logic_operation" id="hNuyp}5/w{MJhWF/3Rn~" inline="false">
            <field name="OP">OR</field>
            <value name="A">
              <block type="logic_compare" id="GE@LF)a]YrHvYe|3k5dP">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="U=_8j_8-i[+B;wk^Na+*">
                    <field name="ATTR">val</field>
                    <field name="OID">hue.0.Stalllampe.on</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="1]HC306|{#2mHmbmlRwt">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
            <value name="B">
              <block type="logic_compare" id="O%L=(EC0AGNopj@rre|u">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="^#H)NEtU=u!h*mYRqQzl">
                    <field name="ATTR">val</field>
                    <field name="OID">alias.0.Kuhstallung.Stalllampe</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="$|JW;w{Lrw?NVIhcN|ab">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO4">
          <block type="update" id="g3BG|!VahldwnH=8j8=B">
            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
            <field name="OID">0_userdata.0.Lampen.Stalllampe_Korridor_3</field>
            <field name="WITH_DELAY">FALSE</field>
            <value name="VALUE">
              <block type="logic_boolean" id="N!K[fPa{Y#X[qk.c}0Jz">
                <field name="BOOL">FALSE</field>
              </block>
            </value>
          </block>
        </statement>
        <value name="IF5">
          <block type="logic_operation" id="6%kIYAnU;BN@)H`=WEk{" inline="false">
            <field name="OP">OR</field>
            <value name="A">
              <block type="logic_compare" id="`2w0if$-7{uksikys)/q">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="I_:[!N9]tETKAwrcr)*9">
                    <field name="ATTR">val</field>
                    <field name="OID">hue.0.Kuhstall.on</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="^9xq3C6EZ~2xiw?ep(m)">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
            <value name="B">
              <block type="logic_compare" id="U[Ds$p2{piE|$_J34kYH">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="/~e}*_VKaYl2~/%A;06*">
                    <field name="ATTR">val</field>
                    <field name="OID">alias.0.stall .Kuhstall2</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="9OqrteQ)?SdZztn7fj9P">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO5">
          <block type="update" id="YMb^^Q:^%$e+WwM3}U{3">
            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
            <field name="OID">0_userdata.0.Lampen.Stalllampe_vorne_Korridor_1</field>
            <field name="WITH_DELAY">FALSE</field>
            <value name="VALUE">
              <block type="logic_boolean" id="WJYu1WcZ}Rg)?3*^E$U=">
                <field name="BOOL">FALSE</field>
              </block>
            </value>
          </block>
        </statement>
        <value name="IF6">
          <block type="logic_operation" id="~U^G7Xv[.~!p$XNXv4/%" inline="false">
            <field name="OP">OR</field>
            <value name="A">
              <block type="logic_compare" id="ii?gyBcZ;{WS)*/ga8N7">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="jlioGs=p#H!Ia6VivfAz">
                    <field name="ATTR">val</field>
                    <field name="OID">hue.0.Stall.on</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="}(s^~;!t3rPDC9]A+A(p">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
            <value name="B">
              <block type="logic_compare" id="r(|H9y],8^_l{9w{zA_a">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="s;g{0T=^%BYcG-Lf_8-3">
                    <field name="ATTR">val</field>
                    <field name="OID">alias.0.Kuhstall.Kuhlampe</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="6]l+[{esF)I-M~tyRp-4">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO6">
          <block type="update" id="ldsU+o@PBMq*}xi_x#Mf">
            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
            <field name="OID">0_userdata.0.Lampen.Stalllampe_hinten_Korridor_1</field>
            <field name="WITH_DELAY">FALSE</field>
            <value name="VALUE">
              <block type="logic_boolean" id="r2,k^.!uE3}g^Sfoh}Qb">
                <field name="BOOL">FALSE</field>
              </block>
            </value>
          </block>
        </statement>
        <value name="IF7">
          <block type="logic_operation" id=")Abi0KleOO/_UnT/njW$" inline="false">
            <field name="OP">OR</field>
            <value name="A">
              <block type="logic_compare" id="wIK},[0yLOQd}l[;j2R#">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="bnJ`|QK-}q]4G;cVM{71">
                    <field name="ATTR">val</field>
                    <field name="OID">alias.0.Aussenlampe.aussenlampe</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="@BD=l$B`nXM%~HzBlvXA">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
            <value name="B">
              <block type="logic_compare" id="4R13vWm;O`]#G5_Cy@%6">
                <field name="OP">EQ</field>
                <value name="A">
                  <block type="get_value" id="pm=~iW%jLB^yPcK:a9nG">
                    <field name="ATTR">val</field>
                    <field name="OID">tuya.0.0757082684f3eb6728db.1</field>
                  </block>
                </value>
                <value name="B">
                  <block type="logic_boolean" id="$x+S^Nnh8!0YNYw~8|F~">
                    <field name="BOOL">FALSE</field>
                  </block>
                </value>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO7">
          <block type="control" id="wCrj2L5y=9OI^/eQ0m{b">
            <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
            <field name="OID">0_userdata.0.Lampen.Aussenbeleuchtung</field>
            <field name="WITH_DELAY">FALSE</field>
            <value name="VALUE">
              <block type="logic_boolean" id="};U;_SR.J;8kf4CEWM2s">
                <field name="BOOL">FALSE</field>
              </block>
            </value>
          </block>
        </statement>
      </block>
      

      Vielen Dank für Eure Hilfe

      Screenshot 2023-10-20 160140.png
      Gruß
      Mico

      paul53 1 Reply Last reply Reply Quote 0
      • paul53
        paul53 @Mico last edited by paul53

        @mico sagte: ausgeschalte bleibt der Datenpunkt auf true

        Wenn auf "ist wahr" getriggert wird, kann nicht ausgeschaltet werden.
        Die Logik zum Ein- und Ausschalten erschließt sich mir nicht.
        Bringe nicht alles in einen Trigger, sondern nur die Sachen, die jeweils zusammen gehören.
        Wenn die Adapter-Datenpunkte alle einen Alias haben, verwendet man in Skripten nur den Alias. Eigene Datenpunkte unter "0_userdata.0" werden mit "aktualisiere" geschrieben.

        EDIT: Der Export enthält nur den Block zum Ausschalten.

        M 1 Reply Last reply Reply Quote 0
        • M
          Mico @paul53 last edited by

          @paul53
          Tschuldigung dann war das das falsche Bild ist alles auf wurde aktualiesiert.
          Du schreibst:

          Screenshot 2023-10-20 170227.png

          Wenn die Adapter-Datenpunkte alle einen Alias haben, verwendet man in Skripten nur den Alias. Eigene Datenpunkte unter "0_userdata.0" werden mit "aktualisiere" geschrieben

          Haben ja alle einen Alias nur wenn ich per Alexa oder per App das Licht schalte wird nicht der Alias geschaltet. Dann wird der Datenpunkt direkt geschaltet.
          Deswegen dieses Kudelmuddel sollte ich besser 2 Scripte erstellen einen mit allen Alias und den anderen mit den jeweiligen Datenpunkten für Alexa und Appsteuerung.

          Mit den eigenen Datenpunkten ändere ich alle auf aktualisieren ab.

          was ist mit export enthält nur den Block zum Ausschalten gemeint.

          Gruß
          Mico

          paul53 1 Reply Last reply Reply Quote 0
          • paul53
            paul53 @Mico last edited by paul53

            @mico sagte: was ist mit export enthält nur den Block zum Ausschalten gemeint.

            Der Export enthält nicht das gesamte Skript, sondern nur den unteren falls-Block.

            Blockly_temp.JPG

            @mico sagte in Datenpunkt schalten wenn Licht an oder aus ist:

            wenn ich per Alexa oder per App das Licht schalte wird nicht der Alias geschaltet.

            Ein Alias nimmt immer den gleichen Zustand an wie der Original-Datenpunkt - egal, wodurch der Original-Datenpunkt verändert wird.
            Wozu dienen die eigenen Datenpunkte unter "0_userdata.0"? Sind sie trotz Alias nötig?

            M 1 Reply Last reply Reply Quote 0
            • M
              Mico @paul53 last edited by

              Ja die sollen dann andere Sachen schalten über Scripte wenn das Licht eingeschaltet wird; im Kuhstall z.B. Melkstand usw.

              Das Script besteht nur aus dem Falls Block falls Licht an aktualisiere den entsprechenden Datenpunkt so habe ich einfach gedacht.
              Ich wollte erst mit einem prüfe Licht ob wahr oder flasch Baustein das Script erstellen. Aber so kann ich keinen Datenpunkt aktualisieren weil es dort nicht andockt.

              Gruß
              Mico

              paul53 1 Reply Last reply Reply Quote 0
              • paul53
                paul53 @Mico last edited by paul53

                @mico sagte: die sollen dann andere Sachen schalten über Scripte wenn das Licht eingeschaltet wird;

                Weshalb können das nicht die Alias-DP? Die DP unter "0_userdata.0" sind unnötig, wenn sie nur den einzelnen Licht-Wert abbilden.

                Übrigens macht man es mit 8 Einzel-Triggern, was enorm Ressourcen spart:

                Blockly_temp.JPG

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

                Support us

                ioBroker
                Community Adapters
                Donate

                699
                Online

                31.7k
                Users

                79.8k
                Topics

                1.3m
                Posts

                2
                6
                203
                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