Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. [Offen] [Problem] Die Zigbeegeräte Batterie Status wird nicht ausgegeben

    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

    [Offen] [Problem] Die Zigbeegeräte Batterie Status wird nicht ausgegeben

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

      Hallo Zusammen,
      um den Batteriestatus anzuzeigen habe ich dieses Skript im Forum gefunden.
      Leider werden die Zigbee Geräte nicht ausgegeben nur die MAX Geräte

      DIe Ids aus den Zigbee Xiomi Aqara sind:

      Wo liegt der Fehler?
      Sehe ihn leider nicht.

      {
        "from": "system.adapter.zigbee.0",
        "ts": 1552780177606,
        "common": {
          "name": "Battery percent",
          "type": "number",
          "unit": "%",
          "role": "battery.percent",
          "min": 0,
          "max": 100,
          "read": true,
          "write": false,
          "icon": "img/battery_p.png"
        },
        "native": {},
        "acl": {
          "object": 1636,
          "owner": "system.user.admin",
          "ownerGroup": "system.group.administrator",
          "state": 1636
        },
        "_id": "zigbee.0.00158d0001b171bc.battery",
        "type": "state"
      }
      

      Bei MAXCUL folgende ID als Bsp

      {
        "from": "system.adapter.maxcul.0",
        "ts": 1547379631464,
        "common": {
          "name": "Thermostat MKF0051999 low battery",
          "type": "boolean",
          "role": "indicator.battery",
          "read": true,
          "write": false
        },
        "native": {
          "src": "133469",
          "raw": "1001A04D4B4630303531393939",
          "serial": "MKF0051999",
          "type": 1,
          "rssi": -59
        },
        "acl": {
          "object": 1636,
          "owner": "system.user.admin",
          "ownerGroup": "system.group.administrator",
          "state": 1636
        },
        "_id": "maxcul.0.MKF0051999.batteryLow",
        "type": "state"
      }
      
      createState('Batteriescript.Anzahl_Geräte', 0, {type: 'number'});
      createState('Batteriescript.Batterie_schwach', 0, {type: 'number'});
      createState('Batteriescript.Gerät', " ", {type: 'string'});
      
      const maxcul = $('maxcul.0.*.batteryLow');
      const zigbee = $('zigbee.0.*.battery');
      const loggen = true;
      
      var arrLOWBAT;
      
      function lowbat(id) {
         var obj = getObject(id);
         arrLOWBAT.push(obj.common.name);
         if(loggen) log("Gerät: " + obj.common.name);
      }
      
      function countLowbat() {
         var moeglicheLOWBAT = 0;
         arrLOWBAT      = [];
         maxcul.each(function (id, i) {
            if(getState(id).val == true) lowbat(id);
            ++moeglicheLOWBAT;
         }); 
         zigbee.each(function (id, i) {
            if(loggen) log("Zigbee: " + getState(id).val); 
            if(getState(id).val < 1000) lowbat(id);
            ++moeglicheLOWBAT;
         }); 
      
         if(loggen) log("Text: " + arrLOWBAT.join(', '));
         if(loggen) log("Anzahl Geräte: " + moeglicheLOWBAT + " // davon mit schwacher Batterie: " +  arrLOWBAT.length);
      
         setState("Batteriescript.Gerät",     arrLOWBAT.join(',<br>'));
         setState("Batteriescript.Batterie_schwach",   arrLOWBAT.length);
         setState("Batteriescript.Anzahl_Geräte", moeglicheLOWBAT);
      }
      
      countLowbat();
      
      schedule("*/60 * * * *", countLowbat);
      
      R 1 Reply Last reply Reply Quote 0
      • R
        robudus @robudus last edited by

        @robudus Fehlt noch eine Angabe? Oder hat wirklich niemand eine Idee.
        Vielen Danks chon im Voraus...

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

          @robudus sagte:

          Fehlt noch eine Angabe?

          Ja, die Version des Javascript-Adapters.

          1 Reply Last reply Reply Quote 0
          • R
            robudus last edited by

            Verfügbare Version: 4.1.12
            Installierte Version: 4.1.12

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

              @robudus Dazu gibt es bereits ein Github-Issue.

              1 Reply Last reply Reply Quote 0
              • R
                robudus last edited by

                supi. Also warte ich auf den Bugfix. tnx

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

                Support us

                ioBroker
                Community Adapters
                Donate

                800
                Online

                31.8k
                Users

                79.9k
                Topics

                1.3m
                Posts

                javascript
                2
                6
                409
                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