Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Node-Red
    5. [Gelöst] Benötige Hilfe mit Node-Red in Verbindung mit homee

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    [Gelöst] Benötige Hilfe mit Node-Red in Verbindung mit homee

    This topic has been deleted. Only users with topic management privileges can see it.
    • mickym
      mickym Most Active last edited by mickym

      So ich denke ich habe es geschafft. 😉 - Stunden später - aber das ist für mich auch immer komplexer. 😉

      So die type=69 attribute, sind nun in die Batteriespalte mit aufgenommen: Wenn der current_value eines type=69 Eintrags ist 0 (kein Alarm) wird das Batterielevel auf 100% gesetzt, anderenfalls auf 0%.

      Hier wieder zum Ausprobieren: https://try.jsonata.org/bxx5ycClY

      payload.{"name" :name,
              "type" : cube_type,
              "protocol" : $single($$.protocols, function($v){$v.id = protocol}).name,
              "state" : ' <font color=\"' & $single($$.states, function($v){$v.id = state}).color & '\"> ' & $single($$.states, function($v){$v.id = state}).name,
              "battery" : (attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]).type = 8 ? attributes[type=8 ].current_value : 
              (attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]).type = 69 ? attributes[type=69 ].current_value = 0 ? 100 : 0
      } ~> |$|{"battery" : $exists(battery) ? ' <font color=\"' & $filter($$.battery, function($v){battery >= $v.level})[0].color & '\"> ' & battery & " %"}|
      

      So hier der Flow als Tabelle 6

      a328ae48-ea11-4e2e-9eca-fd01d5f7e018-image.png

      [
         {
             "id": "dfb85691acadb5e8",
             "type": "change",
             "z": "9c280ddf049b2b4d",
             "name": "VIS Tabelle 6",
             "rules": [
                 {
                     "t": "set",
                     "p": "protocols",
                     "pt": "msg",
                     "to": "[{\"id\":1,\"name\":\"ZWave\"},{\"id\":2,\"name\":\"Zigbee\"},{\"id\":3,\"name\":\"EnOcean\"},{\"id\":9,\"name\":\"WLan\"}]",
                     "tot": "json"
                 },
                 {
                     "t": "set",
                     "p": "states",
                     "pt": "msg",
                     "to": "[{\"id\":1,\"name\":\"aktiv\",\"color\":\"green\"},{\"id\":2,\"name\":\"inaktiv\",\"color\":\"rot\"},{\"id\":12,\"name\":\"wird aktualisiert\",\"color\":\"orange\"}]",
                     "tot": "json"
                 },
                 {
                     "t": "set",
                     "p": "battery",
                     "pt": "msg",
                     "to": "[{\"level\":30,\"color\":\"green\"},{\"level\":20,\"color\":\"yellow\"},{\"level\":15,\"color\":\"orange\"},{\"level\":0,\"color\":\"red\"}]",
                     "tot": "json"
                 },
                 {
                     "t": "set",
                     "p": "payload",
                     "pt": "msg",
                     "to": "payload.{\"name\" :name,\t        \"type\" : cube_type,\t        \"protocol\" : $single($$.protocols, function($v){$v.id = protocol}).name,\t        \"state\" : ' <font color=\\\"' & $single($$.states, function($v){$v.id = state}).color & '\\\"> ' & $single($$.states, function($v){$v.id = state}).name,\t        \"battery\" : (attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]).type = 8 ? attributes[type=8 ].current_value : \t        (attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]).type = 69 ? attributes[type=69 ].current_value = 0 ? 100 : 0\t} ~> |$|{\"battery\" : $exists(battery) ? ' <font color=\\\"' & $filter($$.battery, function($v){battery >= $v.level})[0].color & '\\\"> ' & battery & \" %\"}|",
                     "tot": "jsonata"
                 }
             ],
             "action": "",
             "property": "",
             "from": "",
             "to": "",
             "reg": false,
             "x": 1250,
             "y": 4100,
             "wires": [
                 [
                     "2b7218100bc7ac23"
                 ]
             ]
         }
      ]
      

      Das Ergebnis ist diese Tabelle:

      [
        {
          "name": "DG / Schlafzimmer / Bewegungsmelder / Kirsten",
          "type": 2,
          "protocol": "Zigbee",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "DG / Schlafzimmer / Bewegungsmelder Oliver",
          "type": 2,
          "protocol": "Zigbee",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "DG / Schlafzimmer / Luftreiniger",
          "type": 2,
          "protocol": "Zigbee",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "DG / Schlafzimmer / Nachtlicht TV",
          "type": 2,
          "protocol": "Zigbee",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "DG / Schlafzimmer / Nachtlicht Kirsten",
          "type": 2,
          "protocol": "Zigbee",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "DG / Schlafzimmer / Schalter Nachtlicht",
          "type": 2,
          "protocol": "Zigbee",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "DG / Schlafzimmer / Nachtlicht Oliver",
          "type": 2,
          "protocol": "Zigbee",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "EG / Wohnzimmer / Heizung Balkon",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 55 %"
        },
        {
          "name": "UG / Keller / Waschmaschine",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "EG / Wohnzimmer / Multimedia",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "DG / Flur / Rauchmelder",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 98 %"
        },
        {
          "name": "EG / Flur / Rauchmelder",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 100 %"
        },
        {
          "name": "UG / Flur / Rauchmelder",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 76 %"
        },
        {
          "name": "DG / Bad / Fenster",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 86 %"
        },
        {
          "name": "EG / Esszimmer / Balkontüre",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 100 %"
        },
        {
          "name": "EG / Wohnzimmer / Balkontüre",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 90 %"
        },
        {
          "name": "EG / WC / Fenster",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 100 %"
        },
        {
          "name": "EG / Büro / Fenster Rechts",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 90 %"
        },
        {
          "name": "EG / Büro / Fenster Links",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 100 %"
        },
        {
          "name": "DG / Schlafzimmer / Rauchmelder",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"red\"> 12 %"
        },
        {
          "name": "UG / Schlafzimmer / Rauchmelder",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 88 %"
        },
        {
          "name": "EG / Büro / Heizung",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 55 %"
        },
        {
          "name": "EG / Wohnzimmer / Vitrine",
          "type": 2,
          "protocol": "Zigbee",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "DG / Flur / Vitrine Licht",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"rot\"> inaktiv"
        },
        {
          "name": "EG / Wohnzimmer / Temperatur Weinkühlschrank",
          "type": 2,
          "protocol": "Zigbee",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "EG / Wohnzimmer / Heizung Links",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 85 %"
        },
        {
          "name": "EG / Wohnzimmer / TV-Schrank",
          "type": 2,
          "protocol": "Zigbee",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "EG / Esszimmer / Heizung",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 95 %"
        },
        {
          "name": "EG / WC / Heizung",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 55 %"
        },
        {
          "name": "EG / Wohnzimmer / Weinkühlschrank",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "EG / Wohnzimmer / Raumthermostat",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 78 %"
        },
        {
          "name": "EG / Büro / Computer",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "EG / Küche / Kühlschrank",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "EG / Küche / Geschirrspüler",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "EG / Küche / Wassersensor",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 95 %"
        },
        {
          "name": "DG / Bad / Heizung",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 85 %"
        },
        {
          "name": "EG / Wohnzimmer / Netatmo",
          "type": 8,
          "protocol": "WLan",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "Netatmo Aussenraum",
          "type": 8,
          "protocol": "WLan",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 100 %"
        },
        {
          "name": "EG / Büro / Netatmo",
          "type": 8,
          "protocol": "WLan",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 100 %"
        },
        {
          "name": "DG / Schlafzimmer / Netatmo",
          "type": 8,
          "protocol": "WLan",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 100 %"
        },
        {
          "name": "DG / Schlafzimmer / Klimaanlage",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "EG / Flur / Tablet",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "EG / Wohnzimmer / Stehlampe",
          "type": 2,
          "protocol": "Zigbee",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "EG / Wohnzimmer / Bar",
          "type": 2,
          "protocol": "Zigbee",
          "state": " <font color=\"green\"> aktiv"
        },
        {
          "name": "EG / Küche / Temperatur Kühlschrank",
          "type": 2,
          "protocol": "Zigbee",
          "state": " <font color=\"green\"> aktiv"
        }
      ]
      

      Im Moment haben alle "Nicht-" Batterie Geräte die Eigenschaft battery einfach nicht definiert. Wenn man eine Textausgabe wünscht, dann halt den Code wie folgt anpassen:

      payload.{"name" :name,
              "type" : cube_type,
              "protocol" : $single($$.protocols, function($v){$v.id = protocol}).name,
              "state" : ' <font color=\"' & $single($$.states, function($v){$v.id = state}).color & '\"> ' & $single($$.states, function($v){$v.id = state}).name,
              "battery" : (attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]).type = 8 ? attributes[type=8 ].current_value : 
              (attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]).type = 69 ? attributes[type=69 ].current_value = 0 ? 100 : 0
      } ~> |$|{"battery" : $exists(battery) ? ' <font color=\"' & $filter($$.battery, function($v){battery >= $v.level})[0].color & '\"> ' & battery & " %" : "Keine Batterie"}  |
      

      Dies erzeugt, dann für alle Geräte eine battery Eigenschaft:

       {
          "name": "EG / Wohnzimmer / Multimedia",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": "Keine Batterie"
        },
        {
          "name": "DG / Flur / Rauchmelder",
          "type": 1,
          "protocol": "ZWave",
          "state": " <font color=\"green\"> aktiv",
          "battery": " <font color=\"green\"> 98 %"
        },
      
      O 1 Reply Last reply Reply Quote 2
      • O
        Oli @mickym last edited by Oli

        @mickym

        nochmals vielen Dank für deine Hilfe, hier jetzt mal der komplette Flow, sowie er jetzt aussieht

        [
           {
               "id": "b8ad42061a6d5f2e",
               "type": "tab",
               "label": "homee Geräteliste",
               "disabled": false,
               "info": "",
               "env": []
           },
           {
               "id": "bc383b50669e8145",
               "type": "junction",
               "z": "b8ad42061a6d5f2e",
               "x": 960,
               "y": 660,
               "wires": [
                   [
                       "99528e0bbb0f2491",
                       "afc0236a6dc34b6c",
                       "3baf2b45228f3514",
                       "61efee2e1293f2f8",
                       "18ed2cb5de54b4e1",
                       "8bc0a02357eaa25a",
                       "6624873c35b06eae",
                       "dfb85691acadb5e8"
                   ]
               ]
           },
           {
               "id": "99528e0bbb0f2491",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "Alle inaktiven Geräte",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload[state = 2]",
                       "tot": "jsonata"
                   },
                   {
                       "t": "set",
                       "p": "homee.inactive",
                       "pt": "flow",
                       "to": "payload",
                       "tot": "msg"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1140,
               "y": 380,
               "wires": [
                   [
                       "79c90e3a205144c8",
                       "1a49f3e7a72eeb98"
                   ]
               ]
           },
           {
               "id": "79c90e3a205144c8",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload ? $count(payload) : 0",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1330,
               "y": 380,
               "wires": [
                   [
                       "6636132bd627fd5a",
                       "a5ac3eaebc5a142d"
                   ]
               ]
           },
           {
               "id": "6636132bd627fd5a",
               "type": "debug",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl inaktive Geräte",
               "active": false,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 1620,
               "y": 320,
               "wires": []
           },
           {
               "id": "afc0236a6dc34b6c",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "Alle Z-Wave Geräte",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload[protocol = 1]",
                       "tot": "jsonata"
                   },
                   {
                       "t": "set",
                       "p": "payload.nodes",
                       "pt": "flow",
                       "to": "payload",
                       "tot": "msg"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1130,
               "y": 520,
               "wires": [
                   [
                       "3f5d54fa1161d7c3",
                       "fb541319f5065b26"
                   ]
               ]
           },
           {
               "id": "3f5d54fa1161d7c3",
               "type": "debug",
               "z": "b8ad42061a6d5f2e",
               "name": "Geräte mit Z-Wave",
               "active": false,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 1370,
               "y": 460,
               "wires": []
           },
           {
               "id": "fb541319f5065b26",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload ? $count(payload) : 0",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1330,
               "y": 520,
               "wires": [
                   [
                       "8b5f07919d5020d8",
                       "27bd5b6a0a11f64b"
                   ]
               ]
           },
           {
               "id": "8b5f07919d5020d8",
               "type": "debug",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl Geräte Z-Wave",
               "active": false,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 1620,
               "y": 460,
               "wires": []
           },
           {
               "id": "27bd5b6a0a11f64b",
               "type": "ioBroker out",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl Z-Wave Geräte",
               "topic": "0_userdata.0.System.homee.ZWave",
               "ack": "true",
               "autoCreate": "true",
               "stateName": "0_userdata.0.System.homee.ZWave",
               "role": "",
               "payloadType": "number",
               "readonly": "false",
               "stateUnit": "",
               "stateMin": "",
               "stateMax": "",
               "x": 1620,
               "y": 520,
               "wires": []
           },
           {
               "id": "3baf2b45228f3514",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "Alle ZigBee Geräte",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload[protocol = 2]",
                       "tot": "jsonata"
                   },
                   {
                       "t": "set",
                       "p": "payload.nodes",
                       "pt": "flow",
                       "to": "payload",
                       "tot": "msg"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1130,
               "y": 660,
               "wires": [
                   [
                       "b0d34d08416e6c10",
                       "adb5799593bc282a"
                   ]
               ]
           },
           {
               "id": "b0d34d08416e6c10",
               "type": "debug",
               "z": "b8ad42061a6d5f2e",
               "name": "Geräte mit ZigBee",
               "active": false,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 1370,
               "y": 600,
               "wires": []
           },
           {
               "id": "adb5799593bc282a",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload ? $count(payload) : 0",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1330,
               "y": 660,
               "wires": [
                   [
                       "b553c35fe84e7ff1",
                       "a722c9c32ead9437"
                   ]
               ]
           },
           {
               "id": "b553c35fe84e7ff1",
               "type": "debug",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl Geräte ZigBee",
               "active": false,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 1620,
               "y": 600,
               "wires": []
           },
           {
               "id": "a722c9c32ead9437",
               "type": "ioBroker out",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl ZigBee Geräte",
               "topic": "0_userdata.0.System.homee.ZigBee",
               "ack": "true",
               "autoCreate": "true",
               "stateName": "0_userdata.0.System.homee.ZigBee",
               "role": "",
               "payloadType": "number",
               "readonly": "false",
               "stateUnit": "",
               "stateMin": "",
               "stateMax": "",
               "x": 1620,
               "y": 660,
               "wires": []
           },
           {
               "id": "306e283de06793a5",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "",
               "rules": [
                   {
                       "t": "move",
                       "p": "payload",
                       "pt": "msg",
                       "to": "device",
                       "tot": "msg"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 380,
               "y": 1080,
               "wires": [
                   [
                       "3fcd14dd3eda98a3"
                   ]
               ]
           },
           {
               "id": "3fcd14dd3eda98a3",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "hole alle Geräte",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "{}",
                       "tot": "json"
                   },
                   {
                       "t": "set",
                       "p": "payload.nodes",
                       "pt": "msg",
                       "to": "homee.nodes",
                       "tot": "global"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 600,
               "y": 1080,
               "wires": [
                   [
                       "3981f0834f60fe3d"
                   ]
               ]
           },
           {
               "id": "3981f0834f60fe3d",
               "type": "switch",
               "z": "b8ad42061a6d5f2e",
               "name": "Nur wenn Gerätestatus geändert",
               "property": "payload.nodes[id=$$.device.node.id].state = device.node.state",
               "propertyType": "jsonata",
               "rules": [
                   {
                       "t": "false"
                   }
               ],
               "checkall": "true",
               "repair": false,
               "outputs": 1,
               "x": 250,
               "y": 820,
               "wires": [
                   [
                       "84e0be29a596b9f6"
                   ]
               ]
           },
           {
               "id": "e565ecbc06eb639f",
               "type": "switch",
               "z": "b8ad42061a6d5f2e",
               "name": "verify device",
               "property": "payload.node",
               "propertyType": "msg",
               "rules": [
                   {
                       "t": "nnull"
                   }
               ],
               "checkall": "true",
               "repair": false,
               "outputs": 1,
               "x": 170,
               "y": 1080,
               "wires": [
                   [
                       "306e283de06793a5"
                   ]
               ]
           },
           {
               "id": "61efee2e1293f2f8",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "Alle EnOcean Geräte",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload[protocol = 3]",
                       "tot": "jsonata"
                   },
                   {
                       "t": "set",
                       "p": "payload.nodes",
                       "pt": "flow",
                       "to": "payload",
                       "tot": "msg"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1140,
               "y": 800,
               "wires": [
                   [
                       "6174c1fb73ccadf7",
                       "6bf0970636cc1e4a"
                   ]
               ]
           },
           {
               "id": "6174c1fb73ccadf7",
               "type": "debug",
               "z": "b8ad42061a6d5f2e",
               "name": "Geräte mit EnOcean",
               "active": false,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 1380,
               "y": 740,
               "wires": []
           },
           {
               "id": "6bf0970636cc1e4a",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload ? $count(payload) : 0",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1330,
               "y": 800,
               "wires": [
                   [
                       "ec17a4f04cc1f205",
                       "39049bb60e657627"
                   ]
               ]
           },
           {
               "id": "ec17a4f04cc1f205",
               "type": "debug",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl Geräte EnOcean",
               "active": false,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 1630,
               "y": 740,
               "wires": []
           },
           {
               "id": "39049bb60e657627",
               "type": "ioBroker out",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl EnOcean Geräte",
               "topic": "0_userdata.0.System.homee.EnOcean",
               "ack": "true",
               "autoCreate": "true",
               "stateName": "0_userdata.0.System.homee.EnOcean",
               "role": "",
               "payloadType": "number",
               "readonly": "false",
               "stateUnit": "",
               "stateMin": "",
               "stateMax": "",
               "x": 1630,
               "y": 800,
               "wires": []
           },
           {
               "id": "18ed2cb5de54b4e1",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "Alle WLan Geräte",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload[protocol = 9]",
                       "tot": "jsonata"
                   },
                   {
                       "t": "set",
                       "p": "payload.nodes",
                       "pt": "flow",
                       "to": "payload",
                       "tot": "msg"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1130,
               "y": 940,
               "wires": [
                   [
                       "73232d6356145c91",
                       "1f89021c7a98c311"
                   ]
               ]
           },
           {
               "id": "73232d6356145c91",
               "type": "debug",
               "z": "b8ad42061a6d5f2e",
               "name": "Geräte mit WLan",
               "active": false,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 1370,
               "y": 880,
               "wires": []
           },
           {
               "id": "1f89021c7a98c311",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload ? $count(payload) : 0",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1330,
               "y": 940,
               "wires": [
                   [
                       "1294df0c49809c46",
                       "ab79ca8d13f7e817"
                   ]
               ]
           },
           {
               "id": "1294df0c49809c46",
               "type": "debug",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl Geräte WLan",
               "active": false,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 1620,
               "y": 880,
               "wires": []
           },
           {
               "id": "ab79ca8d13f7e817",
               "type": "ioBroker out",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl WLan Geräte",
               "topic": "0_userdata.0.System.homee.WLan",
               "ack": "true",
               "autoCreate": "true",
               "stateName": "0_userdata.0.System.homee.WLan",
               "role": "",
               "payloadType": "number",
               "readonly": "false",
               "stateUnit": "",
               "stateMin": "",
               "stateMax": "",
               "x": 1620,
               "y": 940,
               "wires": []
           },
           {
               "id": "d8d565711fe0dd22",
               "type": "link in",
               "z": "b8ad42061a6d5f2e",
               "name": "",
               "links": [
                   "d87f2174cf715cf2"
               ],
               "x": 75,
               "y": 940,
               "wires": [
                   [
                       "e565ecbc06eb639f"
                   ]
               ]
           },
           {
               "id": "95b979349f1fd3f0",
               "type": "ioBroker out",
               "z": "b8ad42061a6d5f2e",
               "name": "Geräteliste",
               "topic": "0_userdata.0.System.homee.Tabelle",
               "ack": "true",
               "autoCreate": "true",
               "stateName": "0_userdata.0.System.homee.Tabelle",
               "role": "",
               "payloadType": "array",
               "readonly": "false",
               "stateUnit": "",
               "stateMin": "",
               "stateMax": "",
               "x": 1590,
               "y": 1220,
               "wires": []
           },
           {
               "id": "a5ac3eaebc5a142d",
               "type": "ioBroker out",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl nicht verfügbarer Geräte",
               "topic": "0_userdata.0.System.homee.NichtVerfügbar",
               "ack": "true",
               "autoCreate": "true",
               "stateName": "0_userdata.0.System.homee.NichtVerfügbar",
               "role": "",
               "payloadType": "number",
               "readonly": "false",
               "stateUnit": "",
               "stateMin": "",
               "stateMax": "",
               "x": 1650,
               "y": 380,
               "wires": []
           },
           {
               "id": "1a49f3e7a72eeb98",
               "type": "debug",
               "z": "b8ad42061a6d5f2e",
               "name": "inaktive Geräte",
               "active": false,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 1360,
               "y": 320,
               "wires": []
           },
           {
               "id": "33dcf435082928a3",
               "type": "comment",
               "z": "b8ad42061a6d5f2e",
               "name": "homee Geräteliste",
               "info": "",
               "x": 150,
               "y": 80,
               "wires": []
           },
           {
               "id": "1b3e55fcd8eadc58",
               "type": "debug",
               "z": "b8ad42061a6d5f2e",
               "name": "VIS Tabelle",
               "active": true,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 1350,
               "y": 1160,
               "wires": []
           },
           {
               "id": "9c7798317b60270e",
               "type": "json",
               "z": "b8ad42061a6d5f2e",
               "name": "Tabelle JSON",
               "property": "payload",
               "action": "str",
               "pretty": false,
               "x": 1360,
               "y": 1220,
               "wires": [
                   [
                       "95b979349f1fd3f0"
                   ]
               ]
           },
           {
               "id": "8bc0a02357eaa25a",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl Alle Geräte",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload ? $count(payload) : 0",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1130,
               "y": 240,
               "wires": [
                   [
                       "33eeadb2829047fd",
                       "858928dd781c86a9"
                   ]
               ]
           },
           {
               "id": "33eeadb2829047fd",
               "type": "debug",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl Alle Geräte",
               "active": false,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 1370,
               "y": 180,
               "wires": []
           },
           {
               "id": "858928dd781c86a9",
               "type": "ioBroker out",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl Aller Geräte",
               "topic": "0_userdata.0.System.homee.GeräteAnzahl",
               "ack": "true",
               "autoCreate": "true",
               "stateName": "0_userdata.0.System.homee.GeräteAnzahl",
               "role": "",
               "payloadType": "number",
               "readonly": "false",
               "stateUnit": "",
               "stateMin": "",
               "stateMax": "",
               "x": 1370,
               "y": 240,
               "wires": []
           },
           {
               "id": "6624873c35b06eae",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "Alle Batterie Geräte",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload[attributes[type =  8] or attributes[type =  69]]",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1130,
               "y": 1080,
               "wires": [
                   [
                       "0c5dce5940776e17",
                       "676c2655140cea7e"
                   ]
               ]
           },
           {
               "id": "0c5dce5940776e17",
               "type": "debug",
               "z": "b8ad42061a6d5f2e",
               "name": "Geräte mit Batterie",
               "active": false,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 1370,
               "y": 1020,
               "wires": []
           },
           {
               "id": "676c2655140cea7e",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload ? $count(payload) : 0",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1330,
               "y": 1080,
               "wires": [
                   [
                       "7cb6f5cee79a8d0b",
                       "841edb859544f935"
                   ]
               ]
           },
           {
               "id": "7cb6f5cee79a8d0b",
               "type": "debug",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl Geräte Batterie",
               "active": true,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 1620,
               "y": 1020,
               "wires": []
           },
           {
               "id": "841edb859544f935",
               "type": "ioBroker out",
               "z": "b8ad42061a6d5f2e",
               "name": "Anzahl Baterrie Geräte",
               "topic": "0_userdata.0.System.homee.GeräteBatterie",
               "ack": "true",
               "autoCreate": "true",
               "stateName": "0_userdata.0.System.homee.GeräteBatterie",
               "role": "",
               "payloadType": "number",
               "readonly": "false",
               "stateUnit": "",
               "stateMin": "",
               "stateMax": "",
               "x": 1620,
               "y": 1080,
               "wires": []
           },
           {
               "id": "84e0be29a596b9f6",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "decodeUrlComponents",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload ~> |$.nodes|{\"name\":$decodeUrlComponent(name),\t\"note\":$decodeUrlComponent(note),\t\"phonetic_name\":$decodeUrlComponent(phonetic_name)},\"attributes\"|",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 420,
               "y": 400,
               "wires": [
                   [
                       "8d240adaebd74c1b"
                   ]
               ]
           },
           {
               "id": "8d240adaebd74c1b",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "Alle Geräte",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload.nodes",
                       "tot": "msg"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 530,
               "y": 660,
               "wires": [
                   [
                       "76924e9c23983f3d"
                   ]
               ]
           },
           {
               "id": "76924e9c23983f3d",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "Geräte ausschliessen",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload ~> $filter(function($value){$value.id in [-1] != true})",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 740,
               "y": 660,
               "wires": [
                   [
                       "bc383b50669e8145"
                   ]
               ]
           },
           {
               "id": "1e1eba7ac4087fac",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "hole alle Geräte",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "{}",
                       "tot": "json"
                   },
                   {
                       "t": "set",
                       "p": "payload.nodes",
                       "pt": "msg",
                       "to": "homee.nodes",
                       "tot": "global"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 180,
               "y": 400,
               "wires": [
                   [
                       "84e0be29a596b9f6"
                   ]
               ]
           },
           {
               "id": "bf1c7f792a4007cf",
               "type": "inject",
               "z": "b8ad42061a6d5f2e",
               "name": "trigger",
               "props": [
                   {
                       "p": "payload"
                   }
               ],
               "repeat": "",
               "crontab": "",
               "once": false,
               "onceDelay": 0.1,
               "topic": "",
               "payload": "true",
               "payloadType": "bool",
               "x": 130,
               "y": 180,
               "wires": [
                   [
                       "1e1eba7ac4087fac"
                   ]
               ]
           },
           {
               "id": "dfb85691acadb5e8",
               "type": "change",
               "z": "b8ad42061a6d5f2e",
               "name": "VIS Tabelle 6",
               "rules": [
                   {
                       "t": "set",
                       "p": "protocols",
                       "pt": "msg",
                       "to": "[{\"id\":1,\"name\":\"Z-Wave\",\"color\":\"#886fa9\"},{\"id\":2,\"name\":\"ZigBee\",\"color\":\"#ee6c1e\"},{\"id\":3,\"name\":\"EnOcean\",\"color\":\"#44abb2\"},{\"id\":9,\"name\":\"WLAN\",\"color\":\"#8f8f8f\"},{\"id\":12,\"name\":\"WLAN\",\"color\":\"#8f8f8f\"}]",
                       "tot": "json"
                   },
                   {
                       "t": "set",
                       "p": "states",
                       "pt": "msg",
                       "to": "[{\"id\":1,\"name\":\"aktiv\",\"color\":\"green\"},{\"id\":2,\"name\":\"inaktiv\",\"color\":\"red\"},{\"id\":12,\"name\":\"wird aktualisiert\",\"color\":\"orange\"}]",
                       "tot": "json"
                   },
                   {
                       "t": "set",
                       "p": "battery",
                       "pt": "msg",
                       "to": "[{\"level\":30,\"color\":\"green\"},{\"level\":20,\"color\":\"yellow\"},{\"level\":15,\"color\":\"orange\"},{\"level\":0,\"color\":\"red\"}]",
                       "tot": "json"
                   },
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload.{\"name\" :name,\t        \"type\" : note,\t        \"protocol\" : ' <font color=\\\"' & $single($$.protocols, function($v){$v.id = protocol}).color & '\\\"> ' & $single($$.protocols, function($v){$v.id = protocol}).name,\t        \"state\" : ' <font color=\\\"' & $single($$.states, function($v){$v.id = state}).color & '\\\"> ' & $single($$.states, function($v){$v.id = state}).name,\t        \"battery\" : (attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]).type = 8 ? attributes[type=8 ].current_value : \t        (attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]).type = 69 ? attributes[type=69 ].current_value = 0 ? 100 : 0\t} ~> |$|{\"battery\" : $exists(battery) ? ' <font color=\\\"' & $filter($$.battery, function($v){battery >= $v.level})[0].color & '\\\"> ' & battery & \" %\" : \"Keine Batterie\"}|",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1110,
               "y": 1220,
               "wires": [
                   [
                       "9c7798317b60270e",
                       "1b3e55fcd8eadc58"
                   ]
               ]
           }
        ]
        

        Ein paar Sachen sind aber noch unklar

        1. Bei mir werden die Batteriewerte nicht mehr abgefragt, um den Fehler einzugrenzen, habe ich mal einen extra Flow gebaut und etwas gespielt
          5ae0a92b-50a6-4295-984e-abdea1188d0a-image.png

        [
           {
               "id": "c507c28e5ed6a166",
               "type": "tab",
               "label": "Flow 2",
               "disabled": false,
               "info": "",
               "env": []
           },
           {
               "id": "208825e13d14540f",
               "type": "change",
               "z": "c507c28e5ed6a166",
               "name": "decodeUrlComponents",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload ~> |$.nodes|{\"name\":$decodeUrlComponent(name),\t\"note\":$decodeUrlComponent(note),\t\"phonetic_name\":$decodeUrlComponent(phonetic_name)},\"attributes\"|",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 480,
               "y": 160,
               "wires": [
                   [
                       "0076bb0c1e2fd9bc"
                   ]
               ]
           },
           {
               "id": "0076bb0c1e2fd9bc",
               "type": "change",
               "z": "c507c28e5ed6a166",
               "name": "Alle Geräte",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload.nodes",
                       "tot": "msg"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 690,
               "y": 160,
               "wires": [
                   [
                       "1ae07a0e011d9194"
                   ]
               ]
           },
           {
               "id": "1ae07a0e011d9194",
               "type": "change",
               "z": "c507c28e5ed6a166",
               "name": "Geräte ausschliessen",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload ~> $filter(function($value){$value.id in [-1] != true})",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 900,
               "y": 160,
               "wires": [
                   [
                       "abed858e371852a5"
                   ]
               ]
           },
           {
               "id": "9f4ebda01b1eec38",
               "type": "change",
               "z": "c507c28e5ed6a166",
               "name": "hole alle Geräte",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "{}",
                       "tot": "json"
                   },
                   {
                       "t": "set",
                       "p": "payload.nodes",
                       "pt": "msg",
                       "to": "homee.nodes",
                       "tot": "global"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 280,
               "y": 160,
               "wires": [
                   [
                       "208825e13d14540f"
                   ]
               ]
           },
           {
               "id": "1edb395448d6c77b",
               "type": "inject",
               "z": "c507c28e5ed6a166",
               "name": "trigger",
               "props": [
                   {
                       "p": "payload"
                   }
               ],
               "repeat": "",
               "crontab": "",
               "once": false,
               "onceDelay": 0.1,
               "topic": "",
               "payload": "true",
               "payloadType": "bool",
               "x": 130,
               "y": 160,
               "wires": [
                   [
                       "9f4ebda01b1eec38"
                   ]
               ]
           },
           {
               "id": "abed858e371852a5",
               "type": "change",
               "z": "c507c28e5ed6a166",
               "name": "Alle Batterie Geräte",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload[attributes[type =  8]]",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1130,
               "y": 160,
               "wires": [
                   [
                       "6c6e91e9d10ad002"
                   ]
               ]
           },
           {
               "id": "6c6e91e9d10ad002",
               "type": "change",
               "z": "c507c28e5ed6a166",
               "name": "Anzahl",
               "rules": [
                   {
                       "t": "set",
                       "p": "payload",
                       "pt": "msg",
                       "to": "payload ? $count(payload) : 0",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1310,
               "y": 160,
               "wires": [
                   [
                       "f4714e42703b6af2"
                   ]
               ]
           },
           {
               "id": "f4714e42703b6af2",
               "type": "debug",
               "z": "c507c28e5ed6a166",
               "name": "Anzahl Geräte Batterie",
               "active": true,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 1500,
               "y": 160,
               "wires": []
           },
           {
               "id": "ebeb0ab972189145",
               "type": "function",
               "z": "c507c28e5ed6a166",
               "name": "Abfrage Batterie",
               "func": "const attributes = global.get('homee.attributes');\nconst nodes = global.get('homee.nodes');\nvar batterie = 0;\n\nvar test = attributes.filter(attribute => ((attribute.type === 8) || (attribute.type === 69)))\n\ntest.forEach(function (attribute){\n    if (attribute.type === 8) {\n        batterie ++\n    } \n})\n\nreturn {\n    \"payload\": batterie\n}\n\n",
               "outputs": 1,
               "noerr": 0,
               "initialize": "",
               "finalize": "",
               "libs": [],
               "x": 360,
               "y": 280,
               "wires": [
                   [
                       "d5179d2b54717b77"
                   ]
               ]
           },
           {
               "id": "d5179d2b54717b77",
               "type": "debug",
               "z": "c507c28e5ed6a166",
               "name": "debug 5",
               "active": true,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "false",
               "statusVal": "",
               "statusType": "auto",
               "x": 620,
               "y": 280,
               "wires": []
           },
           {
               "id": "6bfceebfb28b5d8f",
               "type": "inject",
               "z": "c507c28e5ed6a166",
               "name": "trigger",
               "props": [
                   {
                       "p": "payload"
                   }
               ],
               "repeat": "",
               "crontab": "",
               "once": false,
               "onceDelay": 0.1,
               "topic": "",
               "payload": "true",
               "payloadType": "bool",
               "x": 130,
               "y": 280,
               "wires": [
                   [
                       "ebeb0ab972189145"
                   ]
               ]
           }
        ]
        

        Dabei ist mir aufgefallen, dass in der Funktions Node folgendes Global geladen wird:

        const attributes = global.get('homee.attributes');
        const nodes = global.get('homee.nodes');
        

        Es wird zwar im oberen Flow die "nodes" geladen, aber die "attributes" habe ich nicht gefunden, kann darin der Fehler liegen?

        1. Was ist der Unterschied "hole alle Geräte" und "Alle Geräte"? Nach meiner Ansicht machen die beide das Gleiche und man könnte "Alle Geräte" herausnehmen
        mickym 1 Reply Last reply Reply Quote 0
        • mickym
          mickym Most Active @Oli last edited by mickym

          @oli
          zu 1.
          Nun Du musst halt schauen, was im Kontext steht. Meines Erachtens macht es keinen Sinn, die Attribute von den Nodes zu trennen, d.h. Du musst halt schauen, dass die Nodes im globalen Kontext ihre Attribute behalten. Falls die Indizes identisch sind, dann machen wir die Trennung wieder rückgängig. Sinnvoll ist es aber die Attribute bei den Nodes zu belassen, so wie Du es mir als Datei mit allen Geräten zur Verfügung gestellt hast.

          Wie gesagt ich würde das Trennen an der Quelle unterbinden. Da musst halt suchen, wo der globale Kontext geschrieben wird.

          zu 2.
          Na weglassen kannst erst mal nichts - die Nodes machen ja was.

          aber Du hast Recht ich habe und musst mich ja nach den Daten richten, die Du mir zur Verfügung gestellt und waren Deine Geräte unter Deiner Eigenschaft Nodes. 😉

          32812646-c9a6-49bb-9c1e-d0343e25b4f1-image.png

          deshalb habe ich das Ganze auch wieder unter Node gemacht. Anschliessend habe ich das Array auf die payload Ebene gehoben, weil diese Node Eigenschaft keinen Sinn macht.

          Natürlich hätte ich die Nodes auch gleich auf die payload Ebene heben können.

          4077c818-3a9f-4f9e-9689-c52b28b0ee4c-image.png

          Dann kannst die Node Dir die Node "Alle Geräte sparen".

          4c64a543-00a5-48f2-9322-8e74865bc2e4-image.png

          Dann musst aber in der Folgenode den Pfad auf $ ändern:

          7903362d-8faa-4cca-b0f6-dbd4209fec1c-image.png

          Mir ist das egal - Du musst halt dafür sorgen, dass die Attribute bei den Geräten bleiben, sowie Du mir die Daten zur Verfügung gestellt hast. Dafür musst Du halt sorgen.

          Sprich Du musst dafür sorgen, dass egal wo im globalen Kontext, die den zu den Nodes(Geräten) zugehörigen Eigenschaften auch erhalten bleiben und nicht getrennt werden.

          fc2bd621-e089-4de4-8f7e-756b49337e8a-image.png

          O 2 Replies Last reply Reply Quote 0
          • O
            Oli @mickym last edited by

            @mickym

            sorry, kaum sucht man 3 Stunden, hat man den Fehler auch gefunden
            df692219-923a-4150-b79e-c2220af292bf-image.png
            Da war noch der Filter auf die Attribute drin

            Jetzt laufen beide Flows optimal, nochmals danke für deine Geduld und Hilfe 👍

            1 Reply Last reply Reply Quote 1
            • O
              Oli @mickym last edited by

              @mickym

              Sorry, jetzt habe ich doch noch eine Frage, wie kann ich in Node Red rechnen?

              Geräte Gesamt - Geräte Batterie = Geräte Strom

              mickym 3 Replies Last reply Reply Quote 0
              • mickym
                mickym Most Active @Oli last edited by

                @oli sagte in Benötige Hilfe mit Node-Red in Verbindung mit homee:

                Geräte Batterie = Geräte Strom

                f1f785a5-18b6-4865-80e6-3b301ae1cdfc-image.png

                1 Reply Last reply Reply Quote 0
                • mickym
                  mickym Most Active @Oli last edited by mickym

                  @oli In dem speziellen Fall brauchst aber auch nicht rechnen, sondern kannst die Anzahl auch direkt aus der Tabelle ermitteln.

                  Wenn Du die Version genommen hast, dass die stromgebundenen Geräte kein battery Attribut haben - dann einfach Deine Tabelle analysieren - dann musst Du nichts speichern.

                  2af5221c-1e99-415d-a458-87e14549f212-image.png

                  [
                     {
                         "id": "7a511c39fa34881f",
                         "type": "change",
                         "z": "9c280ddf049b2b4d",
                         "name": "Analysiere Tabelle",
                         "rules": [
                             {
                                 "t": "set",
                                 "p": "payload",
                                 "pt": "msg",
                                 "to": "{\t   \"alle Geräte\": $count(payload),\t   \"stromgebundene Geräte\" : $count(payload) - $count(payload[battery]),\t   \"batteriegebundene Geräte\" : $count(payload[battery])\t}",
                                 "tot": "jsonata"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 1450,
                         "y": 4180,
                         "wires": [
                             [
                                 "9d6c1a64d4757373"
                             ]
                         ]
                     },
                     {
                         "id": "9d6c1a64d4757373",
                         "type": "debug",
                         "z": "9c280ddf049b2b4d",
                         "name": "Statistik",
                         "active": true,
                         "tosidebar": true,
                         "console": false,
                         "tostatus": false,
                         "complete": "payload",
                         "targetType": "msg",
                         "statusVal": "",
                         "statusType": "auto",
                         "x": 1660,
                         "y": 4180,
                         "wires": []
                     }
                  ]
                  

                  {
                     "alle Geräte": $count(payload),
                     "stromgebundene Geräte" : $count(payload) - $count(payload[battery]),
                     "batteriegebundene Geräte" : $count(payload[battery])
                  }
                  
                  1 Reply Last reply Reply Quote 0
                  • mickym
                    mickym Most Active @Oli last edited by mickym

                    @oli sagte in Benötige Hilfe mit Node-Red in Verbindung mit homee:

                    @mickym

                    Sorry, jetzt habe ich doch noch eine Frage, wie kann ich in Node Red rechnen?

                    Geräte Gesamt - Geräte Batterie = Geräte Strom

                    Im Prinzip kannst Du Dir ganzen Abfragen oben sparen, wenn Du die originalen Objekten in keinem Flow mehr brauchst. Du brauchst doch nur Deine Tabelle wieder rückwärts zu analysieren:

                    570f7fb6-d328-4775-b9c4-189291fc2a82-image.png

                    In der ChangeNode ("Anaylisiere Tabelle") fragst Du halt einfach Deine Tabelle ab - dann kannst Du dir den kompletten anderen Rest sparen

                    Sprich Dein gesamter Flow - lässt sich wie folgt reduzieren:

                    7d91cabd-4929-4fb3-90d1-4e239ab57b31-image.png

                    [
                        {
                            "id": "43da9c222d7086f2",
                            "type": "change",
                            "z": "9c280ddf049b2b4d",
                            "name": "decodeUrlComponents",
                            "rules": [
                                {
                                    "t": "set",
                                    "p": "payload",
                                    "pt": "msg",
                                    "to": "payload ~> |$.nodes|{\"name\":$decodeUrlComponent(name),\t\"note\":$decodeUrlComponent(note),\t\"phonetic_name\":$decodeUrlComponent(phonetic_name)}|",
                                    "tot": "jsonata"
                                }
                            ],
                            "action": "",
                            "property": "",
                            "from": "",
                            "to": "",
                            "reg": false,
                            "x": 840,
                            "y": 3180,
                            "wires": [
                                [
                                    "1e48720df6900f86"
                                ]
                            ]
                        },
                        {
                            "id": "1e48720df6900f86",
                            "type": "change",
                            "z": "9c280ddf049b2b4d",
                            "name": "Alle Geräte",
                            "rules": [
                                {
                                    "t": "set",
                                    "p": "payload",
                                    "pt": "msg",
                                    "to": "payload.nodes",
                                    "tot": "msg"
                                }
                            ],
                            "action": "",
                            "property": "",
                            "from": "",
                            "to": "",
                            "reg": false,
                            "x": 1050,
                            "y": 3180,
                            "wires": [
                                [
                                    "2cea4e8be5a4069e"
                                ]
                            ]
                        },
                        {
                            "id": "2cea4e8be5a4069e",
                            "type": "change",
                            "z": "9c280ddf049b2b4d",
                            "name": "Geräte ausschliessen",
                            "rules": [
                                {
                                    "t": "set",
                                    "p": "payload",
                                    "pt": "msg",
                                    "to": "payload ~> $filter(function($value){$value.id in [-1] != true})",
                                    "tot": "jsonata"
                                }
                            ],
                            "action": "",
                            "property": "",
                            "from": "",
                            "to": "",
                            "reg": false,
                            "x": 1260,
                            "y": 3180,
                            "wires": [
                                [
                                    "36b53e3276c727d9"
                                ]
                            ]
                        },
                        {
                            "id": "c6b56326d0c8cdc9",
                            "type": "change",
                            "z": "9c280ddf049b2b4d",
                            "name": "hole alle Geräte",
                            "rules": [
                                {
                                    "t": "set",
                                    "p": "payload",
                                    "pt": "msg",
                                    "to": "{}",
                                    "tot": "json"
                                },
                                {
                                    "t": "set",
                                    "p": "payload.nodes",
                                    "pt": "msg",
                                    "to": "homee.nodes",
                                    "tot": "global"
                                }
                            ],
                            "action": "",
                            "property": "",
                            "from": "",
                            "to": "",
                            "reg": false,
                            "x": 600,
                            "y": 3180,
                            "wires": [
                                [
                                    "43da9c222d7086f2"
                                ]
                            ]
                        },
                        {
                            "id": "8d512f0feef390b1",
                            "type": "inject",
                            "z": "9c280ddf049b2b4d",
                            "name": "trigger",
                            "props": [
                                {
                                    "p": "payload"
                                }
                            ],
                            "repeat": "",
                            "crontab": "",
                            "once": false,
                            "onceDelay": 0.1,
                            "topic": "",
                            "payload": "true",
                            "payloadType": "bool",
                            "x": 430,
                            "y": 3180,
                            "wires": [
                                [
                                    "c6b56326d0c8cdc9"
                                ]
                            ]
                        },
                        {
                            "id": "dfd67d5090a5ee3c",
                            "type": "change",
                            "z": "9c280ddf049b2b4d",
                            "name": "",
                            "rules": [
                                {
                                    "t": "move",
                                    "p": "payload",
                                    "pt": "msg",
                                    "to": "device",
                                    "tot": "msg"
                                }
                            ],
                            "action": "",
                            "property": "",
                            "from": "",
                            "to": "",
                            "reg": false,
                            "x": 700,
                            "y": 3280,
                            "wires": [
                                [
                                    "40ce65fe6c573d84"
                                ]
                            ]
                        },
                        {
                            "id": "40ce65fe6c573d84",
                            "type": "change",
                            "z": "9c280ddf049b2b4d",
                            "name": "hole alle Geräte",
                            "rules": [
                                {
                                    "t": "set",
                                    "p": "payload",
                                    "pt": "msg",
                                    "to": "{}",
                                    "tot": "json"
                                },
                                {
                                    "t": "set",
                                    "p": "payload.nodes",
                                    "pt": "msg",
                                    "to": "homee.nodes",
                                    "tot": "global"
                                }
                            ],
                            "action": "",
                            "property": "",
                            "from": "",
                            "to": "",
                            "reg": false,
                            "x": 920,
                            "y": 3280,
                            "wires": [
                                [
                                    "8d51d3dcf40934ba"
                                ]
                            ]
                        },
                        {
                            "id": "8d51d3dcf40934ba",
                            "type": "switch",
                            "z": "9c280ddf049b2b4d",
                            "name": "Nur wenn Gerätestatus geändert",
                            "property": "payload.nodes[id=$$.device.node.id].state = device.node.state",
                            "propertyType": "jsonata",
                            "rules": [
                                {
                                    "t": "false"
                                }
                            ],
                            "checkall": "true",
                            "repair": false,
                            "outputs": 1,
                            "x": 1170,
                            "y": 3280,
                            "wires": [
                                [
                                    "43da9c222d7086f2"
                                ]
                            ]
                        },
                        {
                            "id": "ce392b92472130c0",
                            "type": "switch",
                            "z": "9c280ddf049b2b4d",
                            "name": "verify device",
                            "property": "payload.node",
                            "propertyType": "msg",
                            "rules": [
                                {
                                    "t": "nnull"
                                }
                            ],
                            "checkall": "true",
                            "repair": false,
                            "outputs": 1,
                            "x": 490,
                            "y": 3280,
                            "wires": [
                                [
                                    "dfd67d5090a5ee3c"
                                ]
                            ]
                        },
                        {
                            "id": "5af35c4e9a5c92c8",
                            "type": "link in",
                            "z": "9c280ddf049b2b4d",
                            "name": "",
                            "links": [
                                "d87f2174cf715cf2"
                            ],
                            "x": 355,
                            "y": 3280,
                            "wires": [
                                [
                                    "ce392b92472130c0"
                                ]
                            ]
                        },
                        {
                            "id": "36b53e3276c727d9",
                            "type": "change",
                            "z": "9c280ddf049b2b4d",
                            "name": "VIS Tabelle 6",
                            "rules": [
                                {
                                    "t": "set",
                                    "p": "protocols",
                                    "pt": "msg",
                                    "to": "[{\"id\":1,\"name\":\"ZWave\"},{\"id\":2,\"name\":\"Zigbee\"},{\"id\":3,\"name\":\"EnOcean\"},{\"id\":9,\"name\":\"WLan\"}]",
                                    "tot": "json"
                                },
                                {
                                    "t": "set",
                                    "p": "states",
                                    "pt": "msg",
                                    "to": "[{\"id\":1,\"name\":\"aktiv\",\"color\":\"green\"},{\"id\":2,\"name\":\"inaktiv\",\"color\":\"rot\"},{\"id\":12,\"name\":\"wird aktualisiert\",\"color\":\"orange\"}]",
                                    "tot": "json"
                                },
                                {
                                    "t": "set",
                                    "p": "battery",
                                    "pt": "msg",
                                    "to": "[{\"level\":30,\"color\":\"green\"},{\"level\":20,\"color\":\"yellow\"},{\"level\":15,\"color\":\"orange\"},{\"level\":0,\"color\":\"red\"}]",
                                    "tot": "json"
                                },
                                {
                                    "t": "set",
                                    "p": "payload",
                                    "pt": "msg",
                                    "to": "payload.{\"name\" :name,\t        \"type\" : cube_type,\t        \"protocol\" : $single($$.protocols, function($v){$v.id = protocol}).name,\t        \"state\" : ' <font color=\\\"' & $single($$.states, function($v){$v.id = state}).color & '\\\"> ' & $single($$.states, function($v){$v.id = state}).name,\t        \"battery\" : (attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]).type = 8 ? attributes[type=8 ].current_value : \t        (attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]).type = 69 ? attributes[type=69 ].current_value = 0 ? 100 : 0\t} ~> |$|{\"battery\" : $exists(battery) ? ' <font color=\\\"' & $filter($$.battery, function($v){battery >= $v.level})[0].color & '\\\"> ' & battery & \" %\"}|",
                                    "tot": "jsonata"
                                }
                            ],
                            "action": "",
                            "property": "",
                            "from": "",
                            "to": "",
                            "reg": false,
                            "x": 1490,
                            "y": 3180,
                            "wires": [
                                [
                                    "39141a4dea9b6dfe",
                                    "be5b77b1fa74bc57"
                                ]
                            ]
                        },
                        {
                            "id": "39141a4dea9b6dfe",
                            "type": "debug",
                            "z": "9c280ddf049b2b4d",
                            "name": "VIS Tabelle 6",
                            "active": true,
                            "tosidebar": true,
                            "console": false,
                            "tostatus": false,
                            "complete": "payload",
                            "targetType": "msg",
                            "statusVal": "",
                            "statusType": "auto",
                            "x": 1690,
                            "y": 3180,
                            "wires": []
                        },
                        {
                            "id": "be5b77b1fa74bc57",
                            "type": "change",
                            "z": "9c280ddf049b2b4d",
                            "name": "Analysiere Tabelle",
                            "rules": [
                                {
                                    "t": "set",
                                    "p": "payload",
                                    "pt": "msg",
                                    "to": "{\t   \"alle Geräte\": $count(payload),\t   \"stromgebundene Geräte\" : $count(payload) - $count(payload[battery]),\t   \"batteriegebundene Geräte\" : $count(payload[battery]),\t   \"aktive Geräte\" : $count(payload[$contains(state, \" aktiv\")]),\t   \"inaktive Geräte\" : $count(payload[$contains(state, \" inaktiv\")]),\t   \"aktualisierende Geräte\" : $count(payload[$contains(state, \" wird aktualisiert\")]),\t   \"Protokolle\" : {\t       \"ZWave\" : $count(payload[protocol = \"ZWave\"]),\t       \"Zigbee\" : $count(payload[protocol = \"Zigbee\"]),\t       \"EnOcean\" : $count(payload[protocol = \"EnOcean\"]),\t       \"WLan\": $count(payload[protocol = \"WLan\"]) \t   }\t}",
                                    "tot": "jsonata"
                                }
                            ],
                            "action": "",
                            "property": "",
                            "from": "",
                            "to": "",
                            "reg": false,
                            "x": 1690,
                            "y": 3260,
                            "wires": [
                                [
                                    "f889528021dc2fb8"
                                ]
                            ]
                        },
                        {
                            "id": "f889528021dc2fb8",
                            "type": "debug",
                            "z": "9c280ddf049b2b4d",
                            "name": "Statistik",
                            "active": true,
                            "tosidebar": true,
                            "console": false,
                            "tostatus": false,
                            "complete": "payload",
                            "targetType": "msg",
                            "statusVal": "",
                            "statusType": "auto",
                            "x": 1900,
                            "y": 3260,
                            "wires": []
                        }
                    ]
                    

                    Wie gesagt das meiste diente zur Demonstration und dass Du damit üben kannst.

                    Eleganter und vielseitiger ist aber natürlich die Analyse der Objekte direkt.

                    In diesem Fall greift man bei der Analyse auf die originalen Objekte und Eigenschaften zurück:

                    ac1d557d-dfa6-4a39-b4f5-f06a647c5923-image.png

                    [
                       {
                           "id": "43da9c222d7086f2",
                           "type": "change",
                           "z": "9c280ddf049b2b4d",
                           "name": "decodeUrlComponents",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "payload ~> |$.nodes|{\"name\":$decodeUrlComponent(name),\t\"note\":$decodeUrlComponent(note),\t\"phonetic_name\":$decodeUrlComponent(phonetic_name)}|",
                                   "tot": "jsonata"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 840,
                           "y": 3180,
                           "wires": [
                               [
                                   "1e48720df6900f86"
                               ]
                           ]
                       },
                       {
                           "id": "1e48720df6900f86",
                           "type": "change",
                           "z": "9c280ddf049b2b4d",
                           "name": "Alle Geräte",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "payload.nodes",
                                   "tot": "msg"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 1050,
                           "y": 3180,
                           "wires": [
                               [
                                   "2cea4e8be5a4069e"
                               ]
                           ]
                       },
                       {
                           "id": "2cea4e8be5a4069e",
                           "type": "change",
                           "z": "9c280ddf049b2b4d",
                           "name": "Geräte ausschliessen",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "payload ~> $filter(function($value){$value.id in [-1] != true})",
                                   "tot": "jsonata"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 1260,
                           "y": 3180,
                           "wires": [
                               [
                                   "36b53e3276c727d9",
                                   "64292bbbaf8bfe9f",
                                   "0491ed58a98c8bdf"
                               ]
                           ]
                       },
                       {
                           "id": "c6b56326d0c8cdc9",
                           "type": "change",
                           "z": "9c280ddf049b2b4d",
                           "name": "hole alle Geräte",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "{}",
                                   "tot": "json"
                               },
                               {
                                   "t": "set",
                                   "p": "payload.nodes",
                                   "pt": "msg",
                                   "to": "homee.nodes",
                                   "tot": "global"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 600,
                           "y": 3180,
                           "wires": [
                               [
                                   "43da9c222d7086f2"
                               ]
                           ]
                       },
                       {
                           "id": "8d512f0feef390b1",
                           "type": "inject",
                           "z": "9c280ddf049b2b4d",
                           "name": "trigger",
                           "props": [
                               {
                                   "p": "payload"
                               }
                           ],
                           "repeat": "",
                           "crontab": "",
                           "once": false,
                           "onceDelay": 0.1,
                           "topic": "",
                           "payload": "true",
                           "payloadType": "bool",
                           "x": 430,
                           "y": 3180,
                           "wires": [
                               [
                                   "c6b56326d0c8cdc9"
                               ]
                           ]
                       },
                       {
                           "id": "dfd67d5090a5ee3c",
                           "type": "change",
                           "z": "9c280ddf049b2b4d",
                           "name": "",
                           "rules": [
                               {
                                   "t": "move",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "device",
                                   "tot": "msg"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 700,
                           "y": 3280,
                           "wires": [
                               [
                                   "40ce65fe6c573d84"
                               ]
                           ]
                       },
                       {
                           "id": "40ce65fe6c573d84",
                           "type": "change",
                           "z": "9c280ddf049b2b4d",
                           "name": "hole alle Geräte",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "{}",
                                   "tot": "json"
                               },
                               {
                                   "t": "set",
                                   "p": "payload.nodes",
                                   "pt": "msg",
                                   "to": "homee.nodes",
                                   "tot": "global"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 920,
                           "y": 3280,
                           "wires": [
                               [
                                   "8d51d3dcf40934ba"
                               ]
                           ]
                       },
                       {
                           "id": "8d51d3dcf40934ba",
                           "type": "switch",
                           "z": "9c280ddf049b2b4d",
                           "name": "Nur wenn Gerätestatus geändert",
                           "property": "payload.nodes[id=$$.device.node.id].state = device.node.state",
                           "propertyType": "jsonata",
                           "rules": [
                               {
                                   "t": "false"
                               }
                           ],
                           "checkall": "true",
                           "repair": false,
                           "outputs": 1,
                           "x": 1170,
                           "y": 3280,
                           "wires": [
                               [
                                   "43da9c222d7086f2"
                               ]
                           ]
                       },
                       {
                           "id": "ce392b92472130c0",
                           "type": "switch",
                           "z": "9c280ddf049b2b4d",
                           "name": "verify device",
                           "property": "payload.node",
                           "propertyType": "msg",
                           "rules": [
                               {
                                   "t": "nnull"
                               }
                           ],
                           "checkall": "true",
                           "repair": false,
                           "outputs": 1,
                           "x": 490,
                           "y": 3280,
                           "wires": [
                               [
                                   "dfd67d5090a5ee3c"
                               ]
                           ]
                       },
                       {
                           "id": "5af35c4e9a5c92c8",
                           "type": "link in",
                           "z": "9c280ddf049b2b4d",
                           "name": "",
                           "links": [
                               "d87f2174cf715cf2"
                           ],
                           "x": 355,
                           "y": 3280,
                           "wires": [
                               [
                                   "ce392b92472130c0"
                               ]
                           ]
                       },
                       {
                           "id": "36b53e3276c727d9",
                           "type": "change",
                           "z": "9c280ddf049b2b4d",
                           "name": "VIS Tabelle 6",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "protocols",
                                   "pt": "msg",
                                   "to": "[{\"id\":1,\"name\":\"ZWave\"},{\"id\":2,\"name\":\"Zigbee\"},{\"id\":3,\"name\":\"EnOcean\"},{\"id\":9,\"name\":\"WLan\"}]",
                                   "tot": "json"
                               },
                               {
                                   "t": "set",
                                   "p": "states",
                                   "pt": "msg",
                                   "to": "[{\"id\":1,\"name\":\"aktiv\",\"color\":\"green\"},{\"id\":2,\"name\":\"inaktiv\",\"color\":\"rot\"},{\"id\":12,\"name\":\"wird aktualisiert\",\"color\":\"orange\"}]",
                                   "tot": "json"
                               },
                               {
                                   "t": "set",
                                   "p": "battery",
                                   "pt": "msg",
                                   "to": "[{\"level\":30,\"color\":\"green\"},{\"level\":20,\"color\":\"yellow\"},{\"level\":15,\"color\":\"orange\"},{\"level\":0,\"color\":\"red\"}]",
                                   "tot": "json"
                               },
                               {
                                   "t": "set",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "payload.{\"name\" :name,\t        \"type\" : cube_type,\t        \"protocol\" : $single($$.protocols, function($v){$v.id = protocol}).name,\t        \"state\" : ' <font color=\\\"' & $single($$.states, function($v){$v.id = state}).color & '\\\"> ' & $single($$.states, function($v){$v.id = state}).name,\t        \"battery\" : (attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]).type = 8 ? attributes[type=8 ].current_value : \t        (attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]).type = 69 ? attributes[type=69 ].current_value = 0 ? 100 : 0\t} ~> |$|{\"battery\" : $exists(battery) ? ' <font color=\\\"' & $filter($$.battery, function($v){battery >= $v.level})[0].color & '\\\"> ' & battery & \" %\"}|",
                                   "tot": "jsonata"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 1490,
                           "y": 3180,
                           "wires": [
                               [
                                   "39141a4dea9b6dfe",
                                   "be5b77b1fa74bc57"
                               ]
                           ]
                       },
                       {
                           "id": "39141a4dea9b6dfe",
                           "type": "debug",
                           "z": "9c280ddf049b2b4d",
                           "name": "VIS Tabelle 6",
                           "active": false,
                           "tosidebar": true,
                           "console": false,
                           "tostatus": false,
                           "complete": "payload",
                           "targetType": "msg",
                           "statusVal": "",
                           "statusType": "auto",
                           "x": 1690,
                           "y": 3180,
                           "wires": []
                       },
                       {
                           "id": "be5b77b1fa74bc57",
                           "type": "change",
                           "z": "9c280ddf049b2b4d",
                           "d": true,
                           "name": "Analysiere Tabelle",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "{\t   \"alle Geräte\": $count(payload),\t   \"stromgebundene Geräte\" : $count(payload) - $count(payload[battery]),\t   \"batteriegebundene Geräte\" : $count(payload[battery]),\t   \"aktive Geräte\" : $count(payload[$contains(state, \" aktiv\")]),\t   \"inaktive Geräte\" : $count(payload[$contains(state, \" inaktiv\")]),\t   \"aktualisierende Geräte\" : $count(payload[$contains(state, \" wird aktualisiert\")]),\t   \"Protokolle\" : {\t       \"ZWave\" : $count(payload[protocol = \"ZWave\"]),\t       \"Zigbee\" : $count(payload[protocol = \"Zigbee\"]),\t       \"EnOcean\" : $count(payload[protocol = \"EnOcean\"]),\t       \"WLan\": $count(payload[protocol = \"WLan\"]) \t   }\t}",
                                   "tot": "jsonata"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 1690,
                           "y": 3240,
                           "wires": [
                               [
                                   "f889528021dc2fb8"
                               ]
                           ]
                       },
                       {
                           "id": "f889528021dc2fb8",
                           "type": "debug",
                           "z": "9c280ddf049b2b4d",
                           "d": true,
                           "name": "Statistik",
                           "active": false,
                           "tosidebar": true,
                           "console": false,
                           "tostatus": false,
                           "complete": "payload",
                           "targetType": "msg",
                           "statusVal": "",
                           "statusType": "auto",
                           "x": 1900,
                           "y": 3240,
                           "wires": []
                       },
                       {
                           "id": "64292bbbaf8bfe9f",
                           "type": "change",
                           "z": "9c280ddf049b2b4d",
                           "name": "Analysiere Objekte",
                           "rules": [
                               {
                                   "t": "set",
                                   "p": "payload",
                                   "pt": "msg",
                                   "to": "{\t   \"alle Geräte\": $count(payload),\t   \"stromgebundene Geräte\" : $count(payload) - $count(payload[attributes[type =  8] or  attributes[type =  69]]),\t   \"batteriegebundene Geräte\" : $count(payload[attributes[type =  8] or  attributes[type =  69]]),\t   \"aktive Geräte\" : $count(payload[state = 1]),\t   \"inaktive Geräte\" : $count(payload[state = 2]),\t   \"aktualisierende Geräte\" : $count(payload[state = 12]),\t   \"Protokolle\" : {\t       \"ZWave\" : $count(payload[protocol = 1]),\t       \"Zigbee\" : $count(payload[protocol = 2]),\t       \"EnOcean\" : $count(payload[protocol = 3]),\t       \"WLan\": $count(payload[protocol = 9]) \t   }\t}",
                                   "tot": "jsonata"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 1510,
                           "y": 3300,
                           "wires": [
                               [
                                   "87c117cf7391af3e"
                               ]
                           ]
                       },
                       {
                           "id": "87c117cf7391af3e",
                           "type": "debug",
                           "z": "9c280ddf049b2b4d",
                           "name": "Statistik",
                           "active": true,
                           "tosidebar": true,
                           "console": false,
                           "tostatus": false,
                           "complete": "payload",
                           "targetType": "msg",
                           "statusVal": "",
                           "statusType": "auto",
                           "x": 1720,
                           "y": 3300,
                           "wires": []
                       },
                       {
                           "id": "0491ed58a98c8bdf",
                           "type": "debug",
                           "z": "9c280ddf049b2b4d",
                           "name": "all",
                           "active": false,
                           "tosidebar": true,
                           "console": false,
                           "tostatus": false,
                           "complete": "payload",
                           "targetType": "msg",
                           "statusVal": "",
                           "statusType": "auto",
                           "x": 1490,
                           "y": 3120,
                           "wires": []
                       }
                    ]
                    

                    Aber nochmal - wenn Du lieber codieren und JS schreiben willst, dann mach das ruhig, ich will Dich nicht dazu überreden JSONATA zu nutzen:

                    Dann mach es wie in der function Node:

                    const attributes = global.get('homee.attributes');
                    const nodes = global.get('homee.nodes');
                    var batterie = 0;
                    
                    var test = attributes.filter(attribute => ((attribute.type === 8) || (attribute.type === 69)))
                    
                    test.forEach(function (attribute){
                        if (attribute.type === 8) {
                            batterie ++
                        } 
                    })
                    
                    return {
                        "payload": batterie
                    }
                    
                    

                    Du kannst gerne weiter in Schleifen zählen, wenn Dir das mehr liegt. Wobei ich es nicht ganz verstehe. Wenn Du eh ein Array ausfilterst mit attribute.type= 8 oder 69, warum Du dann nicht einfach die Anzahl der Elemente in dem Array als Anzahl batteriebetriebener Geräte nimmst.

                    Wäre es dann nicht sinnvoller 2 Arrays zu bilden?

                    Ich habe mal eine Javascript Code geschrieben, weil Dir das ja lieber ist. Aber wie gesagt ich verstehe diese Schleifen nicht:

                    O 1 Reply Last reply Reply Quote 0
                    • O
                      Oli @mickym last edited by

                      @mickym

                      ich will nur das Ergebnis in einen Datenpunkt schreiben, macht er aber wieder nicht
                      c99c0f9f-a404-4eaf-a9b8-3b9882c9cd2e-image.png

                      5c026ced-81f2-4e2e-83db-42fe8aaf7c67-image.png

                      mickym 1 Reply Last reply Reply Quote 0
                      • mickym
                        mickym Most Active @Oli last edited by

                        @oli da hängt doch keine iobroker_out Node dran???

                        O 1 Reply Last reply Reply Quote 0
                        • O
                          Oli @mickym last edited by

                          @mickym
                          das ist schon richtig, aber das Ergebniss stimmt ja auch nicht mit 1

                          mickym 1 Reply Last reply Reply Quote 0
                          • mickym
                            mickym Most Active @Oli last edited by mickym

                            @oli Du hängst die Change Node ja auch nicht an die Tabelle - also das Objekt sondern an die JSON Node. Die enthält nur noch einen String - den man nicht analysieren kann. Insofern ist egal was Du schreibst immer 1 ist da 1 (ein String) - 0 (nämlich nichts) immer 1 ist.

                            75c2387d-869a-4b30-a0de-17ce7f165dac-image.png

                            O 1 Reply Last reply Reply Quote 0
                            • O
                              Oli @mickym last edited by

                              @mickym
                              habe ich gerade getan, mit dem Ergebnis 0

                              363dbd0c-4391-48ba-b2a0-14ed80181deb-image.png

                              mickym 1 Reply Last reply Reply Quote 0
                              • mickym
                                mickym Most Active @Oli last edited by mickym

                                @oli Keine Ahnung mach halt mal die VIS Tabelle an, um zu sehen ob was ankommt. Bei mir geht das:

                                d3ec8ecd-a002-40eb-b976-978d1537abf4-image.png

                                Dann kommt halt da unten nichts an bei Dir.

                                O 1 Reply Last reply Reply Quote 0
                                • O
                                  Oli @mickym last edited by

                                  @mickym

                                  Tabelle ist da
                                  78d5ae4c-9cb5-4a9a-b084-6fc6b6e59463-image.png

                                  mickym 1 Reply Last reply Reply Quote 0
                                  • mickym
                                    mickym Most Active @Oli last edited by

                                    @oli Dann kann ich es nicht erklären - Syntax oder keine Ahnung - ich hab dir ja paar Flows zum Import angeboten. Fang halt Schritt für Schritt an. Zähl erst alles, dann alle batterie elemente und dann die Differenz. Ich kann Dir auch nicht helfen. Bei mir gehts. Hilft Dir zwar nicht, aber das musst du selbst lösen.

                                    O 1 Reply Last reply Reply Quote 0
                                    • O
                                      Oli @mickym last edited by

                                      @mickym

                                      habs gefunden, wenn kein Wert von der Batterie da ist, schreibe ich "Keine Batterie" rein, darum funktioniert das nicht

                                      mickym 1 Reply Last reply Reply Quote 0
                                      • mickym
                                        mickym Most Active @Oli last edited by mickym

                                        @oli Na das habe ich Dir ja gesagt, dass das nur funktioniert wenn ohne Batterie Eigenschaft.

                                        Dann brauchst aber auch nichts abziehen, dann kannst doch gleich filtern

                                        $count(payload[battery="Keine Batterie"])
                                        
                                        mickym 1 Reply Last reply Reply Quote 0
                                        • mickym
                                          mickym Most Active @mickym last edited by mickym

                                          @mickym Dann schreibst halt

                                          @oli sagte in Benötige Hilfe mit Node-Red in Verbindung mit homee:

                                          @mickym

                                          nochmals vielen Dank für deine Hilfe, hier jetzt mal der komplette Flow, sowie er jetzt aussieht

                                          [
                                             {
                                                 "id": "b8ad42061a6d5f2e",
                                                 "type": "tab",
                                                 "label": "homee Geräteliste",
                                                 "disabled": false,
                                                 "info": "",
                                                 "env": []
                                             },
                                             {
                                                 "id": "bc383b50669e8145",
                                                 "type": "junction",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "x": 960,
                                                 "y": 660,
                                                 "wires": [
                                                     [
                                                         "99528e0bbb0f2491",
                                                         "afc0236a6dc34b6c",
                                                         "3baf2b45228f3514",
                                                         "61efee2e1293f2f8",
                                                         "18ed2cb5de54b4e1",
                                                         "8bc0a02357eaa25a",
                                                         "6624873c35b06eae",
                                                         "dfb85691acadb5e8"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "99528e0bbb0f2491",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Alle inaktiven Geräte",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload[state = 2]",
                                                         "tot": "jsonata"
                                                     },
                                                     {
                                                         "t": "set",
                                                         "p": "homee.inactive",
                                                         "pt": "flow",
                                                         "to": "payload",
                                                         "tot": "msg"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 1140,
                                                 "y": 380,
                                                 "wires": [
                                                     [
                                                         "79c90e3a205144c8",
                                                         "1a49f3e7a72eeb98"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "79c90e3a205144c8",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload ? $count(payload) : 0",
                                                         "tot": "jsonata"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 1330,
                                                 "y": 380,
                                                 "wires": [
                                                     [
                                                         "6636132bd627fd5a",
                                                         "a5ac3eaebc5a142d"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "6636132bd627fd5a",
                                                 "type": "debug",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl inaktive Geräte",
                                                 "active": false,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "payload",
                                                 "targetType": "msg",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 1620,
                                                 "y": 320,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "afc0236a6dc34b6c",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Alle Z-Wave Geräte",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload[protocol = 1]",
                                                         "tot": "jsonata"
                                                     },
                                                     {
                                                         "t": "set",
                                                         "p": "payload.nodes",
                                                         "pt": "flow",
                                                         "to": "payload",
                                                         "tot": "msg"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 1130,
                                                 "y": 520,
                                                 "wires": [
                                                     [
                                                         "3f5d54fa1161d7c3",
                                                         "fb541319f5065b26"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "3f5d54fa1161d7c3",
                                                 "type": "debug",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Geräte mit Z-Wave",
                                                 "active": false,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "payload",
                                                 "targetType": "msg",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 1370,
                                                 "y": 460,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "fb541319f5065b26",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload ? $count(payload) : 0",
                                                         "tot": "jsonata"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 1330,
                                                 "y": 520,
                                                 "wires": [
                                                     [
                                                         "8b5f07919d5020d8",
                                                         "27bd5b6a0a11f64b"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "8b5f07919d5020d8",
                                                 "type": "debug",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl Geräte Z-Wave",
                                                 "active": false,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "payload",
                                                 "targetType": "msg",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 1620,
                                                 "y": 460,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "27bd5b6a0a11f64b",
                                                 "type": "ioBroker out",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl Z-Wave Geräte",
                                                 "topic": "0_userdata.0.System.homee.ZWave",
                                                 "ack": "true",
                                                 "autoCreate": "true",
                                                 "stateName": "0_userdata.0.System.homee.ZWave",
                                                 "role": "",
                                                 "payloadType": "number",
                                                 "readonly": "false",
                                                 "stateUnit": "",
                                                 "stateMin": "",
                                                 "stateMax": "",
                                                 "x": 1620,
                                                 "y": 520,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "3baf2b45228f3514",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Alle ZigBee Geräte",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload[protocol = 2]",
                                                         "tot": "jsonata"
                                                     },
                                                     {
                                                         "t": "set",
                                                         "p": "payload.nodes",
                                                         "pt": "flow",
                                                         "to": "payload",
                                                         "tot": "msg"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 1130,
                                                 "y": 660,
                                                 "wires": [
                                                     [
                                                         "b0d34d08416e6c10",
                                                         "adb5799593bc282a"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "b0d34d08416e6c10",
                                                 "type": "debug",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Geräte mit ZigBee",
                                                 "active": false,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "payload",
                                                 "targetType": "msg",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 1370,
                                                 "y": 600,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "adb5799593bc282a",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload ? $count(payload) : 0",
                                                         "tot": "jsonata"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 1330,
                                                 "y": 660,
                                                 "wires": [
                                                     [
                                                         "b553c35fe84e7ff1",
                                                         "a722c9c32ead9437"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "b553c35fe84e7ff1",
                                                 "type": "debug",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl Geräte ZigBee",
                                                 "active": false,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "payload",
                                                 "targetType": "msg",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 1620,
                                                 "y": 600,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "a722c9c32ead9437",
                                                 "type": "ioBroker out",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl ZigBee Geräte",
                                                 "topic": "0_userdata.0.System.homee.ZigBee",
                                                 "ack": "true",
                                                 "autoCreate": "true",
                                                 "stateName": "0_userdata.0.System.homee.ZigBee",
                                                 "role": "",
                                                 "payloadType": "number",
                                                 "readonly": "false",
                                                 "stateUnit": "",
                                                 "stateMin": "",
                                                 "stateMax": "",
                                                 "x": 1620,
                                                 "y": 660,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "306e283de06793a5",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "",
                                                 "rules": [
                                                     {
                                                         "t": "move",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "device",
                                                         "tot": "msg"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 380,
                                                 "y": 1080,
                                                 "wires": [
                                                     [
                                                         "3fcd14dd3eda98a3"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "3fcd14dd3eda98a3",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "hole alle Geräte",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "{}",
                                                         "tot": "json"
                                                     },
                                                     {
                                                         "t": "set",
                                                         "p": "payload.nodes",
                                                         "pt": "msg",
                                                         "to": "homee.nodes",
                                                         "tot": "global"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 600,
                                                 "y": 1080,
                                                 "wires": [
                                                     [
                                                         "3981f0834f60fe3d"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "3981f0834f60fe3d",
                                                 "type": "switch",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Nur wenn Gerätestatus geändert",
                                                 "property": "payload.nodes[id=$$.device.node.id].state = device.node.state",
                                                 "propertyType": "jsonata",
                                                 "rules": [
                                                     {
                                                         "t": "false"
                                                     }
                                                 ],
                                                 "checkall": "true",
                                                 "repair": false,
                                                 "outputs": 1,
                                                 "x": 250,
                                                 "y": 820,
                                                 "wires": [
                                                     [
                                                         "84e0be29a596b9f6"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "e565ecbc06eb639f",
                                                 "type": "switch",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "verify device",
                                                 "property": "payload.node",
                                                 "propertyType": "msg",
                                                 "rules": [
                                                     {
                                                         "t": "nnull"
                                                     }
                                                 ],
                                                 "checkall": "true",
                                                 "repair": false,
                                                 "outputs": 1,
                                                 "x": 170,
                                                 "y": 1080,
                                                 "wires": [
                                                     [
                                                         "306e283de06793a5"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "61efee2e1293f2f8",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Alle EnOcean Geräte",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload[protocol = 3]",
                                                         "tot": "jsonata"
                                                     },
                                                     {
                                                         "t": "set",
                                                         "p": "payload.nodes",
                                                         "pt": "flow",
                                                         "to": "payload",
                                                         "tot": "msg"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 1140,
                                                 "y": 800,
                                                 "wires": [
                                                     [
                                                         "6174c1fb73ccadf7",
                                                         "6bf0970636cc1e4a"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "6174c1fb73ccadf7",
                                                 "type": "debug",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Geräte mit EnOcean",
                                                 "active": false,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "payload",
                                                 "targetType": "msg",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 1380,
                                                 "y": 740,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "6bf0970636cc1e4a",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload ? $count(payload) : 0",
                                                         "tot": "jsonata"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 1330,
                                                 "y": 800,
                                                 "wires": [
                                                     [
                                                         "ec17a4f04cc1f205",
                                                         "39049bb60e657627"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "ec17a4f04cc1f205",
                                                 "type": "debug",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl Geräte EnOcean",
                                                 "active": false,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "payload",
                                                 "targetType": "msg",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 1630,
                                                 "y": 740,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "39049bb60e657627",
                                                 "type": "ioBroker out",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl EnOcean Geräte",
                                                 "topic": "0_userdata.0.System.homee.EnOcean",
                                                 "ack": "true",
                                                 "autoCreate": "true",
                                                 "stateName": "0_userdata.0.System.homee.EnOcean",
                                                 "role": "",
                                                 "payloadType": "number",
                                                 "readonly": "false",
                                                 "stateUnit": "",
                                                 "stateMin": "",
                                                 "stateMax": "",
                                                 "x": 1630,
                                                 "y": 800,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "18ed2cb5de54b4e1",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Alle WLan Geräte",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload[protocol = 9]",
                                                         "tot": "jsonata"
                                                     },
                                                     {
                                                         "t": "set",
                                                         "p": "payload.nodes",
                                                         "pt": "flow",
                                                         "to": "payload",
                                                         "tot": "msg"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 1130,
                                                 "y": 940,
                                                 "wires": [
                                                     [
                                                         "73232d6356145c91",
                                                         "1f89021c7a98c311"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "73232d6356145c91",
                                                 "type": "debug",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Geräte mit WLan",
                                                 "active": false,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "payload",
                                                 "targetType": "msg",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 1370,
                                                 "y": 880,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "1f89021c7a98c311",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload ? $count(payload) : 0",
                                                         "tot": "jsonata"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 1330,
                                                 "y": 940,
                                                 "wires": [
                                                     [
                                                         "1294df0c49809c46",
                                                         "ab79ca8d13f7e817"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "1294df0c49809c46",
                                                 "type": "debug",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl Geräte WLan",
                                                 "active": false,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "payload",
                                                 "targetType": "msg",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 1620,
                                                 "y": 880,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "ab79ca8d13f7e817",
                                                 "type": "ioBroker out",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl WLan Geräte",
                                                 "topic": "0_userdata.0.System.homee.WLan",
                                                 "ack": "true",
                                                 "autoCreate": "true",
                                                 "stateName": "0_userdata.0.System.homee.WLan",
                                                 "role": "",
                                                 "payloadType": "number",
                                                 "readonly": "false",
                                                 "stateUnit": "",
                                                 "stateMin": "",
                                                 "stateMax": "",
                                                 "x": 1620,
                                                 "y": 940,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "d8d565711fe0dd22",
                                                 "type": "link in",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "",
                                                 "links": [
                                                     "d87f2174cf715cf2"
                                                 ],
                                                 "x": 75,
                                                 "y": 940,
                                                 "wires": [
                                                     [
                                                         "e565ecbc06eb639f"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "95b979349f1fd3f0",
                                                 "type": "ioBroker out",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Geräteliste",
                                                 "topic": "0_userdata.0.System.homee.Tabelle",
                                                 "ack": "true",
                                                 "autoCreate": "true",
                                                 "stateName": "0_userdata.0.System.homee.Tabelle",
                                                 "role": "",
                                                 "payloadType": "array",
                                                 "readonly": "false",
                                                 "stateUnit": "",
                                                 "stateMin": "",
                                                 "stateMax": "",
                                                 "x": 1590,
                                                 "y": 1220,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "a5ac3eaebc5a142d",
                                                 "type": "ioBroker out",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl nicht verfügbarer Geräte",
                                                 "topic": "0_userdata.0.System.homee.NichtVerfügbar",
                                                 "ack": "true",
                                                 "autoCreate": "true",
                                                 "stateName": "0_userdata.0.System.homee.NichtVerfügbar",
                                                 "role": "",
                                                 "payloadType": "number",
                                                 "readonly": "false",
                                                 "stateUnit": "",
                                                 "stateMin": "",
                                                 "stateMax": "",
                                                 "x": 1650,
                                                 "y": 380,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "1a49f3e7a72eeb98",
                                                 "type": "debug",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "inaktive Geräte",
                                                 "active": false,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "payload",
                                                 "targetType": "msg",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 1360,
                                                 "y": 320,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "33dcf435082928a3",
                                                 "type": "comment",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "homee Geräteliste",
                                                 "info": "",
                                                 "x": 150,
                                                 "y": 80,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "1b3e55fcd8eadc58",
                                                 "type": "debug",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "VIS Tabelle",
                                                 "active": true,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "payload",
                                                 "targetType": "msg",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 1350,
                                                 "y": 1160,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "9c7798317b60270e",
                                                 "type": "json",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Tabelle JSON",
                                                 "property": "payload",
                                                 "action": "str",
                                                 "pretty": false,
                                                 "x": 1360,
                                                 "y": 1220,
                                                 "wires": [
                                                     [
                                                         "95b979349f1fd3f0"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "8bc0a02357eaa25a",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl Alle Geräte",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload ? $count(payload) : 0",
                                                         "tot": "jsonata"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 1130,
                                                 "y": 240,
                                                 "wires": [
                                                     [
                                                         "33eeadb2829047fd",
                                                         "858928dd781c86a9"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "33eeadb2829047fd",
                                                 "type": "debug",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl Alle Geräte",
                                                 "active": false,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "payload",
                                                 "targetType": "msg",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 1370,
                                                 "y": 180,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "858928dd781c86a9",
                                                 "type": "ioBroker out",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl Aller Geräte",
                                                 "topic": "0_userdata.0.System.homee.GeräteAnzahl",
                                                 "ack": "true",
                                                 "autoCreate": "true",
                                                 "stateName": "0_userdata.0.System.homee.GeräteAnzahl",
                                                 "role": "",
                                                 "payloadType": "number",
                                                 "readonly": "false",
                                                 "stateUnit": "",
                                                 "stateMin": "",
                                                 "stateMax": "",
                                                 "x": 1370,
                                                 "y": 240,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "6624873c35b06eae",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Alle Batterie Geräte",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload[attributes[type =  8] or attributes[type =  69]]",
                                                         "tot": "jsonata"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 1130,
                                                 "y": 1080,
                                                 "wires": [
                                                     [
                                                         "0c5dce5940776e17",
                                                         "676c2655140cea7e"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "0c5dce5940776e17",
                                                 "type": "debug",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Geräte mit Batterie",
                                                 "active": false,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "payload",
                                                 "targetType": "msg",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 1370,
                                                 "y": 1020,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "676c2655140cea7e",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload ? $count(payload) : 0",
                                                         "tot": "jsonata"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 1330,
                                                 "y": 1080,
                                                 "wires": [
                                                     [
                                                         "7cb6f5cee79a8d0b",
                                                         "841edb859544f935"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "7cb6f5cee79a8d0b",
                                                 "type": "debug",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl Geräte Batterie",
                                                 "active": true,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "payload",
                                                 "targetType": "msg",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 1620,
                                                 "y": 1020,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "841edb859544f935",
                                                 "type": "ioBroker out",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Anzahl Baterrie Geräte",
                                                 "topic": "0_userdata.0.System.homee.GeräteBatterie",
                                                 "ack": "true",
                                                 "autoCreate": "true",
                                                 "stateName": "0_userdata.0.System.homee.GeräteBatterie",
                                                 "role": "",
                                                 "payloadType": "number",
                                                 "readonly": "false",
                                                 "stateUnit": "",
                                                 "stateMin": "",
                                                 "stateMax": "",
                                                 "x": 1620,
                                                 "y": 1080,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "84e0be29a596b9f6",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "decodeUrlComponents",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload ~> |$.nodes|{\"name\":$decodeUrlComponent(name),\t\"note\":$decodeUrlComponent(note),\t\"phonetic_name\":$decodeUrlComponent(phonetic_name)},\"attributes\"|",
                                                         "tot": "jsonata"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 420,
                                                 "y": 400,
                                                 "wires": [
                                                     [
                                                         "8d240adaebd74c1b"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "8d240adaebd74c1b",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Alle Geräte",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload.nodes",
                                                         "tot": "msg"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 530,
                                                 "y": 660,
                                                 "wires": [
                                                     [
                                                         "76924e9c23983f3d"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "76924e9c23983f3d",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "Geräte ausschliessen",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload ~> $filter(function($value){$value.id in [-1] != true})",
                                                         "tot": "jsonata"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 740,
                                                 "y": 660,
                                                 "wires": [
                                                     [
                                                         "bc383b50669e8145"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "1e1eba7ac4087fac",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "hole alle Geräte",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "{}",
                                                         "tot": "json"
                                                     },
                                                     {
                                                         "t": "set",
                                                         "p": "payload.nodes",
                                                         "pt": "msg",
                                                         "to": "homee.nodes",
                                                         "tot": "global"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 180,
                                                 "y": 400,
                                                 "wires": [
                                                     [
                                                         "84e0be29a596b9f6"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "bf1c7f792a4007cf",
                                                 "type": "inject",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "trigger",
                                                 "props": [
                                                     {
                                                         "p": "payload"
                                                     }
                                                 ],
                                                 "repeat": "",
                                                 "crontab": "",
                                                 "once": false,
                                                 "onceDelay": 0.1,
                                                 "topic": "",
                                                 "payload": "true",
                                                 "payloadType": "bool",
                                                 "x": 130,
                                                 "y": 180,
                                                 "wires": [
                                                     [
                                                         "1e1eba7ac4087fac"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "dfb85691acadb5e8",
                                                 "type": "change",
                                                 "z": "b8ad42061a6d5f2e",
                                                 "name": "VIS Tabelle 6",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "protocols",
                                                         "pt": "msg",
                                                         "to": "[{\"id\":1,\"name\":\"Z-Wave\",\"color\":\"#886fa9\"},{\"id\":2,\"name\":\"ZigBee\",\"color\":\"#ee6c1e\"},{\"id\":3,\"name\":\"EnOcean\",\"color\":\"#44abb2\"},{\"id\":9,\"name\":\"WLAN\",\"color\":\"#8f8f8f\"},{\"id\":12,\"name\":\"WLAN\",\"color\":\"#8f8f8f\"}]",
                                                         "tot": "json"
                                                     },
                                                     {
                                                         "t": "set",
                                                         "p": "states",
                                                         "pt": "msg",
                                                         "to": "[{\"id\":1,\"name\":\"aktiv\",\"color\":\"green\"},{\"id\":2,\"name\":\"inaktiv\",\"color\":\"red\"},{\"id\":12,\"name\":\"wird aktualisiert\",\"color\":\"orange\"}]",
                                                         "tot": "json"
                                                     },
                                                     {
                                                         "t": "set",
                                                         "p": "battery",
                                                         "pt": "msg",
                                                         "to": "[{\"level\":30,\"color\":\"green\"},{\"level\":20,\"color\":\"yellow\"},{\"level\":15,\"color\":\"orange\"},{\"level\":0,\"color\":\"red\"}]",
                                                         "tot": "json"
                                                     },
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload.{\"name\" :name,\t        \"type\" : note,\t        \"protocol\" : ' <font color=\\\"' & $single($$.protocols, function($v){$v.id = protocol}).color & '\\\"> ' & $single($$.protocols, function($v){$v.id = protocol}).name,\t        \"state\" : ' <font color=\\\"' & $single($$.states, function($v){$v.id = state}).color & '\\\"> ' & $single($$.states, function($v){$v.id = state}).name,\t        \"battery\" : (attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]).type = 8 ? attributes[type=8 ].current_value : \t        (attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]).type = 69 ? attributes[type=69 ].current_value = 0 ? 100 : 0\t} ~> |$|{\"battery\" : $exists(battery) ? ' <font color=\\\"' & $filter($$.battery, function($v){battery >= $v.level})[0].color & '\\\"> ' & battery & \" %\" : \"Keine Batterie\"}|",
                                                         "tot": "jsonata"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 1110,
                                                 "y": 1220,
                                                 "wires": [
                                                     [
                                                         "9c7798317b60270e",
                                                         "1b3e55fcd8eadc58"
                                                     ]
                                                 ]
                                             }
                                          ]
                                          

                                          Ein paar Sachen sind aber noch unklar

                                          1. Bei mir werden die Batteriewerte nicht mehr abgefragt, um den Fehler einzugrenzen, habe ich mal einen extra Flow gebaut und etwas gespielt
                                            5ae0a92b-50a6-4295-984e-abdea1188d0a-image.png

                                          [
                                             {
                                                 "id": "c507c28e5ed6a166",
                                                 "type": "tab",
                                                 "label": "Flow 2",
                                                 "disabled": false,
                                                 "info": "",
                                                 "env": []
                                             },
                                             {
                                                 "id": "208825e13d14540f",
                                                 "type": "change",
                                                 "z": "c507c28e5ed6a166",
                                                 "name": "decodeUrlComponents",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload ~> |$.nodes|{\"name\":$decodeUrlComponent(name),\t\"note\":$decodeUrlComponent(note),\t\"phonetic_name\":$decodeUrlComponent(phonetic_name)},\"attributes\"|",
                                                         "tot": "jsonata"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 480,
                                                 "y": 160,
                                                 "wires": [
                                                     [
                                                         "0076bb0c1e2fd9bc"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "0076bb0c1e2fd9bc",
                                                 "type": "change",
                                                 "z": "c507c28e5ed6a166",
                                                 "name": "Alle Geräte",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload.nodes",
                                                         "tot": "msg"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 690,
                                                 "y": 160,
                                                 "wires": [
                                                     [
                                                         "1ae07a0e011d9194"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "1ae07a0e011d9194",
                                                 "type": "change",
                                                 "z": "c507c28e5ed6a166",
                                                 "name": "Geräte ausschliessen",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload ~> $filter(function($value){$value.id in [-1] != true})",
                                                         "tot": "jsonata"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 900,
                                                 "y": 160,
                                                 "wires": [
                                                     [
                                                         "abed858e371852a5"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "9f4ebda01b1eec38",
                                                 "type": "change",
                                                 "z": "c507c28e5ed6a166",
                                                 "name": "hole alle Geräte",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "{}",
                                                         "tot": "json"
                                                     },
                                                     {
                                                         "t": "set",
                                                         "p": "payload.nodes",
                                                         "pt": "msg",
                                                         "to": "homee.nodes",
                                                         "tot": "global"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 280,
                                                 "y": 160,
                                                 "wires": [
                                                     [
                                                         "208825e13d14540f"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "1edb395448d6c77b",
                                                 "type": "inject",
                                                 "z": "c507c28e5ed6a166",
                                                 "name": "trigger",
                                                 "props": [
                                                     {
                                                         "p": "payload"
                                                     }
                                                 ],
                                                 "repeat": "",
                                                 "crontab": "",
                                                 "once": false,
                                                 "onceDelay": 0.1,
                                                 "topic": "",
                                                 "payload": "true",
                                                 "payloadType": "bool",
                                                 "x": 130,
                                                 "y": 160,
                                                 "wires": [
                                                     [
                                                         "9f4ebda01b1eec38"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "abed858e371852a5",
                                                 "type": "change",
                                                 "z": "c507c28e5ed6a166",
                                                 "name": "Alle Batterie Geräte",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload[attributes[type =  8]]",
                                                         "tot": "jsonata"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 1130,
                                                 "y": 160,
                                                 "wires": [
                                                     [
                                                         "6c6e91e9d10ad002"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "6c6e91e9d10ad002",
                                                 "type": "change",
                                                 "z": "c507c28e5ed6a166",
                                                 "name": "Anzahl",
                                                 "rules": [
                                                     {
                                                         "t": "set",
                                                         "p": "payload",
                                                         "pt": "msg",
                                                         "to": "payload ? $count(payload) : 0",
                                                         "tot": "jsonata"
                                                     }
                                                 ],
                                                 "action": "",
                                                 "property": "",
                                                 "from": "",
                                                 "to": "",
                                                 "reg": false,
                                                 "x": 1310,
                                                 "y": 160,
                                                 "wires": [
                                                     [
                                                         "f4714e42703b6af2"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "f4714e42703b6af2",
                                                 "type": "debug",
                                                 "z": "c507c28e5ed6a166",
                                                 "name": "Anzahl Geräte Batterie",
                                                 "active": true,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "payload",
                                                 "targetType": "msg",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 1500,
                                                 "y": 160,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "ebeb0ab972189145",
                                                 "type": "function",
                                                 "z": "c507c28e5ed6a166",
                                                 "name": "Abfrage Batterie",
                                                 "func": "const attributes = global.get('homee.attributes');\nconst nodes = global.get('homee.nodes');\nvar batterie = 0;\n\nvar test = attributes.filter(attribute => ((attribute.type === 8) || (attribute.type === 69)))\n\ntest.forEach(function (attribute){\n    if (attribute.type === 8) {\n        batterie ++\n    } \n})\n\nreturn {\n    \"payload\": batterie\n}\n\n",
                                                 "outputs": 1,
                                                 "noerr": 0,
                                                 "initialize": "",
                                                 "finalize": "",
                                                 "libs": [],
                                                 "x": 360,
                                                 "y": 280,
                                                 "wires": [
                                                     [
                                                         "d5179d2b54717b77"
                                                     ]
                                                 ]
                                             },
                                             {
                                                 "id": "d5179d2b54717b77",
                                                 "type": "debug",
                                                 "z": "c507c28e5ed6a166",
                                                 "name": "debug 5",
                                                 "active": true,
                                                 "tosidebar": true,
                                                 "console": false,
                                                 "tostatus": false,
                                                 "complete": "false",
                                                 "statusVal": "",
                                                 "statusType": "auto",
                                                 "x": 620,
                                                 "y": 280,
                                                 "wires": []
                                             },
                                             {
                                                 "id": "6bfceebfb28b5d8f",
                                                 "type": "inject",
                                                 "z": "c507c28e5ed6a166",
                                                 "name": "trigger",
                                                 "props": [
                                                     {
                                                         "p": "payload"
                                                     }
                                                 ],
                                                 "repeat": "",
                                                 "crontab": "",
                                                 "once": false,
                                                 "onceDelay": 0.1,
                                                 "topic": "",
                                                 "payload": "true",
                                                 "payloadType": "bool",
                                                 "x": 130,
                                                 "y": 280,
                                                 "wires": [
                                                     [
                                                         "ebeb0ab972189145"
                                                     ]
                                                 ]
                                             }
                                          ]
                                          

                                          Dabei ist mir aufgefallen, dass in der Funktions Node folgendes Global geladen wird:

                                          const attributes = global.get('homee.attributes');
                                          const nodes = global.get('homee.nodes');
                                          

                                          Es wird zwar im oberen Flow die "nodes" geladen, aber die "attributes" habe ich nicht gefunden, kann darin der Fehler liegen?

                                          1. Was ist der Unterschied "hole alle Geräte" und "Alle Geräte"? Nach meiner Ansicht machen die beide das Gleiche und man könnte "Alle Geräte" herausnehmen

                                          Was ich bei Deiner funktion Node nicht verstehe, warum Du immer durch das Array iterierst, um die Anzahl der Geräte zu ermitteln. Du filterst doch immer, das sind doch Kopien deiner Arrays.

                                          413f52e6-46ac-448e-b9a0-1fb641900dd8-image.png

                                          Also wie gesagt - wenn Du lieber JS Code schreiben willst, dann mach das halt:

                                          [
                                             {
                                                 "id": "8209578814cd81f9",
                                                 "type": "function",
                                                 "z": "9c280ddf049b2b4d",
                                                 "name": "Abfrage Batterie",
                                                 "func": "var battery_devices = msg.payload.filter(device => (device.attributes.filter(attribute => ((attribute.type === 8) || (attribute.type === 69))).length));\nvar battery_devices_type8 = battery_devices.filter(device => (device.attributes.filter(attribute => (attribute.type === 8)).length));\nmsg.payload = {\n    \"Alle Batteriegeräte\": battery_devices.length,\n    \"Nur Typ8 Geräte\": battery_devices_type8.length\n}\n\nreturn msg",
                                                 "outputs": 1,
                                                 "noerr": 0,
                                                 "initialize": "",
                                                 "finalize": "",
                                                 "libs": [],
                                                 "x": 1400,
                                                 "y": 3400,
                                                 "wires": [
                                                     [
                                                         "35cb9381e4704b7a"
                                                     ]
                                                 ]
                                             }
                                          ]
                                          

                                          var battery_devices = msg.payload.filter(device => (device.attributes.filter(attribute => ((attribute.type === 8) || (attribute.type === 69))).length));
                                          var battery_devices_type8 = battery_devices.filter(device => (device.attributes.filter(attribute => (attribute.type === 8)).length));
                                          msg.payload = {
                                              "Alle Batteriegeräte": battery_devices.length,
                                              "Nur Typ8 Geräte": battery_devices_type8.length
                                          }
                                          
                                          return msg
                                          

                                          Meines Erachtens geht das ganze auch ohne Schleifen zum zählen.

                                          Wie gesagt - schreibe JS Code wenn Du willst, ich will Dich nicht davon abhalten.

                                          Solche Schleifen

                                          test.forEach(function (attribute){
                                              if (attribute.type === 8) {
                                                  batterie ++
                                              } 
                                          })
                                          

                                          sind doch unnötig wenn ich über ein filter das bereits gefilterte Array nochmal filtern und nur die Anzahl der Elemente ausgeben.

                                          1 Reply Last reply Reply Quote 0
                                          • mickym
                                            mickym Most Active last edited by mickym

                                            @oli sagte in Benötige Hilfe mit Node-Red in Verbindung mit homee:

                                            @mickym

                                            Sorry, jetzt habe ich doch noch eine Frage, wie kann ich in Node Red rechnen?

                                            Geräte Gesamt - Geräte Batterie = Geräte Strom

                                            491d001b-a1b4-4821-9aaa-a169fb848683-image.png

                                            Anstelle Deine Tabelle zu analysieren kann Du aber auch direkt Deine Geräte abfragen.

                                            Aber nochmal - wenn Du lieber codieren und JS schreiben willst, dann mach das ruhig, ich will Dich nicht dazu überreden JSONATA zu nutzen. Deswegen hier eine Version mit einer function Node:

                                            [
                                               {
                                                   "id": "43da9c222d7086f2",
                                                   "type": "change",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "decodeUrlComponents",
                                                   "rules": [
                                                       {
                                                           "t": "set",
                                                           "p": "payload",
                                                           "pt": "msg",
                                                           "to": "payload ~> |$.nodes|{\"name\":$decodeUrlComponent(name),\t\"note\":$decodeUrlComponent(note),\t\"phonetic_name\":$decodeUrlComponent(phonetic_name)}|",
                                                           "tot": "jsonata"
                                                       }
                                                   ],
                                                   "action": "",
                                                   "property": "",
                                                   "from": "",
                                                   "to": "",
                                                   "reg": false,
                                                   "x": 840,
                                                   "y": 3180,
                                                   "wires": [
                                                       [
                                                           "1e48720df6900f86"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "1e48720df6900f86",
                                                   "type": "change",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "Alle Geräte",
                                                   "rules": [
                                                       {
                                                           "t": "set",
                                                           "p": "payload",
                                                           "pt": "msg",
                                                           "to": "payload.nodes",
                                                           "tot": "msg"
                                                       }
                                                   ],
                                                   "action": "",
                                                   "property": "",
                                                   "from": "",
                                                   "to": "",
                                                   "reg": false,
                                                   "x": 1050,
                                                   "y": 3180,
                                                   "wires": [
                                                       [
                                                           "2cea4e8be5a4069e"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "2cea4e8be5a4069e",
                                                   "type": "change",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "Geräte ausschliessen",
                                                   "rules": [
                                                       {
                                                           "t": "set",
                                                           "p": "payload",
                                                           "pt": "msg",
                                                           "to": "payload ~> $filter(function($value){$value.id in [-1] != true})",
                                                           "tot": "jsonata"
                                                       }
                                                   ],
                                                   "action": "",
                                                   "property": "",
                                                   "from": "",
                                                   "to": "",
                                                   "reg": false,
                                                   "x": 1260,
                                                   "y": 3180,
                                                   "wires": [
                                                       [
                                                           "36b53e3276c727d9",
                                                           "64292bbbaf8bfe9f",
                                                           "0491ed58a98c8bdf",
                                                           "8209578814cd81f9"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "c6b56326d0c8cdc9",
                                                   "type": "change",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "hole alle Geräte",
                                                   "rules": [
                                                       {
                                                           "t": "set",
                                                           "p": "payload",
                                                           "pt": "msg",
                                                           "to": "{}",
                                                           "tot": "json"
                                                       },
                                                       {
                                                           "t": "set",
                                                           "p": "payload.nodes",
                                                           "pt": "msg",
                                                           "to": "homee.nodes",
                                                           "tot": "global"
                                                       }
                                                   ],
                                                   "action": "",
                                                   "property": "",
                                                   "from": "",
                                                   "to": "",
                                                   "reg": false,
                                                   "x": 600,
                                                   "y": 3180,
                                                   "wires": [
                                                       [
                                                           "43da9c222d7086f2"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "8d512f0feef390b1",
                                                   "type": "inject",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "trigger",
                                                   "props": [
                                                       {
                                                           "p": "payload"
                                                       }
                                                   ],
                                                   "repeat": "",
                                                   "crontab": "",
                                                   "once": false,
                                                   "onceDelay": 0.1,
                                                   "topic": "",
                                                   "payload": "true",
                                                   "payloadType": "bool",
                                                   "x": 430,
                                                   "y": 3180,
                                                   "wires": [
                                                       [
                                                           "c6b56326d0c8cdc9"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "dfd67d5090a5ee3c",
                                                   "type": "change",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "",
                                                   "rules": [
                                                       {
                                                           "t": "move",
                                                           "p": "payload",
                                                           "pt": "msg",
                                                           "to": "device",
                                                           "tot": "msg"
                                                       }
                                                   ],
                                                   "action": "",
                                                   "property": "",
                                                   "from": "",
                                                   "to": "",
                                                   "reg": false,
                                                   "x": 700,
                                                   "y": 3280,
                                                   "wires": [
                                                       [
                                                           "40ce65fe6c573d84"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "40ce65fe6c573d84",
                                                   "type": "change",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "hole alle Geräte",
                                                   "rules": [
                                                       {
                                                           "t": "set",
                                                           "p": "payload",
                                                           "pt": "msg",
                                                           "to": "{}",
                                                           "tot": "json"
                                                       },
                                                       {
                                                           "t": "set",
                                                           "p": "payload.nodes",
                                                           "pt": "msg",
                                                           "to": "homee.nodes",
                                                           "tot": "global"
                                                       }
                                                   ],
                                                   "action": "",
                                                   "property": "",
                                                   "from": "",
                                                   "to": "",
                                                   "reg": false,
                                                   "x": 920,
                                                   "y": 3280,
                                                   "wires": [
                                                       [
                                                           "8d51d3dcf40934ba"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "8d51d3dcf40934ba",
                                                   "type": "switch",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "Nur wenn Gerätestatus geändert",
                                                   "property": "payload.nodes[id=$$.device.node.id].state = device.node.state",
                                                   "propertyType": "jsonata",
                                                   "rules": [
                                                       {
                                                           "t": "false"
                                                       }
                                                   ],
                                                   "checkall": "true",
                                                   "repair": false,
                                                   "outputs": 1,
                                                   "x": 1170,
                                                   "y": 3280,
                                                   "wires": [
                                                       [
                                                           "43da9c222d7086f2"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "ce392b92472130c0",
                                                   "type": "switch",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "verify device",
                                                   "property": "payload.node",
                                                   "propertyType": "msg",
                                                   "rules": [
                                                       {
                                                           "t": "nnull"
                                                       }
                                                   ],
                                                   "checkall": "true",
                                                   "repair": false,
                                                   "outputs": 1,
                                                   "x": 490,
                                                   "y": 3280,
                                                   "wires": [
                                                       [
                                                           "dfd67d5090a5ee3c"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "5af35c4e9a5c92c8",
                                                   "type": "link in",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "",
                                                   "links": [
                                                       "d87f2174cf715cf2"
                                                   ],
                                                   "x": 355,
                                                   "y": 3280,
                                                   "wires": [
                                                       [
                                                           "ce392b92472130c0"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "36b53e3276c727d9",
                                                   "type": "change",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "VIS Tabelle 6",
                                                   "rules": [
                                                       {
                                                           "t": "set",
                                                           "p": "protocols",
                                                           "pt": "msg",
                                                           "to": "[{\"id\":1,\"name\":\"ZWave\"},{\"id\":2,\"name\":\"Zigbee\"},{\"id\":3,\"name\":\"EnOcean\"},{\"id\":9,\"name\":\"WLan\"}]",
                                                           "tot": "json"
                                                       },
                                                       {
                                                           "t": "set",
                                                           "p": "states",
                                                           "pt": "msg",
                                                           "to": "[{\"id\":1,\"name\":\"aktiv\",\"color\":\"green\"},{\"id\":2,\"name\":\"inaktiv\",\"color\":\"rot\"},{\"id\":12,\"name\":\"wird aktualisiert\",\"color\":\"orange\"}]",
                                                           "tot": "json"
                                                       },
                                                       {
                                                           "t": "set",
                                                           "p": "battery",
                                                           "pt": "msg",
                                                           "to": "[{\"level\":30,\"color\":\"green\"},{\"level\":20,\"color\":\"yellow\"},{\"level\":15,\"color\":\"orange\"},{\"level\":0,\"color\":\"red\"}]",
                                                           "tot": "json"
                                                       },
                                                       {
                                                           "t": "set",
                                                           "p": "payload",
                                                           "pt": "msg",
                                                           "to": "payload.{\"name\" :name,\t        \"type\" : cube_type,\t        \"protocol\" : $single($$.protocols, function($v){$v.id = protocol}).name,\t        \"state\" : ' <font color=\\\"' & $single($$.states, function($v){$v.id = state}).color & '\\\"> ' & $single($$.states, function($v){$v.id = state}).name,\t        \"battery\" : (attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]).type = 8 ? attributes[type=8 ].current_value : \t        (attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]).type = 69 ? attributes[type=69 ].current_value = 0 ? 100 : 0\t} ~> |$|{\"battery\" : $exists(battery) ? ' <font color=\\\"' & $filter($$.battery, function($v){battery >= $v.level})[0].color & '\\\"> ' & battery & \" %\"}|",
                                                           "tot": "jsonata"
                                                       }
                                                   ],
                                                   "action": "",
                                                   "property": "",
                                                   "from": "",
                                                   "to": "",
                                                   "reg": false,
                                                   "x": 1490,
                                                   "y": 3180,
                                                   "wires": [
                                                       [
                                                           "39141a4dea9b6dfe",
                                                           "be5b77b1fa74bc57"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "39141a4dea9b6dfe",
                                                   "type": "debug",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "VIS Tabelle 6",
                                                   "active": false,
                                                   "tosidebar": true,
                                                   "console": false,
                                                   "tostatus": false,
                                                   "complete": "payload",
                                                   "targetType": "msg",
                                                   "statusVal": "",
                                                   "statusType": "auto",
                                                   "x": 1690,
                                                   "y": 3180,
                                                   "wires": []
                                               },
                                               {
                                                   "id": "be5b77b1fa74bc57",
                                                   "type": "change",
                                                   "z": "9c280ddf049b2b4d",
                                                   "d": true,
                                                   "name": "Analysiere Tabelle",
                                                   "rules": [
                                                       {
                                                           "t": "set",
                                                           "p": "payload",
                                                           "pt": "msg",
                                                           "to": "{\t   \"alle Geräte\": $count(payload),\t   \"stromgebundene Geräte\" : $count(payload) - $count(payload[battery]),\t   \"batteriegebundene Geräte\" : $count(payload[battery]),\t   \"aktive Geräte\" : $count(payload[$contains(state, \" aktiv\")]),\t   \"inaktive Geräte\" : $count(payload[$contains(state, \" inaktiv\")]),\t   \"aktualisierende Geräte\" : $count(payload[$contains(state, \" wird aktualisiert\")]),\t   \"Protokolle\" : {\t       \"ZWave\" : $count(payload[protocol = \"ZWave\"]),\t       \"Zigbee\" : $count(payload[protocol = \"Zigbee\"]),\t       \"EnOcean\" : $count(payload[protocol = \"EnOcean\"]),\t       \"WLan\": $count(payload[protocol = \"WLan\"]) \t   }\t}",
                                                           "tot": "jsonata"
                                                       }
                                                   ],
                                                   "action": "",
                                                   "property": "",
                                                   "from": "",
                                                   "to": "",
                                                   "reg": false,
                                                   "x": 1690,
                                                   "y": 3240,
                                                   "wires": [
                                                       [
                                                           "f889528021dc2fb8"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "f889528021dc2fb8",
                                                   "type": "debug",
                                                   "z": "9c280ddf049b2b4d",
                                                   "d": true,
                                                   "name": "Statistik",
                                                   "active": false,
                                                   "tosidebar": true,
                                                   "console": false,
                                                   "tostatus": false,
                                                   "complete": "payload",
                                                   "targetType": "msg",
                                                   "statusVal": "",
                                                   "statusType": "auto",
                                                   "x": 1900,
                                                   "y": 3240,
                                                   "wires": []
                                               },
                                               {
                                                   "id": "64292bbbaf8bfe9f",
                                                   "type": "change",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "Analysiere Objekte",
                                                   "rules": [
                                                       {
                                                           "t": "set",
                                                           "p": "payload",
                                                           "pt": "msg",
                                                           "to": "{\t   \"alle Geräte\": $count(payload),\t   \"stromgebundene Geräte\" : $count(payload) - $count(payload[attributes[type =  8] or  attributes[type =  69]]),\t   \"batteriegebundene Geräte\" : $count(payload[attributes[type =  8] or  attributes[type =  69]]),\t   \"aktive Geräte\" : $count(payload[state = 1]),\t   \"inaktive Geräte\" : $count(payload[state = 2]),\t   \"aktualisierende Geräte\" : $count(payload[state = 12]),\t   \"Protokolle\" : {\t       \"ZWave\" : $count(payload[protocol = 1]),\t       \"Zigbee\" : $count(payload[protocol = 2]),\t       \"EnOcean\" : $count(payload[protocol = 3]),\t       \"WLan\": $count(payload[protocol = 9]) \t   }\t}",
                                                           "tot": "jsonata"
                                                       }
                                                   ],
                                                   "action": "",
                                                   "property": "",
                                                   "from": "",
                                                   "to": "",
                                                   "reg": false,
                                                   "x": 1510,
                                                   "y": 3300,
                                                   "wires": [
                                                       [
                                                           "87c117cf7391af3e"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "87c117cf7391af3e",
                                                   "type": "debug",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "Statistik",
                                                   "active": true,
                                                   "tosidebar": true,
                                                   "console": false,
                                                   "tostatus": false,
                                                   "complete": "payload",
                                                   "targetType": "msg",
                                                   "statusVal": "",
                                                   "statusType": "auto",
                                                   "x": 1720,
                                                   "y": 3300,
                                                   "wires": []
                                               },
                                               {
                                                   "id": "0491ed58a98c8bdf",
                                                   "type": "debug",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "all",
                                                   "active": true,
                                                   "tosidebar": true,
                                                   "console": false,
                                                   "tostatus": false,
                                                   "complete": "payload",
                                                   "targetType": "msg",
                                                   "statusVal": "",
                                                   "statusType": "auto",
                                                   "x": 1490,
                                                   "y": 3120,
                                                   "wires": []
                                               },
                                               {
                                                   "id": "8209578814cd81f9",
                                                   "type": "function",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "Abfrage Batterie",
                                                   "func": "var battery_devices = msg.payload.filter(device => (device.attributes.filter(attribute => ((attribute.type === 8) || (attribute.type === 69))).length));\nvar battery_devices_type8 = battery_devices.filter(device => (device.attributes.filter(attribute => (attribute.type === 8)).length));\nmsg.payload = {\n    \"Alle Batteriegeräte\": battery_devices.length,\n    \"Nur Typ8 Geräte\": battery_devices_type8.length\n}\n\nreturn msg",
                                                   "outputs": 1,
                                                   "noerr": 0,
                                                   "initialize": "",
                                                   "finalize": "",
                                                   "libs": [],
                                                   "x": 1520,
                                                   "y": 3400,
                                                   "wires": [
                                                       [
                                                           "35cb9381e4704b7a"
                                                       ]
                                                   ]
                                               },
                                               {
                                                   "id": "35cb9381e4704b7a",
                                                   "type": "debug",
                                                   "z": "9c280ddf049b2b4d",
                                                   "name": "function ",
                                                   "active": true,
                                                   "tosidebar": true,
                                                   "console": false,
                                                   "tostatus": false,
                                                   "complete": "payload",
                                                   "targetType": "msg",
                                                   "statusVal": "",
                                                   "statusType": "auto",
                                                   "x": 1700,
                                                   "y": 3400,
                                                   "wires": []
                                               }
                                            ]
                                            

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            1.1k
                                            Online

                                            31.7k
                                            Users

                                            79.7k
                                            Topics

                                            1.3m
                                            Posts

                                            node-red
                                            3
                                            121
                                            7191
                                            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