Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. Datenpunkte zusammenführen switch + state

    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

    SOLVED Datenpunkte zusammenführen switch + state

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

      @Elektroniker86 sagte:

      Jetzt funktioniert es !!!

      Sorry, es war mein Fehler: Hatte nicht daran gedacht, dass der Trigger eine vollständige ID braucht.
      Funktioniert es auch so ?

      // IDs anpassen
      const idButton = 's7.0.DBs.DB1.NI02';
      const idActor = 's7.0.DBs.DB1.Q02';
       
      const js = 'system.adapter.javascript.' + instance;
      const common = getObject(idButton).common;
      const idVis = 'LOGO.s7-0.' + common.name.replace(/\s/g, '_');
       
      common.read = true;
      createState(idVis, getState(idActor).val, common);
       
      on({id: 'javascript.0.' + idVis, change: 'ne', fromNe: js}, function() {
          setState(idButton, true);
      });
       
      on(idActor, function(dp) {
          setState(idVis, dp.state.val, true);
      });
      

      EDIT: Zeile 7 replace geändert.

      Elektroniker86 4 Replies Last reply Reply Quote 1
      • paul53
        paul53 @Elektroniker86 last edited by

        @Elektroniker86 sagte:

        kann man dieses Script auch so umschreiben das dass auch für die Rolladen funktioniert?

        Kann man.

        // IDs anpassen
        const idCmd = 's7.1.DBs.DB1.NAI01';
        const idStat = 's7.1.DBs.DB1.AM01';
         
        const js = 'system.adapter.javascript.' + instance;
        const common = getObject(idCmd).common;
        const idVis = 'LOGO.s7-1.' + common.name.replace(/\s/g, '_');
         
        common.read = true;
        createState(idVis, getState(idStat).val, common);
         
        on({id: 'javascript.0.' + idVis, change: 'ne', fromNe: js}, function(dp) {
            setState(idCmd, dp.state.val);
        });
         
        on(idStat, function(dp) {
            setState(idVis, dp.state.val, true);
        });
        
        Elektroniker86 2 Replies Last reply Reply Quote 1
        • Elektroniker86
          Elektroniker86 @paul53 last edited by

          @paul53

          Moment ich teste.

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

            @Elektroniker86 sagte:

            Kann man diese Zeile wieder entfernen?

            Ja, war nur zum Test, ob getriggert wird.

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

              @paul53

              Einwandfrei läuft !!!

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

                @Elektroniker86 sagte:

                Einwandfrei läuft !!!

                Dann kannst Du dieses Skript als Vorlage für weitere Skripte nutzen und musst nur Zeilen 2, 3 und gegebenfalls Zeile 7 anpassen.

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

                  @paul53 sagte in Datenpunkte zusammenführen switch + state:

                  Sorry, es war mein Fehler: Hatte nicht daran gedacht, dass der Trigger eine vollständige ID braucht.

                  Gar kein Problem, ich bin froh das man hier geholfen bekommt.
                  Ich selbst hätte das so nicht hinbekommen ein Blockly bekomm ich noch gebacken aber diese Sprache spreche ich leider nicht.
                  Wirklich daumen hoch Danke !!!

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

                    @paul53 sagte in Datenpunkte zusammenführen switch + state:

                    gegebenfalls Zeile 7 anpassen.

                    Wieso Zeile 7?

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

                      @Elektroniker86 sagte:

                      Wieso Zeile 7?

                      Gibt es nicht auch "LOGO.s7-1." ?

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

                        @paul53 sagte in Datenpunkte zusammenführen switch + state:

                        Gibt es nicht auch "LOGO.s7-1." ?

                        Ahh so ja, hab gesehen das in meinem Script bei Zeile 2 anfängt.
                        Passt habs verstanden.

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

                          @paul53

                          Hey, vielen Dank nochmals für das tolle Script.
                          Habe mittlerweile alles umgestellt und den Scenen Adapter verbannt.
                          So, nun habe ich meine Rollladensteuerung in der LOGO umprogrammiert damit ich die auch von 0-100% ansteuern kann und den Stand sehe.

                          Du ahnst es sicher schon aber kann man dieses Script auch so umschreiben das dass auch für die Rolladen funktioniert?

                          Quasie gleiches Prinzip, ich habe einen Datenpunkt zum ansteuern 0-100% (s7.1.DBs.DB1.NAI01) und ein Datenpunkt vom Status, wo er gerade steht (s7.1.DBs.DB1.AM01)

                          Vielen Dank im voraus!

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

                            @Elektroniker86 sagte:

                            kann man dieses Script auch so umschreiben das dass auch für die Rolladen funktioniert?

                            Kann man.

                            // IDs anpassen
                            const idCmd = 's7.1.DBs.DB1.NAI01';
                            const idStat = 's7.1.DBs.DB1.AM01';
                             
                            const js = 'system.adapter.javascript.' + instance;
                            const common = getObject(idCmd).common;
                            const idVis = 'LOGO.s7-1.' + common.name.replace(/\s/g, '_');
                             
                            common.read = true;
                            createState(idVis, getState(idStat).val, common);
                             
                            on({id: 'javascript.0.' + idVis, change: 'ne', fromNe: js}, function(dp) {
                                setState(idCmd, dp.state.val);
                            });
                             
                            on(idStat, function(dp) {
                                setState(idVis, dp.state.val, true);
                            });
                            
                            Elektroniker86 2 Replies Last reply Reply Quote 1
                            • Elektroniker86
                              Elektroniker86 @paul53 last edited by

                              @paul53

                              Wow, das ging ja schnell.... 😊

                              Vielen Dank werde ich direkt testen.👍

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

                                @paul53
                                Einfach Klasse! Funktioniert einwandfrei 👍
                                Du bist der beste!
                                Danke!

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

                                  @Elektroniker86 sagte:

                                  Funktioniert einwandfrei

                                  Dann entferne noch das Fragezeichen, indem Du bei der Lösung rechts unten auf den 3 Punkten "Mark this post as the correct answer" anwählst.

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

                                  Support us

                                  ioBroker
                                  Community Adapters
                                  Donate
                                  FAQ Cloud / IOT
                                  HowTo: Node.js-Update
                                  HowTo: Backup/Restore
                                  Downloads
                                  BLOG

                                  504
                                  Online

                                  31.9k
                                  Users

                                  80.1k
                                  Topics

                                  1.3m
                                  Posts

                                  datenpunkte objekte s7.0
                                  3
                                  55
                                  3561
                                  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