Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. Frage zu DeviceCounter script [object Object]

    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

    Frage zu DeviceCounter script [object Object]

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

      @Archimedeus
      Was sagt das Log (anstelle Zeile 41)?

              log(d_list);
      

      @Archimedeus sagte in Frage zu DeviceCounter script [object Object]:

      Leider ist total jetzt auch 0, sollte 2 sein.

      An der Zählung (Zeile 39) hat sich nichts geändert ?

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

        @paul53

        Ich bin etwas weiter.

        var roomsX = getObject(id,'rooms');
        

        Die Zeile gibt schon das object Obct. Grund ist, dass in der Aufzählung direkt die Endpunkte -POWER stehen. ID ist dann also sonoff.0.sonoff1.POWER Da drin ist natürlich kein .rooms drin. Ich muss den Aufruf anders machen. Habe jetzt in der Auzählung sonoff.0.sonoff1 und versuche es so:

        addDeviceCounter("lamps_on",$('channel[id=state.*.POWER](functions=sonoff)'),                            true);
        

        Tut aber nicht, findet keine Devices. Ich glaube ioch muss mal drüber schlafen. Hast mir geholfen. Man kämpft sich bit für bit voran.

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

          @Archimedeus sagte in Frage zu DeviceCounter script [object Object]:

          Tut aber nicht, findet keine Devices.

          Versuche es mal so:

          addDeviceCounter("lamps_on",$('sonoff.0.*.POWER'), true);
          

          @Archimedeus sagte in Frage zu DeviceCounter script [object Object]:

          Das Problem mit LOWBATT und LOW_BATT bei HM und HMIP hat der * gelöst

          Das sind unterschiedliche Instanzen.

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

            @paul53 said in Frage zu DeviceCounter script [object Object]:

            addDeviceCounter("lamps_on",$('sonoff.0.*.POWER'), true);

            Das findet alle devices in sonoff (auch die bridge) aber roomsX bleibt object Object.

            Das andere

            addDeviceCounter("battery_homematic",$('channel[state.id=hm-rpc.*.*.0.LOW*]'),     true);
            

            funktioniert wirklich. Er findet die LOW* aus beiden instanzen.

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

              @Archimedeus sagte:

              funktioniert wirklich. Er findet die LOW* aus beiden instanzen.

              Jetzt ist auch keine Instanz angegeben. Der Selektor kann kürzer sein:

              addDeviceCounter("battery_homematic",$('hm-rpc.*.0.LOW*'), true);
              

              @Archimedeus sagte in Frage zu DeviceCounter script [object Object]:

              aber roomsX bleibt object Object.

              Welche Version des Javascript-Adapters ? Sind Räume zugeordnet ?

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

                @paul53
                4.8.4 und ja es sind Räume zugewiesen. Morgen klappts. bestimmt 🙂

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

                  @Archimedeus
                  Habe nicht mehr daran gedacht: Raumname kann mehrsprachig sein. Deshalb

                                  var room = getObject(id,'rooms').enumNames[0];
                                  if(typeof room == 'object') room = room.de;
                                  if(!d_list.includes(room)) d_list.push(room);
                  
                  A 1 Reply Last reply Reply Quote 0
                  • A
                    Archimedeus @paul53 last edited by

                    @paul53 said in Frage zu DeviceCounter script [object Object]:

                    var room = getObject(id,'rooms').enumNames[0];

                    Schon besser. Problem: enumNames nimmt nur den ersten Raum. Deshalb stand im Original auch
                    d_list.push(rooms.enumNames)
                    und
                    setState(state_list, d_list.join('-'));

                    Naja, eigentlich sollte ein Gerät auch nur in einem Raum sein...

                    A 1 Reply Last reply Reply Quote 0
                    • A
                      Archimedeus @Archimedeus last edited by

                      @Archimedeus
                      Aber es tut, was es soll! Danke vielmals!

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

                        @Archimedeus sagte:

                        es tut, was es soll!

                        Sollen die Batterie-Infos tatsächlich pro Raum erfolgen ?

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

                        Support us

                        ioBroker
                        Community Adapters
                        Donate

                        840
                        Online

                        31.8k
                        Users

                        80.0k
                        Topics

                        1.3m
                        Posts

                        2
                        15
                        501
                        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