Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. [gelöst] On Anweisung (bitte Nachhilfe)

    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

    [gelöst] On Anweisung (bitte Nachhilfe)

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

      ich habe ein Script, welches gut funktioniert. Darin steht folgende On Anweisung:

      on(idAnsage1, function(dp) {
         if(dp.state.val) {
      

      Nun möchte ich das Script erweitern und es auslösen, wenn entweder idAnsage1 oder idAnsage2 wahr ist. Das habe ich versucht mit folgender Anweisung:

      on(idAnsage1 || dAnsage2 , function(dp) {
         if(dp.state.val) {
      

      Das funktioniert aber nicht. Was mache ich falsch?

      Danke für Eure Hilfe.

      Homoran paul53 2 Replies Last reply Reply Quote 0
      • Homoran
        Homoran Global Moderator Administrators @skorpil last edited by

        @skorpil sagte in On Anweisung (bitte Nachhilfe):

        on(idAnsage1 || dAnsage2 , function(dp) {

        Habe keine AHnung von js, aber da fehlt ein i bei dem zweiten

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

          @skorpil sagte: Das funktioniert aber nicht. Was mache ich falsch?

          Verwende ein Array oder RegExp.

          on([idAnsage1, idAnsage2], function(dp) {
          
          S 2 Replies Last reply Reply Quote 1
          • S
            skorpil @paul53 last edited by

            @paul53 Bin gerade nicht zu Hause, ich teste es nachher und gebe Feedback. Vor ab schon mal danke

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

              @paul53

              Das war es! Dankeschön. Mit RegExp. gelöst.

              Dennoch bleibt noch eine Frage: kannst Du mir erklären, warum mein Weg mit ODER nicht funktioniert?

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

                @skorpil sagte: erklären, warum mein Weg mit ODER nicht funktioniert?

                Das ist nicht vorgesehen, denn RegExp und Array bieten die Möglichkeit mehrerer IDs.

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

                Support us

                ioBroker
                Community Adapters
                Donate

                851
                Online

                31.9k
                Users

                80.1k
                Topics

                1.3m
                Posts

                3
                6
                217
                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