Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Gelöst: Anzahl der Zigbee Geräte ermitteln

    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: Anzahl der Zigbee Geräte ermitteln

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

      @paul53 sagte in Gelöst: Anzahl der Zigbee Geräte ermitteln:

      const nameDp = getObject(id).common.name

      Wie komme ich denn ie id? Muss ich nicht zunächst den Selector einrichten?
      const ids = $("tuya.1.*.Common.Name");

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

        @michihorn sagte: const ids = $("tuya.1.*.Common.Name");

        Dieser Selektor ist mit großer Wahrscheinlichkeit falsch!
        Zeige bitte mind. einen zu selektierenden Datenpunkt.

        @michihorn sagte in Gelöst: Anzahl der Zigbee Geräte ermitteln:

        Wie komme ich denn ie id?

        Die id wird innerhalb der Schleife ids.each(id) übergeben.

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

          @paul53 sagte in Gelöst: Anzahl der Zigbee Geräte ermitteln:

          Dieser Selektor ist mit großer Wahrscheinlichkeit falsch!

          selector.png

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

            @michihorn
            Ich sehe keinen Datenpunkt, sondern nur Geräte!
            Gibt es einen Datenpunkt, der zu jedem Tuya-Gerät existiert?

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

              @paul53 OK mein Fehler, ich will die Geräte zählen, ist wohl am einfachsten, und das separiert nach CAS_* und NL_*

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

                @michihorn sagte: ich will die Geräte zählen

                Dazu ist es zweckmäßig, im Selektor einen Datenpunkt(ID) anzugeben, der pro Gerät genau einmal existiert.

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

                  @paul53 Bei jedem Gerät ist der DP "xxxxx.online" vorhanden.

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

                    @michihorn sagte: Bei jedem Gerät ist der DP "xxxxx.online" vorhanden.

                    Direkt in der Ebene unter dem Gerät?

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

                      @paul53 selector2.png

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

                        @michihorn
                        Versuche es so:

                        const ids = $("tuya.1.*.online");
                        const idCAS = "0_userdata.0.System.Tuya.CAS_Count";
                        const idNL = "0_userdata.0.System.Tuya.NL_Count";
                         
                        let cntCAS = 0;
                        let cntNL = 0;
                        ids.each(function(id) {
                            id = id.substring(0, id.lastIndexOf('.'));
                            const devName = getObject(id).common.name;
                            if(devName.includes('CAS')) cntCAS++;
                            if(devName.includes('NL')) cntNL++;
                        });
                        setState(idCAS, cntCAS, true);
                        setState(idNL, cntNL, true);
                        log('CAS: ' + cntCAS + ', NL: ' + cntNL);
                        
                        M 1 Reply Last reply Reply Quote 0
                        • M
                          michihorn @paul53 last edited by michihorn

                          @paul53

                          Ja Paul das funktioniert. Dankeschön

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

                          Support us

                          ioBroker
                          Community Adapters
                          Donate

                          831
                          Online

                          31.8k
                          Users

                          80.0k
                          Topics

                          1.3m
                          Posts

                          javascript
                          2
                          22
                          612
                          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