Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Anfängerfrage zu Skripten: Pro Abfrage ein eigenes Script?

    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

    Anfängerfrage zu Skripten: Pro Abfrage ein eigenes Script?

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

      Sorry, aber ich habe mal eine ganz dumme Frage: Wenn ihr Skripte zum Abfragen einer Fernbedienung schreibt, nehmt ihr dann für jede Taste ein eigenes Script? Ich bin dabei, eine Routine für meine Tint Remote Fernbedienung zu erstellen. Zum Beispiel nutze ich für die Ein/Aus-Taste einen "Falls Objekt-Trigger" (true) dann mache etwas. Aber dort kann ich ja keine If-Then-Else-Abfrage wie bei den Logikbausteinen nutzen. Und wenn ich anstatt des Triggers einen Logikbaustein nehme, klappt es nicht.

      1 Reply Last reply Reply Quote 0
      • Uhula
        Uhula last edited by

        Dir steht beides frei. Ein Script je on-Event (Trigger) oder auch alle on-Events der FB in ein Script. Ich würde letzteres bevorzugen. Ein if-then-else bei den on-Events ist nicht notwendig, da du im Script mehrere on-Events registrieren kannst. Es wird dann nur der Code im Script ausgeführt, welcher "dazu" gehört.

        U 1 Reply Last reply Reply Quote 0
        • U
          Uwe2020 @Uhula last edited by

          @Uhula Danke für die schnelle Antwort. Hast du vielleicht einen kurzen Beispielcode? Was meinst du mit On-Event der FB?

          1 Reply Last reply Reply Quote 0
          • Uhula
            Uhula last edited by

            Das, was du als "Falls Objekt-Trigger" bezeichnet hast. Siehe hier unter "on - subscribe": https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/en/javascript.md

            U 1 Reply Last reply Reply Quote -1
            • U
              Uwe2020 @Uhula last edited by

              @Uhula Danke!

              1 Reply Last reply Reply Quote 0
              • U
                Uwe2020 last edited by

                @Uhula said in Anfängerfrage zu Skripten: Pro Abfrage ein eigenes Script?:

                on - subscribe

                Hast du das ungefähr so gemeint?

                // Power
                on({id: "zigbee.0.00158d0003470e01.state", change: 'ne'}, function (data) {
                    console.log('Ein/Aus-Taste gedrückt');
                });
                // Helligkeit erhöhen
                on({id: "zigbee.0.00158d0003470e01.brightness_up_click", change: 'ne'}, function (data) {
                    console.log('Brightness up-Taste gedrückt');
                });
                // Helligkeit verringern
                on({id: "zigbee.0.00158d0003470e01.brightness_down_click", change: 'ne'}, function (data) {
                    console.log('Brightness down-Taste gedrückt');
                });
                // Farbrad
                on({id: "zigbee.0.00158d0003470e01.color", change: 'any'}, function (data) {
                    console.log('Farbrad gedrückt!');
                });
                // Farbtemperatur
                on({id: "zigbee.0.00158d0003470e01.colortemp", change: 'any'}, function (data) {
                    console.log('Farbtemperatur gedrückt!');
                });
                 
                
                Uhula 1 Reply Last reply Reply Quote 1
                • Uhula
                  Uhula @Uwe2020 last edited by

                  @Uwe2020 Genau so!

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

                  Support us

                  ioBroker
                  Community Adapters
                  Donate

                  958
                  Online

                  31.9k
                  Users

                  80.2k
                  Topics

                  1.3m
                  Posts

                  2
                  7
                  427
                  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