Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. [gelöst] Entprellen von Schaltern

    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] Entprellen von Schaltern

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

      Huhu,

      ich habe hier einige Probleme mit Datenpunkten die ich als Schalter benutze.

      Egal ob ich Blockly, JS oder NodeRed benutze. Wenn ich den Datenpunkt "auf Aktualisierung" prüfe wird 3 mal getriggert.

      Dies führt natürlich dazu dass die nachfolgenden Befehle im Script auch 3 mal ausgeführt werden.

      Wenn ich "auf Änderung" prüfe gibt es diese Probleme nicht.

      Hier mal die Debug-Ausgabe, geschaltet aus Vis On/Off.

      15.1.2019, 12:24:39.257 [info ]: javascript.0 Stop script script.js.Schalter.SZ_Beamer
      15.1.2019, 12:24:41.804 [info ]: javascript.0 Start javascript script.js.Schalter.SZ_Beamer
      15.1.2019, 12:24:41.808 [info ]: javascript.0 script.js.Schalter.SZ_Beamer: registered 1 subscription and 0 schedules
      15.1.2019, 12:24:48.028 [info ]: javascript.0 script.js.Schalter.SZ_Beamer: true
      15.1.2019, 12:24:48.061 [info ]: javascript.0 script.js.Schalter.SZ_Beamer: true
      15.1.2019, 12:24:49.025 [info ]: javascript.0 script.js.Schalter.SZ_Beamer: true
      15.1.2019, 12:24:54.160 [info ]: javascript.0 script.js.Schalter.SZ_Beamer: false
      15.1.2019, 12:24:54.198 [info ]: javascript.0 script.js.Schalter.SZ_Beamer: false
      15.1.2019, 12:24:55.173 [info ]: javascript.0 script.js.Schalter.SZ_Beamer: false
      

      Gibt es eine Möglichkeit dies zu entprellen ??

      Grüsse

      Ingo

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

        So…

        zum Beispiel:

        Entpreller ist eine Variable

        Anstatt debug deine eigentlichen Befehle ausführen

        Timeout nach Bedarf anpassen.

        7554_entpreller.png

        1 Reply Last reply Reply Quote 2
        • paul53
          paul53 last edited by Jey Cee

          https://forum.iobroker.net/viewtopic.php?f=21&t=15442&p=162221#p162221.

          1 Reply Last reply Reply Quote 0
          • I
            ingod last edited by

            Super, funktioniert.

            Vielen Dank.

            Grüsse

            Ingo

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

              @ingod:

              funktioniert. `
              Dann markiere bitte das Thema im Betreff des ersten Beitrags als [gelöst].

              1 Reply Last reply Reply Quote 0
              • I
                ingod last edited by

                Noch ne kurze Info dazu.

                "falls Entpreller = 0" hat nicht funktioniert habe stattdessen "falls Entpreller ≠ 1" genommen, das klappt.

                Grüsse

                Ingo

                1 Reply Last reply Reply Quote 0
                • X
                  Xyolyp last edited by

                  Das liegt daran, dass die Variable beim Skriptstart nicht mit 0 initialisiert wird und somit "undefined" zurückgibt. Wenn außerhalb des Triggers (also oben dran verbunden) die Variable auf 0 gesetzt wird funktioniert es auch mit dem Vergleich auf 0 😉

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

                    @ingod:

                    habe stattdessen "falls Entpreller ≠ 1" genommen, das klappt. `
                    Das funktioniert nicht.

                    Was auch nach Skriptstart funktioniert: falls nicht Entpreller

                    1 Reply Last reply Reply Quote 0
                    • I
                      ingod last edited by

                      OK, die Variable vorher zu setzen ist wahrscheinlich die sauberste Lösung.

                      Danke

                      Grüsse

                      Ingo

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

                        Ich habe das in der Praxis anstatt mit Variable mit Datenpunkt gelöst und nur für das Beispiel geändert.

                        Das Problem ist mir dabei nicht aufgefallen.

                        Also sorry, war mein Fehler.

                        1 Reply Last reply Reply Quote 0
                        • T
                          Tottbeck last edited by

                          Hallo, ich hänge mich mal hier dran.

                          So wirklich gelöst ist das Problem ja nicht, es wurde ja auch ein Github dazu erstellt:

                          https://github.com/ioBroker/ioBroker.ja … issues/288

                          Ich verwende bei mir mehrere GHoma-Steckdosen mit Leistungsmessung. Damit will ich u.a. Trockner/Waschmaschine überwachen.

                          Im Log bekommen ich jetzt jedes Update mehrfach angezeigt, teilweise auch von die Leistungswerten von andere Steckdosen obwohl die korrekte ausgewählt wurden. (Trockner hat ~ 500W)

                          code Aus Blockly

                          on({id: new RegExp('g-homa\\.0\\.4FEC24\\.power' + "|" + 'vis\\.0\\.datapoints\\.WM_Meldung_Aus'), change: "ne"}, function (obj) {
                              CrtPower = getState("g-homa.0.4FEC24.power").val;
                              console.log((['Trockner Leistung:',(obj.state ? obj.state.val : ""),' W, Status: ',WM_Status].join('')));
                              ..
                          

                          Log

                          13:37:12.958	info	javascript.0 script.js.GHoma.Trockner: Trockner Leistung:475.94 W, Status: 2
                          13:37:12.959	info	javascript.0 script.js.GHoma.Trockner: Trockner Leistung:475.94 W, Status: 2
                          13:37:12.959	info	javascript.0 script.js.GHoma.Trockner: Trockner Leistung:475.94 W, Status: 2
                          13:37:13.401	info	javascript.0 script.js.GHoma.Trockner: Trockner Leistung:0.93 W, Status: 2
                          13:37:13.402	info	javascript.0 script.js.GHoma.Trockner: Trockner Leistung:0.93 W, Status: 2
                          13:37:13.403	info	javascript.0 script.js.GHoma.Trockner: Trockner Leistung:0.93 W, Status: 2
                          13:38:27.978	info	javascript.0 script.js.GHoma.Trockner: Trockner Leistung:475.28 W, Status: 2
                          13:38:27.979	info	javascript.0 script.js.GHoma.Trockner: Trockner Leistung:475.28 W, Status: 2
                          13:38:27.979	info	javascript.0 script.js.GHoma.Trockner: Trockner Leistung:475.28 W, Status: 2
                          13:38:51.831	info	javascript.0 script.js.GHoma.Trockner: Trockner Leistung:484.22 W, Status: 2
                          13:38:51.832	info	javascript.0 script.js.GHoma.Trockner: Trockner Leistung:484.22 W, Status: 2
                          13:38:51.832	info	javascript.0 script.js.GHoma.Trockner: Trockner Leistung:484.22 W, Status: 2
                          13:38:52.337	info	javascript.0 script.js.GHoma.Trockner: Trockner Leistung:0.94 W, Status: 2
                          13:38:52.338	info	javascript.0 script.js.GHoma.Trockner: Trockner Leistung:0.94 W, Status: 2
                          13:38:52.338	info	javascript.0 script.js.GHoma.Trockner: Trockner Leistung:0.94 W, Status: 2
                          

                          Hier steht auch noch was dazu allerdings ohne Lösung:

                          viewtopic.php?t=8821

                          Bluefox 1 Reply Last reply Reply Quote 0
                          • Bluefox
                            Bluefox @Tottbeck last edited by

                            Участник @Tottbeck написал в [gelöst] Entprellen von Schaltern:

                            obj.state ? obj.state.val : ""

                            Kannst du so was ausgeben: console.log('Leistung: ' + JSON.stringify(state)) ?

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

                              Hi,
                              ich muss zum verständnis mal was nachfragen!

                              entpreller.png

                              Asgothian 1 Reply Last reply Reply Quote 0
                              • Asgothian
                                Asgothian Developer @totocotonio last edited by

                                @totocotonio
                                Ohne selber ein Spezialist bei Blockly zu sein - hast du die Variable entpreller irgendwo mit 0 vorbelegt ? Wenn nein, dann rechne ich damit das er da nicht rein kommt.

                                totocotonio 1 Reply Last reply Reply Quote 0
                                • totocotonio
                                  totocotonio @Asgothian last edited by

                                  @Asgothian Ok, wo muss dann mein eigentliches Blockly hin?

                                  Asgothian 1 Reply Last reply Reply Quote 0
                                  • Asgothian
                                    Asgothian Developer @totocotonio last edited by

                                    @totocotonio
                                    setz mal ein Objekt Setze Entpreller auf 0 vor den Falls Objekt geändert block. Das wird dann nur einmal beim Aufruf des Blocklys aufgerufen

                                    totocotonio 1 Reply Last reply Reply Quote 0
                                    • totocotonio
                                      totocotonio @Asgothian last edited by

                                      @Asgothian Auwei, ich verstehe nicht was du meinst.😖

                                      Asgothian 1 Reply Last reply Reply Quote 0
                                      • Asgothian
                                        Asgothian Developer @totocotonio last edited by Asgothian

                                        @totocotonio
                                        versuch das mal so:
                                        (Bild hab ich zusammen kopiert, kann aktuell nicht auf meinen iobroker)mockup.jpg
                                        Und ja, da wo du hin zeigst muss das rein was du ausführen willst.

                                        totocotonio 2 Replies Last reply Reply Quote 1
                                        • totocotonio
                                          totocotonio @Asgothian last edited by

                                          @Asgothian Ahhh 🤔 ,
                                          jetzt weiß ich wie du es meintest und so habe auch ich es verstanden.

                                          Ich versuche es mal so.

                                          Danke.

                                          1 Reply Last reply Reply Quote 0
                                          • totocotonio
                                            totocotonio @Asgothian last edited by

                                            @Asgothian Hi,
                                            ich habe so gemacht und es funktioniert scheinbar, ich muss es noch ausgiebig testen.
                                            entpreller.jpg

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            503
                                            Online

                                            31.9k
                                            Users

                                            80.2k
                                            Topics

                                            1.3m
                                            Posts

                                            javascript
                                            8
                                            20
                                            6141
                                            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