Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. [Suche] Id vom Selektor ohne Children

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    [Suche] Id vom Selektor ohne Children

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

      Ich möchte eine Liste erstellen aller meine Sensoren aus meiner Dekonz Instanz.
      Folgendes beinhaltet aber alle Objekte, ich brauche aber nur die übergeordneten:
      3c21efd6-2bff-458f-bd98-b0b84e34be4b-image.png

      Also mit obigem Blockly bekomme ich z.b.
      deconz.0.Sensors.1.battery
      deconz.0.Sensors.1.open
      deconz.0.Sensors.2.battery
      deconz.0.Sensors.2.open
      (es sind natürlich viel mehr Elemente)

      Ich brauche aber nur:
      deconz.0.Sensors.1
      deconz.0.Sensors.2
      usw.

      Ist das machbar?

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

        @simplyclever sagte: Ist das machbar?

        Ja, suche im Forum nach "parentID".

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

          Ja, ich kann in der Liste (die arg gross ist) bei jedem Element parentName verwenden.
          Die Frage ist, kann ich direkt nur die Parent in die Liste packen? Da hilft mir parentName nicht, oder?
          Gibt es entsprechende Syntax in IDs vom Selektor?

          paul53 2 Replies Last reply Reply Quote 0
          • paul53
            paul53 @simplyclever last edited by paul53

            @simplyclever sagte: Gibt es entsprechende Syntax in IDs vom Selektor?

            Nein, der Selektor liefert nur Datenpunkt-IDs.

            1 Reply Last reply Reply Quote 1
            • paul53
              paul53 @simplyclever last edited by

              @simplyclever sagte: kann ich direkt nur die Parent in die Liste packen?

              Ja, mittels einer Schleife und einer JS-Funktion mit Ergebnis:

              return id.substring(0, id.lastIndexOf('.'));
              

              Blockly_temp.JPG

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

                @paul53 Klasse, danke!

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

                Support us

                ioBroker
                Community Adapters
                Donate

                545
                Online

                32.0k
                Users

                80.5k
                Topics

                1.3m
                Posts

                2
                6
                234
                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