Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Entwicklung
    4. Adapter-Entwicklung, Zugriff auf Objekte

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Adapter-Entwicklung, Zugriff auf Objekte

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

      Hallo,

      ist es möglich innerhalb eines Adapters 'A' auf Statusänderungen eines anderen Adapters 'B' zu reagieren?

      Zum Beispiel innerhalb des Adapters 'A', soll auf Wertänderung von 'DWD' reagiert werden:

      ...
          adapter.subscribeStates('dwd.0.warning.*');
      ...
      adapter.on('stateChange', function (id, state) {
          if (id == 'dwd.0.warning.*begin'){
      .....
      
          }
      });
      
      

      Tobias

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

        adapter.subscribeForeignObjects ist die Lösung.

        ...
            adapter.subscribeForeignObjects ('dwd.0.warning.*');
        ...
        adapter.on('stateChange', function (id, state) {
            if (id == 'dwd.0.warning.*begin'){
        .....
        
            }
        });
        
        1 Reply Last reply Reply Quote 0
        • H
          hometm last edited by

          vielen Dank Bluefox. Es funktioniert.

          Tobias

          1 Reply Last reply Reply Quote 0
          • SKB
            SKB Developer Most Active last edited by

            Hallo,
            ich hätte hier zu den States auch eine Frage:

            ich habe den AdapterCreator verwendet und würde gerne verschiedene Datenpunkte abonnieren, die der Benutzer in der Admin-Oberfläche eintippen kann.

            Aktuell habe ich es mit:

            production = this.config.production;
            
            this.subscribeStates(production);#
            oder
            this.subscribeForeignObjects(production);
            

            versucht.

            Leider bringt:

            	onStateChange(id, state) {
            		this.log.info("Something happened!");
            		if (state) {
            			// The state was changed
            			this.log.info(`state ${id} changed: ${state.val} (ack = ${state.ack})`);
            		} else {
            			// The state was deleted
            			this.log.info(`state ${id} deleted`);
            		}
            	}
            

            Keine Ausgabe im Log.

            Weiter oben im Adapter ist

            this.on("stateChange", this.onStateChange.bind(this));
            

            aktiviert.

            Vielen Dank!

            SKB 1 Reply Last reply Reply Quote 0
            • SKB
              SKB Developer Most Active @SKB last edited by

              @skb Ich antworte mir mal selber 😉

              Mit

              this.subscribeForeignStates(states);
              

              klappt es dann 😉

              Homoran 1 Reply Last reply Reply Quote 0
              • Homoran
                Homoran Global Moderator Administrators @SKB last edited by

                @skb du hast aber gesehen dass dieser Thread von 2015 ist, also 7 Jahre alt?
                In der Zeit ist iobroker massiv verändert worden

                SKB 1 Reply Last reply Reply Quote 2
                • SKB
                  SKB Developer Most Active @Homoran last edited by

                  @homoran Klar, habe ich gesehen. Ich dachte, vielleicht hat den noch jemand "abonniert" 🙂

                  Und, ich gehe davon aus, das ich mit dem

                  this.subscribeForeignStates(states); 
                  

                  richtig liege 🙂

                  Danke!

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

                  Support us

                  ioBroker
                  Community Adapters
                  Donate

                  801
                  Online

                  31.7k
                  Users

                  79.8k
                  Topics

                  1.3m
                  Posts

                  4
                  7
                  1659
                  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