Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Selector nicht im Adapter möglich?

    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

    Selector nicht im Adapter möglich?

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

      Hallo,

      ich versuche in meinem Adapter folgendermaßen bestimmte Objekte zu erhalten:

      var Selector  = $(adapter.namespace + 'geraete.*eventUID');
      for (var i=0;i<Selector.length;i++) {
      	id=Selector[i]
      }
      

      Das scheint aber in Adaptern nicht zu funktionieren, oder?

      Zumindest erhalte ich im Log folgendes:

      uncaught exception: $ is not defined
      

      Gibt es eine andere Möglichkeit?

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

        @SchuetzeSchulz
        Der $Selector ist eine Funktion des Javascript-Adapters.

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

          @paul53
          Schade, gibt es da was ähnliches für Adapter?
          Ich will nur alle Objekte des Adapters haben, die mit ".eventUID" enden.

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

            @SchuetzeSchulz sagte:

            gibt es da was ähnliches für Adapter?

            Ich würde es mal mit getStates(pattern, callback) versuchen.

                * Read all states of this adapter, that pass the pattern
                * Allows to read all states of current adapter according to pattern. To read all states of current adapter use:
                *     adapter.getStates('*', function (err, states) {
                *         for (var id in states) {
                *              adapter.log.debug('"' + id + '" = "' + states[id].val);
                *         }
                *     });
                * @alias getStates
                * @memberof Adapter
                * @param {string} pattern string in form 'adapter.0.*' or like this. It can be array of IDs too.
                * @param {object} options optional argument to describe the user context
                * @param {ioBroker.GetStatesCallback} callback return result function (err, states) {}, where states is an object like {"ID1": {"val": 1, "ack": true}, "ID2": {"val": 2, "ack": false}, ...}
            S 1 Reply Last reply Reply Quote 0
            • S
              SchuetzeSchulz @paul53 last edited by

              @paul53
              Das scheint zu funktionieren, allerdings bekomme ich zusätzlich im Log

              No suitable Lua script, fallback to keys!: function(doc) { if (doc.type=='state') emit(doc._id, doc) }
              
              paul53 1 Reply Last reply Reply Quote 0
              • paul53
                paul53 @SchuetzeSchulz last edited by

                @SchuetzeSchulz sagte:

                allerdings bekomme ich zusätzlich im Log

                Damit kann ich nichts anfangen (bin selbst kein Adapter-Entwickler). Wie sieht der Code aus ?

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

                  @paul53
                  Müsste dann diese Zeile sein:

                  adapter.getStates(adapter.namespace + ".eNet.*.*.*.*eventUID", function (err, states) 
                  
                  
                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post

                  Support us

                  ioBroker
                  Community Adapters
                  Donate

                  852
                  Online

                  31.8k
                  Users

                  80.0k
                  Topics

                  1.3m
                  Posts

                  javascript
                  2
                  7
                  358
                  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