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.
    • O
      Oli @mickym last edited by Oli

      @mickym
      sorry, ich bin wahrscheinlich echt zu doof für das Programm

      Einstellungen Tabelle 3
      92735c1a-32cf-4af3-a4a7-019828f03ba5-image.png
      eff67914-e771-42f7-9a1e-4f9047f180b6-image.png

      Einstellungen JSON
      6f286f88-0f6a-4a81-be2c-55d37d96a6c4-image.png

      Ausgabe Debug

      {"name":"DG / Schlafzimmer / Bewegungsmelder / Kirsten","type":"# Philips Hue Bewegungsmelder","protocol":"Zigbee","state":" <font color=\\\"green\\\"> verfügbar"}
      

      Ausgabe Datenpunkt

      {
          "name": "DG / Schlafzimmer / Bewegungsmelder / Kirsten",
          "type": "# Philips Hue Bewegungsmelder",
          "protocol": "Zigbee",
          "state": " <font color=\\\"green\\\"> verfügbar"
        },
      

      2b988093-a7e0-419d-b23f-5a023f292fc0-image.png

      Was mach ich bitte falsch? 😥

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

        @oli

        Was stimmt denn daran nicht?

        8da67ed3-f4fc-4bda-9421-984c4b0e25f1-image.png

        {"name":"DG / Schlafzimmer / Bewegungsmelder / Kirsten","type":2,"protocol":"Zigbee","state":" <font color=\\\"#8f8f8f\\\"> aktiv"}
        

        =============================================================================

        Ansonsten wenn das mit dem Maskieren doppelt gemoppelt ist, dann machst einfach den Schrägstrich weg:

        1ca23545-a4c4-4481-8288-b5710fa67d15-image.png

        [
           {
               "id": "d8f367359c6ee390",
               "type": "change",
               "z": "9c280ddf049b2b4d",
               "name": "VIS Tabelle 4",
               "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\":\"#8f8f8f\"},{\"id\":2,\"name\":\"inaktiv\",\"color\":\"rot\"},{\"id\":12,\"name\":\"wird aktualisiert\",\"color\":\"orange\"}]",
                       "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}",
                       "tot": "jsonata"
                   }
               ],
               "action": "",
               "property": "",
               "from": "",
               "to": "",
               "reg": false,
               "x": 1210,
               "y": 3500,
               "wires": [
                   [
                       "1c63a19aebb970df"
                   ]
               ]
           },
           {
               "id": "1c63a19aebb970df",
               "type": "debug",
               "z": "9c280ddf049b2b4d",
               "name": "VIS Tabelle",
               "active": true,
               "tosidebar": true,
               "console": false,
               "tostatus": false,
               "complete": "payload",
               "targetType": "msg",
               "statusVal": "",
               "statusType": "auto",
               "x": 1410,
               "y": 3500,
               "wires": []
           }
        ]
        

        dann wird das automatisch gemacht:

        {"name":"DG / Schlafzimmer / Bewegungsmelder / Kirsten","type":2,"protocol":"Zigbee","state":" <font color=\"#8f8f8f\"> aktiv"}
        

        das Debug-Fenster stellt das Anführungszeichen eh korrekt dar und muss nicht demaskiert werden:

        65c26587-4846-4bcf-91f9-7638416e001d-image.png

        Ist halt immer eine Rumprobiererei mit den blöden Codes.

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

          @mickym
          kaum weiß man wo es steht, schon klappt es 🙂

          mickym 1 Reply 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:

            @mickym
            kaum weiß man wo es steht, schon klappt es 🙂

            Wollte gerade sagen:

            aff25508-ca3f-4713-8617-523623bc9d1d-image.png

            schaut bei mir gut aus. 😉

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

              @mickym
              hallo, ich bin es schon wieder mal. Ich wollte mir die Anzahl der Batteriebetriebenen Geräte auslesen, dazu habe ich bereits folgendes versucht:

              Filter der Attribute entfernt
              a8845536-35bb-4321-a17d-eb3d200f32f5-image.png

              payload ~> |$.nodes|{"name":$decodeUrlComponent(name),
              "note":$decodeUrlComponent(note),
              "phonetic_name":$decodeUrlComponent(phonetic_name)},""|
              

              Folgende Abfrage versucht, klappt aber leider nicht

              [
                 {
                     "id": "1eb34c24d42ff21e",
                     "type": "change",
                     "z": "b8ad42061a6d5f2e",
                     "name": "Alle Batterie Geräte",
                     "rules": [
                         {
                             "t": "set",
                             "p": "payload",
                             "pt": "msg",
                             "to": "payload[attribute.type = 8] ? $count(payload) : 0",
                             "tot": "jsonata"
                         }
                     ],
                     "action": "",
                     "property": "",
                     "from": "",
                     "to": "",
                     "reg": false,
                     "x": 1130,
                     "y": 1080,
                     "wires": [
                         [
                             "72e1f9d71bdd2dce",
                             "212533ec0cee1dab"
                         ]
                     ]
                 },
                 {
                     "id": "72e1f9d71bdd2dce",
                     "type": "debug",
                     "z": "b8ad42061a6d5f2e",
                     "name": "Geräte mit Batterie",
                     "active": true,
                     "tosidebar": true,
                     "console": false,
                     "tostatus": false,
                     "complete": "payload",
                     "targetType": "msg",
                     "statusVal": "",
                     "statusType": "auto",
                     "x": 1370,
                     "y": 1020,
                     "wires": []
                 },
                 {
                     "id": "212533ec0cee1dab",
                     "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": [
                         [
                             "5be85f72e357b53d"
                         ]
                     ]
                 },
                 {
                     "id": "5be85f72e357b53d",
                     "type": "debug",
                     "z": "b8ad42061a6d5f2e",
                     "name": "Anzahl Geräte Batterie",
                     "active": false,
                     "tosidebar": true,
                     "console": false,
                     "tostatus": false,
                     "complete": "payload",
                     "targetType": "msg",
                     "statusVal": "",
                     "statusType": "auto",
                     "x": 1620,
                     "y": 1080,
                     "wires": []
                 }
              ]
              

              hier mal eine Geräteabfrage

              {"node":{"id":26,"name":"DG%20%2F%20Bad%20%2F%20Heizung","profile":3006,"image":"default","favorite":0,"order":1,"protocol":1,"routing":0,"state":1,"state_changed":1678611603,"added":1601110067,"history":0,"cube_type":1,"note":"%23%20EUROtronic%20Spirit%20Z-Wave%20Plus","services":7,"phonetic_name":"Heizung%20Bad","owner":1,"security":0,"attributes":[{"id":225,"node_id":26,"instance":0,"minimum":0,"maximum":0,"current_value":0,"target_value":0,"last_value":0,"unit":"text","step_value":1,"editable":0,"type":44,"state":1,"last_changed":0,"changed_by":1,"changed_by_id":0,"based_on":1,"data":"4.61","name":""},{"id":226,"node_id":26,"instance":0,"minimum":0,"maximum":0,"current_value":0,"target_value":0,"last_value":0,"unit":"text","step_value":1,"editable":0,"type":45,"state":1,"last_changed":0,"changed_by":1,"changed_by_id":0,"based_on":1,"data":"0.15","name":""},{"id":227,"node_id":26,"instance":0,"minimum":0,"maximum":1,"current_value":0,"target_value":0,"last_value":0,"unit":"","step_value":1,"editable":1,"type":91,"state":1,"last_changed":1678428479,"changed_by":1,"changed_by_id":0,"based_on":1,"data":"","name":""},{"id":228,"node_id":26,"instance":0,"minimum":0,"maximum":100,"current_value":31,"target_value":31,"last_value":13,"unit":"%25","step_value":1,"editable":0,"type":18,"state":1,"last_changed":1678617181,"changed_by":1,"changed_by_id":0,"based_on":1,"data":"","name":"","options":{"automations":["step"]}},{"id":229,"node_id":26,"instance":0,"minimum":0,"maximum":100,"current_value":85,"target_value":85,"last_value":85,"unit":"%25","step_value":1,"editable":0,"type":8,"state":1,"last_changed":1678585502,"changed_by":1,"changed_by_id":0,"based_on":1,"data":"","name":"","options":{"history":{"day":182,"week":26,"month":6}}},{"id":230,"node_id":26,"instance":0,"minimum":0,"maximum":4,"current_value":1,"target_value":1,"last_value":1,"unit":"","step_value":1,"editable":1,"type":258,"state":1,"last_changed":1678428480,"changed_by":1,"changed_by_id":0,"based_on":1,"data":"","name":""},{"id":231,"node_id":26,"instance":0,"minimum":0,"maximum":180,"current_value":0,"target_value":0,"last_value":0,"unit":"%C2%B0","step_value":180,"editable":1,"type":90,"state":1,"last_changed":1601110068,"changed_by":1,"changed_by_id":0,"based_on":1,"data":"","name":""},{"id":232,"node_id":26,"instance":0,"minimum":0,"maximum":30,"current_value":0,"target_value":0,"last_value":5,"unit":"s","step_value":5,"editable":1,"type":259,"state":1,"last_changed":1635442644,"changed_by":1,"changed_by_id":0,"based_on":1,"data":"","name":""},{"id":233,"node_id":26,"instance":0,"minimum":0,"maximum":1,"current_value":1,"target_value":1,"last_value":0,"unit":"","step_value":1,"editable":1,"type":260,"state":1,"last_changed":1601110068,"changed_by":1,"changed_by_id":0,"based_on":1,"data":"","name":""},{"id":234,"node_id":26,"instance":0,"minimum":0,"maximum":3,"current_value":2,"target_value":2,"last_value":0,"unit":"","step_value":1,"editable":1,"type":261,"state":1,"last_changed":1601110068,"changed_by":1,"changed_by_id":0,"based_on":1,"data":"","name":""},{"id":235,"node_id":26,"instance":0,"minimum":-5,"maximum":5,"current_value":0,"target_value":0,"last_value":0,"unit":"%C2%B0C","step_value":0.1,"editable":1,"type":64,"state":1,"last_changed":1601110068,"changed_by":1,"changed_by_id":0,"based_on":1,"data":"","name":""},{"id":236,"node_id":26,"instance":0,"minimum":-50,"maximum":125,"current_value":16.73,"target_value":16.73,"last_value":16.64,"unit":"%C2%B0C","step_value":1,"editable":0,"type":5,"state":1,"last_changed":1678619101,"changed_by":1,"changed_by_id":0,"based_on":1,"data":"","name":"","options":{"can_observe":[5],"history":{"day":1,"week":26,"month":6}}},{"id":237,"node_id":26,"instance":0,"minimum":8,"maximum":28,"current_value":18,"target_value":18,"last_value":24,"unit":"%C2%B0C","step_value":0.5,"editable":1,"type":6,"state":1,"last_changed":1678611601,"changed_by":1,"changed_by_id":0,"based_on":1,"data":"","name":"","options":{"can_observe":[6],"automations":["step"],"history":{"day":35,"week":5,"month":1,"stepped":true}}},{"id":238,"node_id":26,"instance":0,"minimum":0,"maximum":1,"current_value":0,"target_value":0,"last_value":0,"unit":"","step_value":1,"editable":0,"type":69,"state":1,"last_changed":1674031595,"changed_by":1,"changed_by_id":0,"based_on":1,"data":"","name":"","options":{"history":{"day":182,"week":26,"month":6,"stepped":true}}},{"id":474,"node_id":26,"instance":0,"minimum":0,"maximum":1,"current_value":1,"target_value":1,"last_value":0,"unit":"","step_value":1,"editable":1,"type":385,"state":1,"last_changed":0,"changed_by":0,"changed_by_id":0,"based_on":0,"data":"","name":""}]}}
              

              Der Wert befindet sich irgendwo in den Attributen unter den Punkt "Typ" mit dem Wert "8" und ist nur vorhanden, wenn das Gerät mit Batterie betrieben wird, also bei keiner Steckdose oder der gleichen.

              Zusätzlich würde ich gerne den Punkt "current_value", der sich in den selben Attribut befindet, wie der Punkt "Typ" mit dem Wert "8" mit in meine Tabelle aufnehmen.

              Aber leider stelle ich mich wieder zu doof an

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

                @oli Na das ist ja auch nicht alles banal, was Du willst. Ich muss da auch oft rumprobieren, aber nutzt Du denn den Exerciser und beschäftigst Dich auch mit der Theorie?

                Hier mal alles im Exerciser - probierst Du den auch?: https://try.jsonata.org/V31K8xJjw -

                damit sollte Deine Tabelle entsprechend funktionieren. Also einfach diesen Code in Deine Change Node übernehmen.

                (den Export mache ich mal nicht, dann probierst Du direkt und schaust Dir bitte die Theorie dazu an).

                896b44c1-f202-4fdc-9cba-61cd270dcb1a-image.png

                Hier die Abfrage Deiner Batterie betriebenen Geräte:

                [
                   {
                       "id": "6624873c35b06eae",
                       "type": "change",
                       "z": "9c280ddf049b2b4d",
                       "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": 1270,
                       "y": 3400,
                       "wires": [
                           [
                               "0c5dce5940776e17",
                               "676c2655140cea7e"
                           ]
                       ]
                   },
                   {
                       "id": "0c5dce5940776e17",
                       "type": "debug",
                       "z": "9c280ddf049b2b4d",
                       "name": "Geräte mit Batterie",
                       "active": false,
                       "tosidebar": true,
                       "console": false,
                       "tostatus": false,
                       "complete": "payload",
                       "targetType": "msg",
                       "statusVal": "",
                       "statusType": "auto",
                       "x": 1510,
                       "y": 3340,
                       "wires": []
                   },
                   {
                       "id": "676c2655140cea7e",
                       "type": "change",
                       "z": "9c280ddf049b2b4d",
                       "name": "Anzahl",
                       "rules": [
                           {
                               "t": "set",
                               "p": "payload",
                               "pt": "msg",
                               "to": "payload ? $count(payload) : 0",
                               "tot": "jsonata"
                           }
                       ],
                       "action": "",
                       "property": "",
                       "from": "",
                       "to": "",
                       "reg": false,
                       "x": 1470,
                       "y": 3400,
                       "wires": [
                           [
                               "7cb6f5cee79a8d0b"
                           ]
                       ]
                   },
                   {
                       "id": "7cb6f5cee79a8d0b",
                       "type": "debug",
                       "z": "9c280ddf049b2b4d",
                       "name": "Anzahl Geräte Batterie",
                       "active": true,
                       "tosidebar": true,
                       "console": false,
                       "tostatus": false,
                       "complete": "payload",
                       "targetType": "msg",
                       "statusVal": "",
                       "statusType": "auto",
                       "x": 1660,
                       "y": 3400,
                       "wires": []
                   }
                ]
                

                Wenn Du willst, dass einfach keine Eigenschaft Batterie vorhanden sein soll, wenn es keine gibt, dann lässt Du die Abfrage weg.

                Dann siehst Du einfach bei den Geräten, die keine Batterie haben, diese Eigenschaft einfach nicht:

                4273547b-740a-457a-a9dc-9bd3a4a5d947-image.png

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

                  @oli So und bevor Du mich nun löcherst, wie Du verschiedene Farben je Batterielevel erzeugen kannst,
                  hier die Lösung: https://try.jsonata.org/B9k5-Z-Qk

                  Und hier exemplarisch ein paar Objekte als Auszug:

                  {
                      "name": "UG / Keller / Waschmaschine",
                      "type": 1,
                      "protocol": "ZWave",
                      "state": " <font color=\"green\"> aktiv",
                      "battery": "nicht vorhanden"
                    },
                    {
                      "name": "EG / Wohnzimmer / Multimedia",
                      "type": 1,
                      "protocol": "ZWave",
                      "state": " <font color=\"green\"> aktiv",
                      "battery": "nicht vorhanden"
                    },
                    {
                      "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 %"
                    }
                  

                  Wie gesagt ich tüftle da ja auch immer rum. Ich würde jedoch bitten, dass Du - bevor Du Dir was Neues einfallen lässt, vielleicht lieber Fragen zum Code stellst, um das ja irgendwann auch selbstständig machen zu können.

                  Ich helfe immer gerne, aber wenn Neuanforderungen im Tagesrhythmus kommen, dann hat man die Theorie kaum verinnerlicht. Ich habe dafür ja auch Wochen und Monate gebraucht.

                  Bei Fragen zum Code stehe ich gerne zur Verfügung.

                  Ich möchte nicht wissen wie lange ein Javascript Code ist, aber um diese Tabelle zu erzeugen:

                  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] ?
                   ' <font color=\"' & $filter($$.battery, function($v){attributes[type=8].current_value >= $v.level})[0].color & '\"> ' & attributes[type=8].current_value & " " & $decodeUrlComponent(attributes[type=8].unit) :
                   "nicht vorhanden"
                  }
                  

                  ist das alles was man braucht. 😉 - Du kannst aber auch gerne wieder mit function Nodes rumhantieren, wenn Dir das lieber ist. 😉

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

                    @mickym

                    vielen lieben Dank, dass du deine Zeit opferst und mich unterstützt. Der Vorteil ist, dass ich mich im Javascript etwas auskenne und teilweise weis, wie was schreiben muss, hier bin ich im absoluten Blindflug unterwegs und das nervt mich selber.

                    Eine Frage für habe ich aber noch, bevor ich das nerven aufhöre.

                    Ich habe festgestellt, dass es verschiedene Batterietypen zum abfragen gibt, jetzt wollte ich es ganz einfach lösen "Ist Typ 8 vorhanden, dann nehme Typ 8, ansonsten nehme Typ 69", aber was soll ich sagen, es klapp natürlich wieder nicht

                    a738797c-9be6-400a-a2ad-d920d27657ed-image.png

                    Muss noch eine hinterher Schieben, wo definiere ich die verschiedenen Farben?

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

                      @oli Nun so einfach mit dem typ 8 und 69 ist es nicht, aber ich versuche mal eine Lösung.

                      Muss noch eine hinterher Schieben, wo definiere ich die verschiedenen Farben?

                      So dass ist eine gute Frage und zeigt mir aber, dass Du den Code nicht verstanden hast. Also wäre es sinnvoll, wenn Du mir die entsprechende Codezeile postest und wir die dann zusammen erläutern.

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

                        @oli Das mit dem type 69 ist doch gelinde gesagt "Schwachsinn" 😉 - sorry. 😉

                        Da stehen keine sinnvollen Werte drin:

                        https://try.jsonata.org/NIdPsVKcm

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

                          @mickym
                          ich habe auch nie behauptet, dass in Node Red überhaupt schon was verstanden habe.

                          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] ?
                           ' <font color=\"' & $filter($$.battery, function($v){attributes[type=8].current_value >= $v.level})[0].color & '\"> ' & attributes[type=8].current_value & " " & $decodeUrlComponent(attributes[type=8].unit) :
                           "nicht vorhanden"
                          }
                          

                          Also, dass ist ja dein Code, der der unten in die letzte Regel der Change Node rein muss
                          0c2378db-0e0f-40ec-8619-06ad500937f9-image.png

                          Ich würde eine neue Regel anlegen:
                          f8d83246-e4be-4fe4-85da-fbdcb6962274-image.png

                          Und ihr der Code

                          [{"id":attributes[type=8].current_value <= 30,"name":attributes[type=8].current_value,"color":"yellow"},{"id":attributes[type=8].current_value <= 20,"name":attributes[type=8].current_value,"color":"red"},{"id":attributes[type=8].current_value >= 30,"name":attributes[type=8].current_value,"color":"green"}]
                          
                          mickym 1 Reply Last reply Reply Quote 0
                          • O
                            Oli last edited by

                            @mickym

                            [{"id":268,"node_id":32,"instance":0,"minimum":0,"maximum":50,"current_value":15.3,"target_value":15.3,"last_value":15.4,"unit":"%C2%B0C","step_value":0.5,"editable":0,"type":5,"state":1,"last_changed":1678639577,"changed_by":1,"changed_by_id":0,"based_on":4,"data":"","name":"","options":{"history":{"day":1,"week":26,"month":6}}},{"id":269,"node_id":32,"instance":0,"minimum":0,"maximum":100,"current_value":42,"target_value":42,"last_value":41,"unit":"%25","step_value":1,"editable":0,"type":7,"state":1,"last_changed":1678641980,"changed_by":1,"changed_by_id":0,"based_on":4,"data":"","name":"","options":{"history":{"day":1,"week":26,"month":6}}},{"id":270,"node_id":32,"instance":0,"minimum":0,"maximum":5000,"current_value":538,"target_value":538,"last_value":537,"unit":"ppm","step_value":50,"editable":0,"type":20,"state":1,"last_changed":1678641980,"changed_by":1,"changed_by_id":0,"based_on":4,"data":"","name":"","options":{"history":{"day":1,"week":26,"month":6}}},{"id":271,"node_id":32,"instance":0,"minimum":0,"maximum":4,"current_value":4,"target_value":4,"last_value":3,"unit":"n%2Fa","step_value":1,"editable":0,"type":33,"state":1,"last_changed":1677590493,"changed_by":1,"changed_by_id":0,"based_on":4,"data":"","name":""},{"id":272,"node_id":32,"instance":0,"minimum":0,"maximum":1,"current_value":0,"target_value":0,"last_value":1,"unit":"n%2Fa","step_value":1,"editable":0,"type":69,"state":1,"last_changed":1666168057,"changed_by":1,"changed_by_id":0,"based_on":4,"data":"","name":"","options":{"history":{"day":182,"week":26,"month":6,"stepped":true}}},{"id":478,"node_id":32,"instance":0,"minimum":0,"maximum":1,"current_value":1,"target_value":1,"last_value":0,"unit":"","step_value":1,"editable":1,"type":385,"state":1,"last_changed":0,"changed_by":0,"changed_by_id":0,"based_on":0,"data":"","name":""}]
                            

                            Normalerweise sollte da 0, oder 1 da stehen für den Batteriealarm

                            mickym 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
                              ich habe auch nie behauptet, dass in Node Red überhaupt schon was verstanden habe.

                              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] ?
                               ' <font color=\"' & $filter($$.battery, function($v){attributes[type=8].current_value >= $v.level})[0].color & '\"> ' & attributes[type=8].current_value & " " & $decodeUrlComponent(attributes[type=8].unit) :
                               "nicht vorhanden"
                              }
                              

                              Also, dass ist ja dein Code, der der unten in die letzte Regel der Change Node rein muss
                              0c2378db-0e0f-40ec-8619-06ad500937f9-image.png

                              Ich würde eine neue Regel anlegen:
                              f8d83246-e4be-4fe4-85da-fbdcb6962274-image.png

                              Und ihr der Code

                              [{"id":attributes[type=8].current_value <= 30,"name":attributes[type=8].current_value,"color":"yellow"},{"id":attributes[type=8].current_value <= 20,"name":attributes[type=8].current_value,"color":"red"},{"id":attributes[type=8].current_value >= 30,"name":attributes[type=8].current_value,"color":"green"}]
                              

                              Nun die relevante Zeile für die Batterie ist doch die:

                              "battery" : attributes[type=8] ?
                               ' <font color=\"' & $filter($$.battery, function($v){attributes[type=8].current_value >= $v.level})[0].color & '\"> ' & attributes[type=8].current_value & " " & $decodeUrlComponent(attributes[type=8].unit) :
                               "nicht vorhanden"
                              

                              und für das setzen der Farben doch diese hier:

                              $filter($$.battery, function($v){attributes[type=8].current_value >= $v.level})[0].color
                              

                              Wenn Du dir nun die Beschreibung zu der $filter Funktion in JSONATA anschaust (https://docs.jsonata.org/higher-order-functions#filter) dann ist diese wie folgt definiert:

                              $filter(array, function)
                              

                              Im Ersten Parameter steht also das array - das durchsucht wird.

                              In unserem Fall also $$.battery . Die $$ Zeichen stehen immer dafür das im root-Kontext geschaut wird.

                              Wenn Du also den von mir geposteten Link aufgemacht hast: https://try.jsonata.org/B9k5-Z-Qk

                              8dda85b7-e8c7-48b0-b7cc-90161b566a2c-image.png

                              dann siehst Du das in dem Objekt eine Eigenschaft battery mit den Farben und Levels definiert wurde.

                              Das musst Du halt in der Change Node auch machen:

                              6d8c8c78-76d0-4d3f-a144-ce5f8655560f-image.png

                              Darin wird auch nichts gerechnet - sondern das macht alles die Filter Funktion und deswegen solltest Du das ja auch in dem JSONATA Fenster ausprobieren.

                              da wird nicht jeder Vergleich reingeschrieben.

                              Die funktion im Filer ist ja so beschrieben:

                              Returns an array containing only the values in the array parameter that satisfy the function predicate (i.e. function returns Boolean true when passed the value).

                              Sprich die gibt für jedes Element in dem Array ein true zurück dessen Bedingung in der Funktion erfüllt ist.

                              function($v){attributes[type=8].current_value >= $v.level})
                              

                              Wenn Du nun in den JSONATA Fenster den Rest mal weg streichst (also das [0].color), dann siehst Du dass jedes Element zurückgegeben wird.

                              Machen wir das mal und nehmen wir mal diesen ganzen HTML Code weg - und der Batteriewert interessiert auch erst mal nicht.

                              Hier mal einfach zum Rauskopieren und Nachvollziehen im JSONATA Fenster:

                              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] ? $filter($$.battery, function($v){attributes[type=8].current_value >= $v.level})
                              }
                              

                              Nun sieht man im Ergebnisfenster, dass das Objekt, dass als erstes eine attribute mit type=8 hat, folgendes Gerät ist:

                              EG / Wohnzimmer / Heizung Balkon
                              

                              Dieses Gerät suchen wir jetzt im Eingabebereich:

                              ccb0865f-5f48-40c6-b137-d888285d5958-image.png

                              Wir klappen noch das attribute Element mit der Nummer 8 auf und spielen mit dem current_value. Je nachdem werden mehr oder weniger Elemente zurückgegeben in dem Array, wie die filter Funktion es vorgibt:

                              Ist der current_value nur 15, werden nur 2 Array-Elemente zurückgegeben:

                              ef8421a7-c993-4250-911c-3a614db2f151-image.png

                              Ist er über 30 werden mehrere Elemente zurückgegeben:

                              268af01a-86d2-4285-b7a1-640ee15c7d6d-image.png

                              Da die Level absteigend sortiert sind, interessiert uns immer nur das erste Element.

                              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] ? $filter($$.battery, function($v){attributes[type=8].current_value >= $v.level})[0]
                              }
                              

                              deshlab wird eine [0] hinter den gesamten Ausdruck gehängt und davon interessiert nur die Farbe. 😉

                              3eaefbf3-9895-4577-b332-b733a086f530-image.png

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

                                @oli Mit dem typ 69 das mag ja sein - aber das passt nicht zu den Werten - dann würde ich lieber einen extra Wert Batteriealarm empfehlen. So kann man das jedenfalls nicht mischen. Wir können generell auf die Prozente verzichten und nur Alarm true oder false ausgeben, oder machen eben eine extra Geschichte daraus oder generell verarbeitest Du es in einem Flow - anstelle einer Tabelle.

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

                                  @Oli Du ich finde es gerade nicht mehr, aber wenn Du lieber mit Javascript programmierst ist doch auch OK. Dann nimm doch wieder die function Node und passe sie halt entsprechend an.

                                  Du musst das nicht lernen, wenn Du eh ein Javascript Programmierer bist. Es geht auch schneller in Javascript - auch wenn Du mehr codieren musst, weil Du mit JSONATA ja nochmal eine Bibliothek dazwischen hast.

                                  Ich unterstütze Dich da auch - aber ich habe keine Lust Code zu schreiben, aber ich denke ich kann ihn nachvollziehen. Zumindest mit der function Node ist mir das ja geglückt.

                                  Ich spare mir jedenfalls eine Menge - wenn Du kein JSONATA lernen willst.

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

                                    @mickym said in Benötige Hilfe mit Node-Red in Verbindung mit homee:

                                    Mit dem typ 69 das mag ja sein

                                    Das Problem hierbei, das einige Geräte nur den Batteriewert habe, einige nur den Batteriealarm und dann gibt es Geräte die haben beides, deshalb dachte ich, dass man abfragen kann, ob der Batteriewert existiert. Wenn dieser existiert, zählt man einen count hoch. Sollte er nicht existieren prüft man ob der Batteriealarm existiert und zählt ebenfalls einen count hoch

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

                                      @oli Ja kann man alles machen - wird aber sehr komplex dann. JSONATA ist ein descriptive Sprache und Du kannst Objekte filtern und neu zusammensetzen - aber ich hatte eigentlich keine Lust ein Programm zu schreiben. Das geht auch - aber sicher nicht auf die schnelle - und ist halt nicht so einfach wie Du das denkst - da ich die Filter nur begrenzt dynamisch aufbauen kann. Zumindest ich bin da auch noch nicht geübt genug. Ich überlege mir was - aber nicht in den nächsten Stunden.

                                      Das Abfragen, dass die mit type 69 noch bei der Anzahl der Batteriegeräte sind, das ist nicht das Problem - aber das zusammen in einer Tabelle zusammenzustellen schon.

                                      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 said in Benötige Hilfe mit Node-Red in Verbindung mit homee:

                                        Mit dem typ 69 das mag ja sein

                                        Das Problem hierbei, das einige Geräte nur den Batteriewert habe, einige nur den Batteriealarm und dann gibt es Geräte die haben beides, deshalb dachte ich, dass man abfragen kann, ob der Batteriewert existiert. Wenn dieser existiert, zählt man einen count hoch. Sollte er nicht existieren prüft man ob der Batteriealarm existiert und zählt ebenfalls einen count hoch

                                        So die Abfragen habe ich:

                                        5c162481-4223-46bb-9c45-9c8e95ce7bd1-image.png

                                        [
                                           {
                                               "id": "6624873c35b06eae",
                                               "type": "change",
                                               "z": "9c280ddf049b2b4d",
                                               "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": 1270,
                                               "y": 3400,
                                               "wires": [
                                                   [
                                                       "0c5dce5940776e17",
                                                       "676c2655140cea7e"
                                                   ]
                                               ]
                                           },
                                           {
                                               "id": "0c5dce5940776e17",
                                               "type": "debug",
                                               "z": "9c280ddf049b2b4d",
                                               "name": "Geräte mit Batterie",
                                               "active": false,
                                               "tosidebar": true,
                                               "console": false,
                                               "tostatus": false,
                                               "complete": "payload",
                                               "targetType": "msg",
                                               "statusVal": "",
                                               "statusType": "auto",
                                               "x": 1510,
                                               "y": 3340,
                                               "wires": []
                                           },
                                           {
                                               "id": "676c2655140cea7e",
                                               "type": "change",
                                               "z": "9c280ddf049b2b4d",
                                               "name": "Anzahl",
                                               "rules": [
                                                   {
                                                       "t": "set",
                                                       "p": "payload",
                                                       "pt": "msg",
                                                       "to": "payload ? $count(payload) : 0",
                                                       "tot": "jsonata"
                                                   }
                                               ],
                                               "action": "",
                                               "property": "",
                                               "from": "",
                                               "to": "",
                                               "reg": false,
                                               "x": 1470,
                                               "y": 3400,
                                               "wires": [
                                                   [
                                                       "7cb6f5cee79a8d0b"
                                                   ]
                                               ]
                                           },
                                           {
                                               "id": "7cb6f5cee79a8d0b",
                                               "type": "debug",
                                               "z": "9c280ddf049b2b4d",
                                               "name": "Anzahl Geräte Batterie",
                                               "active": true,
                                               "tosidebar": true,
                                               "console": false,
                                               "tostatus": false,
                                               "complete": "payload",
                                               "targetType": "msg",
                                               "statusVal": "",
                                               "statusType": "auto",
                                               "x": 1660,
                                               "y": 3400,
                                               "wires": []
                                           },
                                           {
                                               "id": "ca23c275d6a0610b",
                                               "type": "change",
                                               "z": "9c280ddf049b2b4d",
                                               "name": "Alle Batterie Geräte mit 69",
                                               "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": 1300,
                                               "y": 3500,
                                               "wires": [
                                                   [
                                                       "a635f8e5d7ac99cf",
                                                       "ce0af757e6116705"
                                                   ]
                                               ]
                                           },
                                           {
                                               "id": "a635f8e5d7ac99cf",
                                               "type": "debug",
                                               "z": "9c280ddf049b2b4d",
                                               "name": "Geräte mit Batterie type 8 oder type 69",
                                               "active": false,
                                               "tosidebar": true,
                                               "console": false,
                                               "tostatus": false,
                                               "complete": "payload",
                                               "targetType": "msg",
                                               "statusVal": "",
                                               "statusType": "auto",
                                               "x": 1610,
                                               "y": 3460,
                                               "wires": []
                                           },
                                           {
                                               "id": "ce0af757e6116705",
                                               "type": "change",
                                               "z": "9c280ddf049b2b4d",
                                               "name": "Anzahl",
                                               "rules": [
                                                   {
                                                       "t": "set",
                                                       "p": "payload",
                                                       "pt": "msg",
                                                       "to": "payload ? $count(payload) : 0",
                                                       "tot": "jsonata"
                                                   }
                                               ],
                                               "action": "",
                                               "property": "",
                                               "from": "",
                                               "to": "",
                                               "reg": false,
                                               "x": 1510,
                                               "y": 3500,
                                               "wires": [
                                                   [
                                                       "da4725cbfd61cda4"
                                                   ]
                                               ]
                                           },
                                           {
                                               "id": "da4725cbfd61cda4",
                                               "type": "debug",
                                               "z": "9c280ddf049b2b4d",
                                               "name": "Geräte mit Batterie type 8 oder type 69",
                                               "active": true,
                                               "tosidebar": true,
                                               "console": false,
                                               "tostatus": false,
                                               "complete": "payload",
                                               "targetType": "msg",
                                               "statusVal": "",
                                               "statusType": "auto",
                                               "x": 1750,
                                               "y": 3500,
                                               "wires": []
                                           },
                                           {
                                               "id": "83190417b6055b66",
                                               "type": "change",
                                               "z": "9c280ddf049b2b4d",
                                               "name": "Alle Batterie Geräte mit type 69 ohne type 8",
                                               "rules": [
                                                   {
                                                       "t": "set",
                                                       "p": "payload",
                                                       "pt": "msg",
                                                       "to": "$filter(payload,function($v){$not($exists($v[attributes[type = 8]]))})[attributes[type=69]]",
                                                       "tot": "jsonata"
                                                   }
                                               ],
                                               "action": "",
                                               "property": "",
                                               "from": "",
                                               "to": "",
                                               "reg": false,
                                               "x": 1350,
                                               "y": 3600,
                                               "wires": [
                                                   [
                                                       "a8736ad1d187fbb3",
                                                       "e25d074f8f30181c"
                                                   ]
                                               ]
                                           },
                                           {
                                               "id": "a8736ad1d187fbb3",
                                               "type": "change",
                                               "z": "9c280ddf049b2b4d",
                                               "name": "Anzahl",
                                               "rules": [
                                                   {
                                                       "t": "set",
                                                       "p": "payload",
                                                       "pt": "msg",
                                                       "to": "payload ? $count(payload) : 0",
                                                       "tot": "jsonata"
                                                   }
                                               ],
                                               "action": "",
                                               "property": "",
                                               "from": "",
                                               "to": "",
                                               "reg": false,
                                               "x": 1610,
                                               "y": 3600,
                                               "wires": [
                                                   [
                                                       "643ccdc3d84091fd"
                                                   ]
                                               ]
                                           },
                                           {
                                               "id": "643ccdc3d84091fd",
                                               "type": "debug",
                                               "z": "9c280ddf049b2b4d",
                                               "name": "Alle Batterie Geräte mit type 69 ohne type 8",
                                               "active": true,
                                               "tosidebar": true,
                                               "console": false,
                                               "tostatus": false,
                                               "complete": "payload",
                                               "targetType": "msg",
                                               "statusVal": "",
                                               "statusType": "auto",
                                               "x": 1890,
                                               "y": 3600,
                                               "wires": []
                                           },
                                           {
                                               "id": "e25d074f8f30181c",
                                               "type": "debug",
                                               "z": "9c280ddf049b2b4d",
                                               "name": "Geräte mit Batterie type 69 ohne type 8",
                                               "active": true,
                                               "tosidebar": true,
                                               "console": false,
                                               "tostatus": false,
                                               "complete": "payload",
                                               "targetType": "msg",
                                               "statusVal": "",
                                               "statusType": "auto",
                                               "x": 1720,
                                               "y": 3560,
                                               "wires": []
                                           }
                                        ]
                                        

                                        Um die Tabelle zu machen, muss ja anders gemappt werden.

                                        Ist halt bissi schwierig mit den Informationen. Wenn type=69 der Batteriealarm ist, der ja dann genutzt werden soll, wenn kein battery Level vorhanden ist (also kein type 8 ) und das alles zusammen in der Tabelle auftauchen soll, gehe ich nun davon aus, das current_value = 0 (kein Alarm bedeutet) und current_value = 1 (Alarm bedeutet). Um das in die gleiche Spalte für Batterie zu bringen - übersetze ich dann 0 in 100% und 1 in 0%.

                                        Deine Idee

                                        attributes[type=8 ] ? attributes[type=8 ] : attributes[type=69 ]
                                        

                                        funktioniert - aber man muss das halt anders behandeln bei type 69 als den value. Also richtig überlegt.

                                        1 Reply Last reply Reply Quote 0
                                        • 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
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            833
                                            Online

                                            31.7k
                                            Users

                                            79.8k
                                            Topics

                                            1.3m
                                            Posts

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