Skip to content
  • Aktuell
  • Tags
  • 0 Ungelesen 0
  • Kategorien
  • Unreplied
  • Beliebt
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. Node-Red
  5. Aus String eine Übersichtliche Liste erstellen

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill läuft aus ?
    apollon77A
    apollon77
    48
    3
    8.1k

  • Monatsrückblick – September 2025
    BluefoxB
    Bluefox
    13
    1
    1.9k

  • Neues Video "KI im Smart Home" - ioBroker plus n8n
    BluefoxB
    Bluefox
    15
    1
    2.1k

Aus String eine Übersichtliche Liste erstellen

Geplant Angeheftet Gesperrt Verschoben Node-Red
13 Beiträge 2 Kommentatoren 751 Aufrufe 2 Watching
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • S Offline
    S Offline
    Saranger
    schrieb am zuletzt editiert von Saranger
    #1

    Re: Visualisierung (Dashboard) gestalten & strukturieren

    Hallo zusammen, ich kämpfe gerade mit der Darstellung einer Zeichenkette wie man das optisch schöner gestalten kann, vielleicht hat einer eine Idee:-).

    Ich lasse mir mit einem Blockly script in einen Datenpunkt (Zeichenfolge) meine geöffneten Fenster schreiben. Jetzt versuche ich das irgendwie im Node Red Dashboard schicker darzustellen. Am liebsten hätte ich jedes Fenster in einer Zeile ohne die Klammern (siehe Bild). Mit einem Template bekomme ich es auch nicht hin da ich nicht wirklich Programmierkenntnisse habe.

    Danke schon mal für eure Ideen 🙂

    Fenster.JPG skript.JPG

    mickymM 3 Antworten Letzte Antwort
    0
    • S Saranger

      Re: Visualisierung (Dashboard) gestalten & strukturieren

      Hallo zusammen, ich kämpfe gerade mit der Darstellung einer Zeichenkette wie man das optisch schöner gestalten kann, vielleicht hat einer eine Idee:-).

      Ich lasse mir mit einem Blockly script in einen Datenpunkt (Zeichenfolge) meine geöffneten Fenster schreiben. Jetzt versuche ich das irgendwie im Node Red Dashboard schicker darzustellen. Am liebsten hätte ich jedes Fenster in einer Zeile ohne die Klammern (siehe Bild). Mit einem Template bekomme ich es auch nicht hin da ich nicht wirklich Programmierkenntnisse habe.

      Danke schon mal für eure Ideen 🙂

      Fenster.JPG skript.JPG

      mickymM Offline
      mickymM Offline
      mickym
      Most Active
      schrieb am zuletzt editiert von mickym
      #2

      @saranger Um es einfach zu machen Installiere Dir die Tabellen Node - falls Du es nicht selbst mit der Template Node machen willst.

      a1156466-4ef6-432a-8d4d-12dc1a2f0701-image.png

      Diese kannst Du dann einfach mit Arrays füttern. Falls Du es doch mit einer Template Node machen willst, sag Bescheid. Dann solltest Du aber lieber ein Object , anstelle von Strings verwenden, also:

      {"Gäste WC":"geöffnet","Flur EG":"geöffnet"}
      

      Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

      S 1 Antwort Letzte Antwort
      0
      • mickymM mickym

        @saranger Um es einfach zu machen Installiere Dir die Tabellen Node - falls Du es nicht selbst mit der Template Node machen willst.

        a1156466-4ef6-432a-8d4d-12dc1a2f0701-image.png

        Diese kannst Du dann einfach mit Arrays füttern. Falls Du es doch mit einer Template Node machen willst, sag Bescheid. Dann solltest Du aber lieber ein Object , anstelle von Strings verwenden, also:

        {"Gäste WC":"geöffnet","Flur EG":"geöffnet"}
        
        S Offline
        S Offline
        Saranger
        schrieb am zuletzt editiert von
        #3

        @mickym

        Hi, werde ich dann testen :). Muss ich mal prüfen ob ich in blockly das ganze in eine anderen datenpunkt schreiben kann damit Array raus kommt, muss ich da nur als datenpunkt Object auswählen?

        mickymM 1 Antwort Letzte Antwort
        0
        • S Saranger

          @mickym

          Hi, werde ich dann testen :). Muss ich mal prüfen ob ich in blockly das ganze in eine anderen datenpunkt schreiben kann damit Array raus kommt, muss ich da nur als datenpunkt Object auswählen?

          mickymM Offline
          mickymM Offline
          mickym
          Most Active
          schrieb am zuletzt editiert von
          #4

          @saranger Nein aber Du kannst ja auch einen Flow machen - dass da Objekte rauskommen, poste mal Dein String Array in Code-Tags - dann mache ich das schnell.

          Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

          S 1 Antwort Letzte Antwort
          0
          • mickymM mickym

            @saranger Nein aber Du kannst ja auch einen Flow machen - dass da Objekte rauskommen, poste mal Dein String Array in Code-Tags - dann mache ich das schnell.

            S Offline
            S Offline
            Saranger
            schrieb am zuletzt editiert von
            #5

            @mickym

            Mach ich sobald ich daheim bin. Danke schon mal 🙂

            mickymM 1 Antwort Letzte Antwort
            0
            • S Saranger

              @mickym

              Mach ich sobald ich daheim bin. Danke schon mal 🙂

              mickymM Offline
              mickymM Offline
              mickym
              Most Active
              schrieb am zuletzt editiert von mickym
              #6

              @saranger sagte in Aus String eine Übersichtliche Liste erstellen:

              @mickym

              Mach ich sobald ich daheim bin. Danke schon mal 🙂

              Also wie gesagt dass einfachste ist, Du installierst Dir die ui-Table - die ist schon sehr mächtig und die kannst Du easy mit Arrays füllen:

              Mit der ui-Table hole ich mir beispielsweise das Log in das NR Dashboard:

              da96efbe-b0b7-45b3-83dc-0a3a03dddba4-image.png

              So wenn Du es mit der Template Node machen willst - hier mal ein paar Beispiele:

              4fcc70b1-b6e0-4959-b885-309ca2b7dd9a-image.png

              Das erste Beispiel ist so ein einfaches Array mit Zeichenketten - so wie Du sie ja im Eingangsposting gepostet hast:

              ["Gäste WC - geöffnet","Flur EG - geöffnet"]
              

              d79546f4-6b95-4e4f-aae5-3d60d13f099b-image.png

              das kannst zwar nun auch zentriert oder rechtsbündig machen - aber weil es halt pro Fenster nur EINE Zeichenkette ist - schaut das in meinen Augen nicht besonders schön aus.

              Die nächste Möglichkeit ist Du nutzt Objekte,

              {
                  "Gäste WC": "geöffnet",
                  "Flur EG": "geöffnet"
              }
              

              Dann kannst das auf 2 Spalten verteilen:

              7a2adecd-fdbe-439d-bb99-6f592111357d-image.png

              oder falls Du Objekt Arrays mit bekannten /festen keys verwenden willst, kannst dann auch Icons nutzen;

              [
                  {
                      "id": "Gäste WC",
                      "status": "geöffnet",
                      "icon": "sensor_window",
                      "color": "red"
                  },
                  {
                      "id": "Flur EG",
                      "status": "geschlossen",
                      "icon": "sensor_window",
                      "color": "green"
                  }
              ]
              

              Dann kannst das auf 2 Spalten oder mehrere Spalten verteilen:

              1e17937b-c18e-4a3d-a5fe-1743c007da1d-image.png

              Wo ich noch Probleme hätte, wäre wenn Du die keys nicht kennst. Zumindest ist eine Tabelle nicht so einfach für das ng-repeat:

              Das habe ich noch nicht raus. Hier mal die Beispiele zum Üben:

              [
                 {
                     "id": "d24c36e8.bc63c8",
                     "type": "ui_template",
                     "z": "a37484bb.f4a9e8",
                     "group": "6bf7d3fa.644c5c",
                     "name": "String Array",
                     "order": 1,
                     "width": "6",
                     "height": "4",
                     "format": "<style>\n.main\n{\n    height:100%;\n    width:100%;\n    /* background:lightblue; */\n\n}\n\n\n#t01 th {\n     \n  padding: 5px;\n  font-size:120%;\n  color: var(--nr-dashboard-groupTextColor);\n   /* color:#0eb8c0;  */\n}\n#t01 td {\n     \n  padding: 5px;\n\n}\n    \n</style>\n\n<div class=\"main\">\n\n    <table id=\"t01\">\n\n   \n    <tr><th width=200>Fenster</th></tr>\n     <tr ng-repeat=\"str in msg.payload\">\n        <td>{{str}}</td>\n        <!-- Bei Arrays kann man $index nehmen sonst bei ng-repeat key und value definieren\n            <td class=\"material-icons\" style=\"color:{{y.icon.color}}; text-align:right\" ng-click=\"msg.payload=msg.payload[$index]; msg.topic=msg.payload.topic; send(msg)\" >{{y.icon.name}}</td> -->\n    </tr>\n    \n    </table>\n    <br><hr>\n    aus Zeichenketten-Array\n\n</div>",
                     "storeOutMessages": true,
                     "fwdInMessages": true,
                     "resendOnRefresh": true,
                     "templateScope": "local",
                     "className": "",
                     "x": 830,
                     "y": 200,
                     "wires": [
                         []
                     ]
                 },
                 {
                     "id": "df730186.c81bd",
                     "type": "inject",
                     "z": "a37484bb.f4a9e8",
                     "name": "String Array",
                     "props": [
                         {
                             "p": "payload"
                         }
                     ],
                     "repeat": "",
                     "crontab": "",
                     "once": false,
                     "onceDelay": 0.1,
                     "topic": "",
                     "payload": "[\"Gäste WC - geöffnet\", \"Flur EG - geöffnet\"]",
                     "payloadType": "json",
                     "x": 630,
                     "y": 200,
                     "wires": [
                         [
                             "ea2cce41.5b753",
                             "d24c36e8.bc63c8"
                         ]
                     ]
                 },
                 {
                     "id": "ea2cce41.5b753",
                     "type": "debug",
                     "z": "a37484bb.f4a9e8",
                     "name": "String Array",
                     "active": true,
                     "tosidebar": true,
                     "console": false,
                     "tostatus": false,
                     "complete": "payload",
                     "targetType": "msg",
                     "statusVal": "",
                     "statusType": "auto",
                     "x": 830,
                     "y": 160,
                     "wires": []
                 },
                 {
                     "id": "d11efe80.eebfc",
                     "type": "inject",
                     "z": "a37484bb.f4a9e8",
                     "name": "Object",
                     "props": [
                         {
                             "p": "payload"
                         }
                     ],
                     "repeat": "",
                     "crontab": "",
                     "once": false,
                     "onceDelay": 0.1,
                     "topic": "",
                     "payload": "{\"Gäste WC\":\"geöffnet\",\"Flur EG\":\"geöffnet\"}",
                     "payloadType": "json",
                     "x": 650,
                     "y": 260,
                     "wires": [
                         [
                             "72fa6e9f.6e743",
                             "3f95b440.ace6ec"
                         ]
                     ]
                 },
                 {
                     "id": "72fa6e9f.6e743",
                     "type": "ui_template",
                     "z": "a37484bb.f4a9e8",
                     "group": "6bf7d3fa.644c5c",
                     "name": "Object",
                     "order": 2,
                     "width": "6",
                     "height": "4",
                     "format": "<style>\n.main\n{\n    height:100%;\n    width:100%;\n    /* background:lightblue; */\n\n}\n\n\n#t01 th {\n     \n  padding: 5px;\n  font-size:120%;\n  color: var(--nr-dashboard-groupTextColor);\n   /* color:#0eb8c0;  */\n}\n#t01 td {\n     \n  padding: 5px;\n\n}\n    \n</style>\n\n<div class=\"main\">\n\n    <table id=\"t01\">\n\n   \n    <tr><th width=200>Fenster</th><th width=200>Status</th></tr>\n     <tr ng-repeat=\"(key, value) in msg.payload\">\n        <td>{{key}}</td><td align=center>{{value}}</td>\n        <!-- Bei Arrays kann man $index nehmen sonst bei ng-repeat key und value definieren\n            <td class=\"material-icons\" style=\"color:{{y.icon.color}}; text-align:right\" ng-click=\"msg.payload=msg.payload[$index]; msg.topic=msg.payload.topic; send(msg)\" >{{y.icon.name}}</td> -->\n    </tr>\n    \n    </table>\n    <br><hr>\n    aus Object\n\n</div>",
                     "storeOutMessages": true,
                     "fwdInMessages": true,
                     "resendOnRefresh": true,
                     "templateScope": "local",
                     "className": "",
                     "x": 810,
                     "y": 260,
                     "wires": [
                         []
                     ]
                 },
                 {
                     "id": "3f95b440.ace6ec",
                     "type": "debug",
                     "z": "a37484bb.f4a9e8",
                     "name": "Object",
                     "active": true,
                     "tosidebar": true,
                     "console": false,
                     "tostatus": false,
                     "complete": "payload",
                     "targetType": "msg",
                     "statusVal": "",
                     "statusType": "auto",
                     "x": 810,
                     "y": 300,
                     "wires": []
                 },
                 {
                     "id": "ac65c035.47b03",
                     "type": "inject",
                     "z": "a37484bb.f4a9e8",
                     "name": "Object Array",
                     "props": [
                         {
                             "p": "payload"
                         }
                     ],
                     "repeat": "",
                     "crontab": "",
                     "once": false,
                     "onceDelay": 0.1,
                     "topic": "",
                     "payload": "[{\"id\":\"Gäste WC\",\"status\":\"geöffnet\",\"icon\":\"sensor_window\",\"color\":\"red\"},{\"id\":\"Flur EG\",\"status\":\"geschlossen\",\"icon\":\"sensor_window\",\"color\":\"green\"}]",
                     "payloadType": "json",
                     "x": 630,
                     "y": 360,
                     "wires": [
                         [
                             "873f660f.c087f8",
                             "3fffe9c8.3ebbb6"
                         ]
                     ]
                 },
                 {
                     "id": "873f660f.c087f8",
                     "type": "ui_template",
                     "z": "a37484bb.f4a9e8",
                     "group": "6bf7d3fa.644c5c",
                     "name": "Object Array",
                     "order": 3,
                     "width": "6",
                     "height": "4",
                     "format": "<style>\n.main\n{\n    height:100%;\n    width:100%;\n    /* background:lightblue; */\n\n}\n\n\n#t01 th {\n     \n  padding: 5px;\n  font-size:120%;\n  color: var(--nr-dashboard-groupTextColor);\n   /* color:#0eb8c0;  */\n}\n#t01 td {\n     \n  padding: 5px;\n\n}\n    \n</style>\n\n<div class=\"main\">\n\n    <table id=\"t01\">\n\n   \n    <tr><th width=150>Fenster</th><th width=100>Status</th></tr>\n     <tr ng-repeat=\"item in msg.payload\">\n            <td>{{item.id}}</td><td align=center>{{item.status}}</td><td class=\"material-icons\" style=\"color:{{item.color}}\">{{item.icon}}</td>\n    </tr>\n    </table>\n    <br><hr>\n    aus Object-Array mit bekannten Keys\n\n</div>",
                     "storeOutMessages": true,
                     "fwdInMessages": true,
                     "resendOnRefresh": true,
                     "templateScope": "local",
                     "className": "",
                     "x": 830,
                     "y": 360,
                     "wires": [
                         []
                     ]
                 },
                 {
                     "id": "3fffe9c8.3ebbb6",
                     "type": "debug",
                     "z": "a37484bb.f4a9e8",
                     "name": "Object Array",
                     "active": true,
                     "tosidebar": true,
                     "console": false,
                     "tostatus": false,
                     "complete": "payload",
                     "targetType": "msg",
                     "statusVal": "",
                     "statusType": "auto",
                     "x": 830,
                     "y": 400,
                     "wires": []
                 },
                 {
                     "id": "6bf7d3fa.644c5c",
                     "type": "ui_group",
                     "name": "Tabelle",
                     "tab": "f9bab960.c839b8",
                     "order": 1,
                     "disp": true,
                     "width": "6",
                     "collapse": false,
                     "className": ""
                 },
                 {
                     "id": "f9bab960.c839b8",
                     "type": "ui_tab",
                     "name": "testy",
                     "icon": "dashboard"
                 }
              ]
              

              Um die einzelnen Typen ineinander umzuwandeln - hier noch folgender Flow:

              screen.png

              [
                 {
                     "id": "e070fc92.3c846",
                     "type": "inject",
                     "z": "a37484bb.f4a9e8",
                     "name": "String skalar",
                     "props": [
                         {
                             "p": "payload"
                         }
                     ],
                     "repeat": "",
                     "crontab": "",
                     "once": false,
                     "onceDelay": 0.1,
                     "topic": "",
                     "payload": "[\"Gäste WC - geöffnet\", \"Flur EG - geschlossen\"]",
                     "payloadType": "str",
                     "x": 350,
                     "y": 560,
                     "wires": [
                         [
                             "cc1532ed.4d0c9",
                             "5d1310dc.67ad2"
                         ]
                     ]
                 },
                 {
                     "id": "cc1532ed.4d0c9",
                     "type": "debug",
                     "z": "a37484bb.f4a9e8",
                     "name": "String - skalar",
                     "active": true,
                     "tosidebar": true,
                     "console": false,
                     "tostatus": false,
                     "complete": "payload",
                     "targetType": "msg",
                     "statusVal": "",
                     "statusType": "auto",
                     "x": 560,
                     "y": 520,
                     "wires": []
                 },
                 {
                     "id": "5d1310dc.67ad2",
                     "type": "json",
                     "z": "a37484bb.f4a9e8",
                     "name": "",
                     "property": "payload",
                     "action": "",
                     "pretty": false,
                     "x": 590,
                     "y": 560,
                     "wires": [
                         [
                             "5dad8c2a.02a344",
                             "3fd3e.6a2e82c2a"
                         ]
                     ]
                 },
                 {
                     "id": "5dad8c2a.02a344",
                     "type": "debug",
                     "z": "a37484bb.f4a9e8",
                     "name": "String Array",
                     "active": true,
                     "tosidebar": true,
                     "console": false,
                     "tostatus": false,
                     "complete": "payload",
                     "targetType": "msg",
                     "statusVal": "",
                     "statusType": "auto",
                     "x": 770,
                     "y": 520,
                     "wires": []
                 },
                 {
                     "id": "a066c4b5.e9ef08",
                     "type": "change",
                     "z": "a37484bb.f4a9e8",
                     "name": "",
                     "rules": [
                         {
                             "t": "set",
                             "p": "topic",
                             "pt": "msg",
                             "to": "payload",
                             "tot": "msg"
                         },
                         {
                             "t": "change",
                             "p": "topic",
                             "pt": "msg",
                             "from": "(.*)\\s-\\s(.*)",
                             "fromt": "re",
                             "to": "$1",
                             "tot": "str"
                         },
                         {
                             "t": "change",
                             "p": "payload",
                             "pt": "msg",
                             "from": "(.*)\\s-\\s(.*)",
                             "fromt": "re",
                             "to": "$2",
                             "tot": "str"
                         }
                     ],
                     "action": "",
                     "property": "",
                     "from": "",
                     "to": "",
                     "reg": false,
                     "x": 910,
                     "y": 560,
                     "wires": [
                         [
                             "2ca8bc6e.1393e4",
                             "4067e436.c7d2ec"
                         ]
                     ]
                 },
                 {
                     "id": "3fd3e.6a2e82c2a",
                     "type": "split",
                     "z": "a37484bb.f4a9e8",
                     "name": "",
                     "splt": "\\n",
                     "spltType": "str",
                     "arraySplt": 1,
                     "arraySpltType": "len",
                     "stream": false,
                     "addname": "",
                     "x": 730,
                     "y": 560,
                     "wires": [
                         [
                             "a066c4b5.e9ef08"
                         ]
                     ]
                 },
                 {
                     "id": "31ec8b23.e1d8a4",
                     "type": "debug",
                     "z": "a37484bb.f4a9e8",
                     "name": "Object",
                     "active": true,
                     "tosidebar": true,
                     "console": false,
                     "tostatus": false,
                     "complete": "payload",
                     "targetType": "msg",
                     "statusVal": "",
                     "statusType": "auto",
                     "x": 1430,
                     "y": 560,
                     "wires": []
                 },
                 {
                     "id": "31d31143.bfebae",
                     "type": "debug",
                     "z": "a37484bb.f4a9e8",
                     "name": "Object Array",
                     "active": true,
                     "tosidebar": true,
                     "console": false,
                     "tostatus": false,
                     "complete": "payload",
                     "targetType": "msg",
                     "statusVal": "",
                     "statusType": "auto",
                     "x": 1470,
                     "y": 620,
                     "wires": []
                 },
                 {
                     "id": "2ca8bc6e.1393e4",
                     "type": "join",
                     "z": "a37484bb.f4a9e8",
                     "name": "",
                     "mode": "custom",
                     "build": "object",
                     "property": "payload",
                     "propertyType": "msg",
                     "key": "topic",
                     "joiner": "\\n",
                     "joinerType": "str",
                     "accumulate": true,
                     "timeout": "",
                     "count": "1",
                     "reduceRight": false,
                     "reduceExp": "",
                     "reduceInit": "",
                     "reduceInitType": "",
                     "reduceFixup": "",
                     "x": 1090,
                     "y": 560,
                     "wires": [
                         [
                             "7944be21.63c02"
                         ]
                     ]
                 },
                 {
                     "id": "7944be21.63c02",
                     "type": "trigger",
                     "z": "a37484bb.f4a9e8",
                     "name": "",
                     "op1": "",
                     "op2": "",
                     "op1type": "nul",
                     "op2type": "payl",
                     "duration": "250",
                     "extend": false,
                     "overrideDelay": false,
                     "units": "ms",
                     "reset": "",
                     "bytopic": "all",
                     "topic": "topic",
                     "outputs": 1,
                     "x": 1260,
                     "y": 560,
                     "wires": [
                         [
                             "31ec8b23.e1d8a4"
                         ]
                     ]
                 },
                 {
                     "id": "4067e436.c7d2ec",
                     "type": "change",
                     "z": "a37484bb.f4a9e8",
                     "name": "",
                     "rules": [
                         {
                             "t": "move",
                             "p": "payload",
                             "pt": "msg",
                             "to": "payload.status",
                             "tot": "msg"
                         },
                         {
                             "t": "set",
                             "p": "payload.id",
                             "pt": "msg",
                             "to": "topic",
                             "tot": "msg"
                         },
                         {
                             "t": "set",
                             "p": "payload.icon",
                             "pt": "msg",
                             "to": "sensor_window",
                             "tot": "str"
                         },
                         {
                             "t": "set",
                             "p": "payload.color",
                             "pt": "msg",
                             "to": "payload.status = 'geöffnet' ? 'green' : 'red'",
                             "tot": "jsonata"
                         }
                     ],
                     "action": "",
                     "property": "",
                     "from": "",
                     "to": "",
                     "reg": false,
                     "x": 1130,
                     "y": 620,
                     "wires": [
                         [
                             "971221b6.c0863"
                         ]
                     ]
                 },
                 {
                     "id": "971221b6.c0863",
                     "type": "join",
                     "z": "a37484bb.f4a9e8",
                     "name": "",
                     "mode": "auto",
                     "build": "string",
                     "property": "payload",
                     "propertyType": "msg",
                     "key": "topic",
                     "joiner": "\\n",
                     "joinerType": "str",
                     "accumulate": false,
                     "timeout": "",
                     "count": "",
                     "reduceRight": false,
                     "reduceExp": "",
                     "reduceInit": "",
                     "reduceInitType": "",
                     "reduceFixup": "",
                     "x": 1310,
                     "y": 620,
                     "wires": [
                         [
                             "31d31143.bfebae"
                         ]
                     ]
                 }
              ]
              

              Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

              mickymM 1 Antwort Letzte Antwort
              0
              • mickymM mickym

                @saranger sagte in Aus String eine Übersichtliche Liste erstellen:

                @mickym

                Mach ich sobald ich daheim bin. Danke schon mal 🙂

                Also wie gesagt dass einfachste ist, Du installierst Dir die ui-Table - die ist schon sehr mächtig und die kannst Du easy mit Arrays füllen:

                Mit der ui-Table hole ich mir beispielsweise das Log in das NR Dashboard:

                da96efbe-b0b7-45b3-83dc-0a3a03dddba4-image.png

                So wenn Du es mit der Template Node machen willst - hier mal ein paar Beispiele:

                4fcc70b1-b6e0-4959-b885-309ca2b7dd9a-image.png

                Das erste Beispiel ist so ein einfaches Array mit Zeichenketten - so wie Du sie ja im Eingangsposting gepostet hast:

                ["Gäste WC - geöffnet","Flur EG - geöffnet"]
                

                d79546f4-6b95-4e4f-aae5-3d60d13f099b-image.png

                das kannst zwar nun auch zentriert oder rechtsbündig machen - aber weil es halt pro Fenster nur EINE Zeichenkette ist - schaut das in meinen Augen nicht besonders schön aus.

                Die nächste Möglichkeit ist Du nutzt Objekte,

                {
                    "Gäste WC": "geöffnet",
                    "Flur EG": "geöffnet"
                }
                

                Dann kannst das auf 2 Spalten verteilen:

                7a2adecd-fdbe-439d-bb99-6f592111357d-image.png

                oder falls Du Objekt Arrays mit bekannten /festen keys verwenden willst, kannst dann auch Icons nutzen;

                [
                    {
                        "id": "Gäste WC",
                        "status": "geöffnet",
                        "icon": "sensor_window",
                        "color": "red"
                    },
                    {
                        "id": "Flur EG",
                        "status": "geschlossen",
                        "icon": "sensor_window",
                        "color": "green"
                    }
                ]
                

                Dann kannst das auf 2 Spalten oder mehrere Spalten verteilen:

                1e17937b-c18e-4a3d-a5fe-1743c007da1d-image.png

                Wo ich noch Probleme hätte, wäre wenn Du die keys nicht kennst. Zumindest ist eine Tabelle nicht so einfach für das ng-repeat:

                Das habe ich noch nicht raus. Hier mal die Beispiele zum Üben:

                [
                   {
                       "id": "d24c36e8.bc63c8",
                       "type": "ui_template",
                       "z": "a37484bb.f4a9e8",
                       "group": "6bf7d3fa.644c5c",
                       "name": "String Array",
                       "order": 1,
                       "width": "6",
                       "height": "4",
                       "format": "<style>\n.main\n{\n    height:100%;\n    width:100%;\n    /* background:lightblue; */\n\n}\n\n\n#t01 th {\n     \n  padding: 5px;\n  font-size:120%;\n  color: var(--nr-dashboard-groupTextColor);\n   /* color:#0eb8c0;  */\n}\n#t01 td {\n     \n  padding: 5px;\n\n}\n    \n</style>\n\n<div class=\"main\">\n\n    <table id=\"t01\">\n\n   \n    <tr><th width=200>Fenster</th></tr>\n     <tr ng-repeat=\"str in msg.payload\">\n        <td>{{str}}</td>\n        <!-- Bei Arrays kann man $index nehmen sonst bei ng-repeat key und value definieren\n            <td class=\"material-icons\" style=\"color:{{y.icon.color}}; text-align:right\" ng-click=\"msg.payload=msg.payload[$index]; msg.topic=msg.payload.topic; send(msg)\" >{{y.icon.name}}</td> -->\n    </tr>\n    \n    </table>\n    <br><hr>\n    aus Zeichenketten-Array\n\n</div>",
                       "storeOutMessages": true,
                       "fwdInMessages": true,
                       "resendOnRefresh": true,
                       "templateScope": "local",
                       "className": "",
                       "x": 830,
                       "y": 200,
                       "wires": [
                           []
                       ]
                   },
                   {
                       "id": "df730186.c81bd",
                       "type": "inject",
                       "z": "a37484bb.f4a9e8",
                       "name": "String Array",
                       "props": [
                           {
                               "p": "payload"
                           }
                       ],
                       "repeat": "",
                       "crontab": "",
                       "once": false,
                       "onceDelay": 0.1,
                       "topic": "",
                       "payload": "[\"Gäste WC - geöffnet\", \"Flur EG - geöffnet\"]",
                       "payloadType": "json",
                       "x": 630,
                       "y": 200,
                       "wires": [
                           [
                               "ea2cce41.5b753",
                               "d24c36e8.bc63c8"
                           ]
                       ]
                   },
                   {
                       "id": "ea2cce41.5b753",
                       "type": "debug",
                       "z": "a37484bb.f4a9e8",
                       "name": "String Array",
                       "active": true,
                       "tosidebar": true,
                       "console": false,
                       "tostatus": false,
                       "complete": "payload",
                       "targetType": "msg",
                       "statusVal": "",
                       "statusType": "auto",
                       "x": 830,
                       "y": 160,
                       "wires": []
                   },
                   {
                       "id": "d11efe80.eebfc",
                       "type": "inject",
                       "z": "a37484bb.f4a9e8",
                       "name": "Object",
                       "props": [
                           {
                               "p": "payload"
                           }
                       ],
                       "repeat": "",
                       "crontab": "",
                       "once": false,
                       "onceDelay": 0.1,
                       "topic": "",
                       "payload": "{\"Gäste WC\":\"geöffnet\",\"Flur EG\":\"geöffnet\"}",
                       "payloadType": "json",
                       "x": 650,
                       "y": 260,
                       "wires": [
                           [
                               "72fa6e9f.6e743",
                               "3f95b440.ace6ec"
                           ]
                       ]
                   },
                   {
                       "id": "72fa6e9f.6e743",
                       "type": "ui_template",
                       "z": "a37484bb.f4a9e8",
                       "group": "6bf7d3fa.644c5c",
                       "name": "Object",
                       "order": 2,
                       "width": "6",
                       "height": "4",
                       "format": "<style>\n.main\n{\n    height:100%;\n    width:100%;\n    /* background:lightblue; */\n\n}\n\n\n#t01 th {\n     \n  padding: 5px;\n  font-size:120%;\n  color: var(--nr-dashboard-groupTextColor);\n   /* color:#0eb8c0;  */\n}\n#t01 td {\n     \n  padding: 5px;\n\n}\n    \n</style>\n\n<div class=\"main\">\n\n    <table id=\"t01\">\n\n   \n    <tr><th width=200>Fenster</th><th width=200>Status</th></tr>\n     <tr ng-repeat=\"(key, value) in msg.payload\">\n        <td>{{key}}</td><td align=center>{{value}}</td>\n        <!-- Bei Arrays kann man $index nehmen sonst bei ng-repeat key und value definieren\n            <td class=\"material-icons\" style=\"color:{{y.icon.color}}; text-align:right\" ng-click=\"msg.payload=msg.payload[$index]; msg.topic=msg.payload.topic; send(msg)\" >{{y.icon.name}}</td> -->\n    </tr>\n    \n    </table>\n    <br><hr>\n    aus Object\n\n</div>",
                       "storeOutMessages": true,
                       "fwdInMessages": true,
                       "resendOnRefresh": true,
                       "templateScope": "local",
                       "className": "",
                       "x": 810,
                       "y": 260,
                       "wires": [
                           []
                       ]
                   },
                   {
                       "id": "3f95b440.ace6ec",
                       "type": "debug",
                       "z": "a37484bb.f4a9e8",
                       "name": "Object",
                       "active": true,
                       "tosidebar": true,
                       "console": false,
                       "tostatus": false,
                       "complete": "payload",
                       "targetType": "msg",
                       "statusVal": "",
                       "statusType": "auto",
                       "x": 810,
                       "y": 300,
                       "wires": []
                   },
                   {
                       "id": "ac65c035.47b03",
                       "type": "inject",
                       "z": "a37484bb.f4a9e8",
                       "name": "Object Array",
                       "props": [
                           {
                               "p": "payload"
                           }
                       ],
                       "repeat": "",
                       "crontab": "",
                       "once": false,
                       "onceDelay": 0.1,
                       "topic": "",
                       "payload": "[{\"id\":\"Gäste WC\",\"status\":\"geöffnet\",\"icon\":\"sensor_window\",\"color\":\"red\"},{\"id\":\"Flur EG\",\"status\":\"geschlossen\",\"icon\":\"sensor_window\",\"color\":\"green\"}]",
                       "payloadType": "json",
                       "x": 630,
                       "y": 360,
                       "wires": [
                           [
                               "873f660f.c087f8",
                               "3fffe9c8.3ebbb6"
                           ]
                       ]
                   },
                   {
                       "id": "873f660f.c087f8",
                       "type": "ui_template",
                       "z": "a37484bb.f4a9e8",
                       "group": "6bf7d3fa.644c5c",
                       "name": "Object Array",
                       "order": 3,
                       "width": "6",
                       "height": "4",
                       "format": "<style>\n.main\n{\n    height:100%;\n    width:100%;\n    /* background:lightblue; */\n\n}\n\n\n#t01 th {\n     \n  padding: 5px;\n  font-size:120%;\n  color: var(--nr-dashboard-groupTextColor);\n   /* color:#0eb8c0;  */\n}\n#t01 td {\n     \n  padding: 5px;\n\n}\n    \n</style>\n\n<div class=\"main\">\n\n    <table id=\"t01\">\n\n   \n    <tr><th width=150>Fenster</th><th width=100>Status</th></tr>\n     <tr ng-repeat=\"item in msg.payload\">\n            <td>{{item.id}}</td><td align=center>{{item.status}}</td><td class=\"material-icons\" style=\"color:{{item.color}}\">{{item.icon}}</td>\n    </tr>\n    </table>\n    <br><hr>\n    aus Object-Array mit bekannten Keys\n\n</div>",
                       "storeOutMessages": true,
                       "fwdInMessages": true,
                       "resendOnRefresh": true,
                       "templateScope": "local",
                       "className": "",
                       "x": 830,
                       "y": 360,
                       "wires": [
                           []
                       ]
                   },
                   {
                       "id": "3fffe9c8.3ebbb6",
                       "type": "debug",
                       "z": "a37484bb.f4a9e8",
                       "name": "Object Array",
                       "active": true,
                       "tosidebar": true,
                       "console": false,
                       "tostatus": false,
                       "complete": "payload",
                       "targetType": "msg",
                       "statusVal": "",
                       "statusType": "auto",
                       "x": 830,
                       "y": 400,
                       "wires": []
                   },
                   {
                       "id": "6bf7d3fa.644c5c",
                       "type": "ui_group",
                       "name": "Tabelle",
                       "tab": "f9bab960.c839b8",
                       "order": 1,
                       "disp": true,
                       "width": "6",
                       "collapse": false,
                       "className": ""
                   },
                   {
                       "id": "f9bab960.c839b8",
                       "type": "ui_tab",
                       "name": "testy",
                       "icon": "dashboard"
                   }
                ]
                

                Um die einzelnen Typen ineinander umzuwandeln - hier noch folgender Flow:

                screen.png

                [
                   {
                       "id": "e070fc92.3c846",
                       "type": "inject",
                       "z": "a37484bb.f4a9e8",
                       "name": "String skalar",
                       "props": [
                           {
                               "p": "payload"
                           }
                       ],
                       "repeat": "",
                       "crontab": "",
                       "once": false,
                       "onceDelay": 0.1,
                       "topic": "",
                       "payload": "[\"Gäste WC - geöffnet\", \"Flur EG - geschlossen\"]",
                       "payloadType": "str",
                       "x": 350,
                       "y": 560,
                       "wires": [
                           [
                               "cc1532ed.4d0c9",
                               "5d1310dc.67ad2"
                           ]
                       ]
                   },
                   {
                       "id": "cc1532ed.4d0c9",
                       "type": "debug",
                       "z": "a37484bb.f4a9e8",
                       "name": "String - skalar",
                       "active": true,
                       "tosidebar": true,
                       "console": false,
                       "tostatus": false,
                       "complete": "payload",
                       "targetType": "msg",
                       "statusVal": "",
                       "statusType": "auto",
                       "x": 560,
                       "y": 520,
                       "wires": []
                   },
                   {
                       "id": "5d1310dc.67ad2",
                       "type": "json",
                       "z": "a37484bb.f4a9e8",
                       "name": "",
                       "property": "payload",
                       "action": "",
                       "pretty": false,
                       "x": 590,
                       "y": 560,
                       "wires": [
                           [
                               "5dad8c2a.02a344",
                               "3fd3e.6a2e82c2a"
                           ]
                       ]
                   },
                   {
                       "id": "5dad8c2a.02a344",
                       "type": "debug",
                       "z": "a37484bb.f4a9e8",
                       "name": "String Array",
                       "active": true,
                       "tosidebar": true,
                       "console": false,
                       "tostatus": false,
                       "complete": "payload",
                       "targetType": "msg",
                       "statusVal": "",
                       "statusType": "auto",
                       "x": 770,
                       "y": 520,
                       "wires": []
                   },
                   {
                       "id": "a066c4b5.e9ef08",
                       "type": "change",
                       "z": "a37484bb.f4a9e8",
                       "name": "",
                       "rules": [
                           {
                               "t": "set",
                               "p": "topic",
                               "pt": "msg",
                               "to": "payload",
                               "tot": "msg"
                           },
                           {
                               "t": "change",
                               "p": "topic",
                               "pt": "msg",
                               "from": "(.*)\\s-\\s(.*)",
                               "fromt": "re",
                               "to": "$1",
                               "tot": "str"
                           },
                           {
                               "t": "change",
                               "p": "payload",
                               "pt": "msg",
                               "from": "(.*)\\s-\\s(.*)",
                               "fromt": "re",
                               "to": "$2",
                               "tot": "str"
                           }
                       ],
                       "action": "",
                       "property": "",
                       "from": "",
                       "to": "",
                       "reg": false,
                       "x": 910,
                       "y": 560,
                       "wires": [
                           [
                               "2ca8bc6e.1393e4",
                               "4067e436.c7d2ec"
                           ]
                       ]
                   },
                   {
                       "id": "3fd3e.6a2e82c2a",
                       "type": "split",
                       "z": "a37484bb.f4a9e8",
                       "name": "",
                       "splt": "\\n",
                       "spltType": "str",
                       "arraySplt": 1,
                       "arraySpltType": "len",
                       "stream": false,
                       "addname": "",
                       "x": 730,
                       "y": 560,
                       "wires": [
                           [
                               "a066c4b5.e9ef08"
                           ]
                       ]
                   },
                   {
                       "id": "31ec8b23.e1d8a4",
                       "type": "debug",
                       "z": "a37484bb.f4a9e8",
                       "name": "Object",
                       "active": true,
                       "tosidebar": true,
                       "console": false,
                       "tostatus": false,
                       "complete": "payload",
                       "targetType": "msg",
                       "statusVal": "",
                       "statusType": "auto",
                       "x": 1430,
                       "y": 560,
                       "wires": []
                   },
                   {
                       "id": "31d31143.bfebae",
                       "type": "debug",
                       "z": "a37484bb.f4a9e8",
                       "name": "Object Array",
                       "active": true,
                       "tosidebar": true,
                       "console": false,
                       "tostatus": false,
                       "complete": "payload",
                       "targetType": "msg",
                       "statusVal": "",
                       "statusType": "auto",
                       "x": 1470,
                       "y": 620,
                       "wires": []
                   },
                   {
                       "id": "2ca8bc6e.1393e4",
                       "type": "join",
                       "z": "a37484bb.f4a9e8",
                       "name": "",
                       "mode": "custom",
                       "build": "object",
                       "property": "payload",
                       "propertyType": "msg",
                       "key": "topic",
                       "joiner": "\\n",
                       "joinerType": "str",
                       "accumulate": true,
                       "timeout": "",
                       "count": "1",
                       "reduceRight": false,
                       "reduceExp": "",
                       "reduceInit": "",
                       "reduceInitType": "",
                       "reduceFixup": "",
                       "x": 1090,
                       "y": 560,
                       "wires": [
                           [
                               "7944be21.63c02"
                           ]
                       ]
                   },
                   {
                       "id": "7944be21.63c02",
                       "type": "trigger",
                       "z": "a37484bb.f4a9e8",
                       "name": "",
                       "op1": "",
                       "op2": "",
                       "op1type": "nul",
                       "op2type": "payl",
                       "duration": "250",
                       "extend": false,
                       "overrideDelay": false,
                       "units": "ms",
                       "reset": "",
                       "bytopic": "all",
                       "topic": "topic",
                       "outputs": 1,
                       "x": 1260,
                       "y": 560,
                       "wires": [
                           [
                               "31ec8b23.e1d8a4"
                           ]
                       ]
                   },
                   {
                       "id": "4067e436.c7d2ec",
                       "type": "change",
                       "z": "a37484bb.f4a9e8",
                       "name": "",
                       "rules": [
                           {
                               "t": "move",
                               "p": "payload",
                               "pt": "msg",
                               "to": "payload.status",
                               "tot": "msg"
                           },
                           {
                               "t": "set",
                               "p": "payload.id",
                               "pt": "msg",
                               "to": "topic",
                               "tot": "msg"
                           },
                           {
                               "t": "set",
                               "p": "payload.icon",
                               "pt": "msg",
                               "to": "sensor_window",
                               "tot": "str"
                           },
                           {
                               "t": "set",
                               "p": "payload.color",
                               "pt": "msg",
                               "to": "payload.status = 'geöffnet' ? 'green' : 'red'",
                               "tot": "jsonata"
                           }
                       ],
                       "action": "",
                       "property": "",
                       "from": "",
                       "to": "",
                       "reg": false,
                       "x": 1130,
                       "y": 620,
                       "wires": [
                           [
                               "971221b6.c0863"
                           ]
                       ]
                   },
                   {
                       "id": "971221b6.c0863",
                       "type": "join",
                       "z": "a37484bb.f4a9e8",
                       "name": "",
                       "mode": "auto",
                       "build": "string",
                       "property": "payload",
                       "propertyType": "msg",
                       "key": "topic",
                       "joiner": "\\n",
                       "joinerType": "str",
                       "accumulate": false,
                       "timeout": "",
                       "count": "",
                       "reduceRight": false,
                       "reduceExp": "",
                       "reduceInit": "",
                       "reduceInitType": "",
                       "reduceFixup": "",
                       "x": 1310,
                       "y": 620,
                       "wires": [
                           [
                               "31d31143.bfebae"
                           ]
                       ]
                   }
                ]
                

                mickymM Offline
                mickymM Offline
                mickym
                Most Active
                schrieb am zuletzt editiert von mickym
                #7

                Hier der Input als Objekt-Array - mit unbekannten Keys:

                [{"Gäste WC":"geöffnet"},{"Flur EG":"geschlossen"}]
                

                So ich habe es nun auch geschafft auch eine geschachtelte ng-repeat Anweisung in den Tabellen zu schreiben. Ist zwar doppelt aber anders bringe ich es nicht hin:

                465398ab-2936-4f7b-86ff-d67a87dbf784-image.png

                [
                   {
                       "id": "19baadb2.48e2e2",
                       "type": "inject",
                       "z": "a37484bb.f4a9e8",
                       "name": "Object Array",
                       "props": [
                           {
                               "p": "payload"
                           }
                       ],
                       "repeat": "",
                       "crontab": "",
                       "once": false,
                       "onceDelay": 0.1,
                       "topic": "",
                       "payload": "[{\"Gäste WC\":\"geöffnet\"},{\"Flur EG\":\"geschlossen\"}]",
                       "payloadType": "json",
                       "x": 190,
                       "y": 740,
                       "wires": [
                           [
                               "b7cf210.07f89e",
                               "154fe308.f2239d"
                           ]
                       ]
                   },
                   {
                       "id": "154fe308.f2239d",
                       "type": "ui_template",
                       "z": "a37484bb.f4a9e8",
                       "group": "6bf7d3fa.644c5c",
                       "name": "Object Array unknown Keys",
                       "order": 3,
                       "width": "6",
                       "height": "4",
                       "format": "<style>\n.main\n{\n    height:100%;\n    width:100%;\n    /* background:lightblue; */\n\n}\n\n\n#t01 th {\n     \n  padding: 5px;\n  font-size:120%;\n  color: var(--nr-dashboard-groupTextColor);\n   /* color:#0eb8c0;  */\n}\n#t01 td {\n     \n  padding: 5px;\n\n}\n    \n</style>\n\n<div class=\"main\">\n\n    <table id=\"t01\">\n\n   \n    <tr><th width=150>Fenster</th><th width=100>Status</th></tr>\n     <tr ng-repeat=\"item in msg.payload\">\n            <td ng-repeat=\"(key,value) in item\">{{key}}</td><td ng-repeat=\"(key,value) in item\" align=center>{{value}}</td>\n    </tr>\n    </table>\n    <br><hr>\n    aus Object-Array mit unbekannten Keys\n\n</div>",
                       "storeOutMessages": true,
                       "fwdInMessages": true,
                       "resendOnRefresh": true,
                       "templateScope": "local",
                       "className": "",
                       "x": 440,
                       "y": 740,
                       "wires": [
                           []
                       ]
                   },
                   {
                       "id": "b7cf210.07f89e",
                       "type": "debug",
                       "z": "a37484bb.f4a9e8",
                       "name": "Object Array",
                       "active": true,
                       "tosidebar": true,
                       "console": false,
                       "tostatus": false,
                       "complete": "payload",
                       "targetType": "msg",
                       "statusVal": "",
                       "statusType": "auto",
                       "x": 390,
                       "y": 780,
                       "wires": []
                   },
                   {
                       "id": "6bf7d3fa.644c5c",
                       "type": "ui_group",
                       "name": "Tabelle",
                       "tab": "f9bab960.c839b8",
                       "order": 1,
                       "disp": true,
                       "width": "6",
                       "collapse": false,
                       "className": ""
                   },
                   {
                       "id": "f9bab960.c839b8",
                       "type": "ui_tab",
                       "name": "testy",
                       "icon": "dashboard"
                   }
                ]
                

                adda8a39-dfb5-4628-8809-71096a2bcfc1-image.png

                Hier mal der relevante Code:

                    <table id="t01">
                
                   
                    <tr><th width=150>Fenster</th><th width=100>Status</th></tr>
                     <tr ng-repeat="item in msg.payload">
                            <td ng-repeat="(key,value) in item">{{key}}</td><td ng-repeat="(key,value) in item" align=center>{{value}}</td>
                    </tr>
                    </table>
                

                Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                1 Antwort Letzte Antwort
                0
                • S Saranger

                  Re: Visualisierung (Dashboard) gestalten & strukturieren

                  Hallo zusammen, ich kämpfe gerade mit der Darstellung einer Zeichenkette wie man das optisch schöner gestalten kann, vielleicht hat einer eine Idee:-).

                  Ich lasse mir mit einem Blockly script in einen Datenpunkt (Zeichenfolge) meine geöffneten Fenster schreiben. Jetzt versuche ich das irgendwie im Node Red Dashboard schicker darzustellen. Am liebsten hätte ich jedes Fenster in einer Zeile ohne die Klammern (siehe Bild). Mit einem Template bekomme ich es auch nicht hin da ich nicht wirklich Programmierkenntnisse habe.

                  Danke schon mal für eure Ideen 🙂

                  Fenster.JPG skript.JPG

                  mickymM Offline
                  mickymM Offline
                  mickym
                  Most Active
                  schrieb am zuletzt editiert von
                  #8

                  @saranger Mir ist evtl. noch in den Sinn gekommen, dass Du nur ein Gruppe mit den geöffneten Fenstern brauchst und gar nicht den Status aus dem String brauchst.

                  Eingang ist dieser String:

                  '["Gäste WC - geöffnet", "Flur EG - geschlossen"]'
                  

                  82d5ee1a-6c47-4e40-9b4d-710701ac754c-image.png

                  Hier der zugrhörige Flow:

                  cb4fad55-f4e8-41ab-9cd6-61c41de9f74b-image.png

                  [
                     {
                         "id": "82afd48.0a8e428",
                         "type": "json",
                         "z": "a37484bb.f4a9e8",
                         "name": "",
                         "property": "payload",
                         "action": "",
                         "pretty": false,
                         "x": 350,
                         "y": 780,
                         "wires": [
                             [
                                 "9b3d4382.8552c"
                             ]
                         ]
                     },
                     {
                         "id": "9b3d4382.8552c",
                         "type": "split",
                         "z": "a37484bb.f4a9e8",
                         "name": "",
                         "splt": "\\n",
                         "spltType": "str",
                         "arraySplt": 1,
                         "arraySpltType": "len",
                         "stream": false,
                         "addname": "",
                         "x": 490,
                         "y": 780,
                         "wires": [
                             [
                                 "9e2c6b6a.9aaf28"
                             ]
                         ]
                     },
                     {
                         "id": "9e2c6b6a.9aaf28",
                         "type": "change",
                         "z": "a37484bb.f4a9e8",
                         "name": "",
                         "rules": [
                             {
                                 "t": "change",
                                 "p": "payload",
                                 "pt": "msg",
                                 "from": "(.*)\\s-\\s(.*)",
                                 "fromt": "re",
                                 "to": "$1",
                                 "tot": "str"
                             }
                         ],
                         "action": "",
                         "property": "",
                         "from": "",
                         "to": "",
                         "reg": false,
                         "x": 680,
                         "y": 780,
                         "wires": [
                             [
                                 "fbf33226.1c49d"
                             ]
                         ]
                     },
                     {
                         "id": "2f3891c9.82aece",
                         "type": "inject",
                         "z": "a37484bb.f4a9e8",
                         "name": "String skalar",
                         "props": [
                             {
                                 "p": "payload"
                             }
                         ],
                         "repeat": "",
                         "crontab": "",
                         "once": false,
                         "onceDelay": 0.1,
                         "topic": "",
                         "payload": "[\"Gäste WC - geöffnet\", \"Flur EG - geschlossen\"]",
                         "payloadType": "str",
                         "x": 190,
                         "y": 780,
                         "wires": [
                             [
                                 "82afd48.0a8e428"
                             ]
                         ]
                     },
                     {
                         "id": "fbf33226.1c49d",
                         "type": "join",
                         "z": "a37484bb.f4a9e8",
                         "name": "",
                         "mode": "auto",
                         "build": "string",
                         "property": "payload",
                         "propertyType": "msg",
                         "key": "topic",
                         "joiner": "\\n",
                         "joinerType": "str",
                         "accumulate": "false",
                         "timeout": "",
                         "count": "",
                         "reduceRight": false,
                         "x": 870,
                         "y": 780,
                         "wires": [
                             [
                                 "a048b4a0.eb07b8",
                                 "b297b228.d1ff8"
                             ]
                         ]
                     },
                     {
                         "id": "a048b4a0.eb07b8",
                         "type": "debug",
                         "z": "a37484bb.f4a9e8",
                         "name": "String Array",
                         "active": false,
                         "tosidebar": true,
                         "console": false,
                         "tostatus": false,
                         "complete": "payload",
                         "targetType": "msg",
                         "statusVal": "",
                         "statusType": "auto",
                         "x": 1030,
                         "y": 740,
                         "wires": []
                     },
                     {
                         "id": "b297b228.d1ff8",
                         "type": "ui_template",
                         "z": "a37484bb.f4a9e8",
                         "group": "cc1b8ef1.492f5",
                         "name": "String Array",
                         "order": 1,
                         "width": "6",
                         "height": "4",
                         "format": "<style>\n.main\n{\n    height:100%;\n    width:100%;\n    /* background:lightblue; */\n\n}\n\n\n#t01 th {\n     \n  padding: 5px;\n  font-size:120%;\n  color: var(--nr-dashboard-groupTextColor);\n   /* color:#0eb8c0;  */\n}\n#t01 td {\n     \n  padding: 5px;\n\n}\n    \n</style>\n\n<div class=\"main\">\n\n    <table id=\"t01\">\n\n   \n    <tr ng-repeat=\"str in msg.payload\">\n        <td>{{str}}</td>\n    </tr>\n    \n    </table>\n</div>",
                         "storeOutMessages": true,
                         "fwdInMessages": true,
                         "resendOnRefresh": true,
                         "templateScope": "local",
                         "className": "",
                         "x": 1030,
                         "y": 780,
                         "wires": [
                             []
                         ]
                     },
                     {
                         "id": "cc1b8ef1.492f5",
                         "type": "ui_group",
                         "name": "Geöffnete Fenster",
                         "tab": "f9bab960.c839b8",
                         "order": 3,
                         "disp": true,
                         "width": "6",
                         "collapse": false,
                         "className": ""
                     },
                     {
                         "id": "f9bab960.c839b8",
                         "type": "ui_tab",
                         "name": "testy",
                         "icon": "dashboard"
                     }
                  ]
                  

                  Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                  1 Antwort Letzte Antwort
                  0
                  • S Saranger

                    Re: Visualisierung (Dashboard) gestalten & strukturieren

                    Hallo zusammen, ich kämpfe gerade mit der Darstellung einer Zeichenkette wie man das optisch schöner gestalten kann, vielleicht hat einer eine Idee:-).

                    Ich lasse mir mit einem Blockly script in einen Datenpunkt (Zeichenfolge) meine geöffneten Fenster schreiben. Jetzt versuche ich das irgendwie im Node Red Dashboard schicker darzustellen. Am liebsten hätte ich jedes Fenster in einer Zeile ohne die Klammern (siehe Bild). Mit einem Template bekomme ich es auch nicht hin da ich nicht wirklich Programmierkenntnisse habe.

                    Danke schon mal für eure Ideen 🙂

                    Fenster.JPG skript.JPG

                    mickymM Offline
                    mickymM Offline
                    mickym
                    Most Active
                    schrieb am zuletzt editiert von mickym
                    #9

                    @saranger So und falls ich es immer noch falsch verstanden habe - dann jetzt aber:

                    Also Deinen String genommen - es werden nur die Fenster aus dem String herausgelöst und automatisch gezählt.

                    Außerdem dies ist nun eine Darstellung mit den Text-Nodes und nicht mit der Template Node. 😉

                    241cf046-f596-46d1-8cf7-de8e2d5ee695-image.png

                    Hier der zugehörige Flow wieder mit Deinen Strings als Input:

                    df12fc04-dd16-4ab3-b05d-ce3a3e46604d-image.png

                    [
                       {
                           "id": "82afd48.0a8e428",
                           "type": "json",
                           "z": "a37484bb.f4a9e8",
                           "name": "",
                           "property": "payload",
                           "action": "",
                           "pretty": false,
                           "x": 350,
                           "y": 1040,
                           "wires": [
                               [
                                   "9b3d4382.8552c"
                               ]
                           ]
                       },
                       {
                           "id": "9b3d4382.8552c",
                           "type": "split",
                           "z": "a37484bb.f4a9e8",
                           "name": "",
                           "splt": "\\n",
                           "spltType": "str",
                           "arraySplt": 1,
                           "arraySpltType": "len",
                           "stream": false,
                           "addname": "",
                           "x": 490,
                           "y": 1040,
                           "wires": [
                               [
                                   "9e2c6b6a.9aaf28",
                                   "d5c20a87.c53718"
                               ]
                           ]
                       },
                       {
                           "id": "9e2c6b6a.9aaf28",
                           "type": "change",
                           "z": "a37484bb.f4a9e8",
                           "name": "",
                           "rules": [
                               {
                                   "t": "change",
                                   "p": "payload",
                                   "pt": "msg",
                                   "from": "(.*)\\s-\\s(.*)",
                                   "fromt": "re",
                                   "to": "$1",
                                   "tot": "str"
                               }
                           ],
                           "action": "",
                           "property": "",
                           "from": "",
                           "to": "",
                           "reg": false,
                           "x": 680,
                           "y": 1040,
                           "wires": [
                               [
                                   "fbf33226.1c49d"
                               ]
                           ]
                       },
                       {
                           "id": "2f3891c9.82aece",
                           "type": "inject",
                           "z": "a37484bb.f4a9e8",
                           "name": "String skalar",
                           "props": [
                               {
                                   "p": "payload"
                               }
                           ],
                           "repeat": "",
                           "crontab": "",
                           "once": false,
                           "onceDelay": 0.1,
                           "topic": "",
                           "payload": "[\"Gäste WC - geöffnet\", \"Flur EG - geschlossen\"]",
                           "payloadType": "str",
                           "x": 190,
                           "y": 1040,
                           "wires": [
                               [
                                   "82afd48.0a8e428"
                               ]
                           ]
                       },
                       {
                           "id": "fbf33226.1c49d",
                           "type": "join",
                           "z": "a37484bb.f4a9e8",
                           "name": "",
                           "mode": "auto",
                           "build": "string",
                           "property": "payload",
                           "propertyType": "msg",
                           "key": "topic",
                           "joiner": "\\n",
                           "joinerType": "str",
                           "accumulate": "false",
                           "timeout": "",
                           "count": "",
                           "reduceRight": false,
                           "x": 870,
                           "y": 1040,
                           "wires": [
                               [
                                   "1d91649e.46ff2b"
                               ]
                           ]
                       },
                       {
                           "id": "1d91649e.46ff2b",
                           "type": "split",
                           "z": "a37484bb.f4a9e8",
                           "name": "",
                           "splt": "\\n",
                           "spltType": "str",
                           "arraySplt": 1,
                           "arraySpltType": "len",
                           "stream": false,
                           "addname": "",
                           "x": 530,
                           "y": 1120,
                           "wires": [
                               [
                                   "ef16d85d.d10388"
                               ]
                           ]
                       },
                       {
                           "id": "ef16d85d.d10388",
                           "type": "join",
                           "z": "a37484bb.f4a9e8",
                           "name": "",
                           "mode": "custom",
                           "build": "string",
                           "property": "payload",
                           "propertyType": "msg",
                           "key": "topic",
                           "joiner": "<br>",
                           "joinerType": "str",
                           "accumulate": false,
                           "timeout": "",
                           "count": "",
                           "reduceRight": false,
                           "reduceExp": "",
                           "reduceInit": "",
                           "reduceInitType": "",
                           "reduceFixup": "",
                           "x": 680,
                           "y": 1120,
                           "wires": [
                               [
                                   "824e7b21.8d1a58"
                               ]
                           ]
                       },
                       {
                           "id": "824e7b21.8d1a58",
                           "type": "ui_text",
                           "z": "a37484bb.f4a9e8",
                           "group": "12ead05f.01c93",
                           "order": 2,
                           "width": "6",
                           "height": "2",
                           "name": "",
                           "label": "Fenster:",
                           "format": "{{msg.payload}}",
                           "layout": "row-spread",
                           "className": "",
                           "x": 830,
                           "y": 1120,
                           "wires": []
                       },
                       {
                           "id": "d5c20a87.c53718",
                           "type": "ui_text",
                           "z": "a37484bb.f4a9e8",
                           "group": "12ead05f.01c93",
                           "order": 1,
                           "width": 0,
                           "height": 0,
                           "name": "",
                           "label": "Geöffnete Fenster",
                           "format": "{{msg.parts.count}}",
                           "layout": "row-spread",
                           "className": "",
                           "x": 690,
                           "y": 980,
                           "wires": []
                       },
                       {
                           "id": "12ead05f.01c93",
                           "type": "ui_group",
                           "name": "Fenster",
                           "tab": "f9bab960.c839b8",
                           "order": 4,
                           "disp": true,
                           "width": "6",
                           "collapse": false,
                           "className": ""
                       },
                       {
                           "id": "f9bab960.c839b8",
                           "type": "ui_tab",
                           "name": "testy",
                           "icon": "dashboard"
                       }
                    ]
                    

                    So nun hab ich glaub alle Möglichkeiten durchgespielt. Input also String aus Deinem Datenpunkt ist wieder der folgende String:

                    '["Gäste WC - geöffnet", "Flur EG - geschlossen"]'
                    

                    Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                    S 1 Antwort Letzte Antwort
                    0
                    • mickymM mickym

                      @saranger So und falls ich es immer noch falsch verstanden habe - dann jetzt aber:

                      Also Deinen String genommen - es werden nur die Fenster aus dem String herausgelöst und automatisch gezählt.

                      Außerdem dies ist nun eine Darstellung mit den Text-Nodes und nicht mit der Template Node. 😉

                      241cf046-f596-46d1-8cf7-de8e2d5ee695-image.png

                      Hier der zugehörige Flow wieder mit Deinen Strings als Input:

                      df12fc04-dd16-4ab3-b05d-ce3a3e46604d-image.png

                      [
                         {
                             "id": "82afd48.0a8e428",
                             "type": "json",
                             "z": "a37484bb.f4a9e8",
                             "name": "",
                             "property": "payload",
                             "action": "",
                             "pretty": false,
                             "x": 350,
                             "y": 1040,
                             "wires": [
                                 [
                                     "9b3d4382.8552c"
                                 ]
                             ]
                         },
                         {
                             "id": "9b3d4382.8552c",
                             "type": "split",
                             "z": "a37484bb.f4a9e8",
                             "name": "",
                             "splt": "\\n",
                             "spltType": "str",
                             "arraySplt": 1,
                             "arraySpltType": "len",
                             "stream": false,
                             "addname": "",
                             "x": 490,
                             "y": 1040,
                             "wires": [
                                 [
                                     "9e2c6b6a.9aaf28",
                                     "d5c20a87.c53718"
                                 ]
                             ]
                         },
                         {
                             "id": "9e2c6b6a.9aaf28",
                             "type": "change",
                             "z": "a37484bb.f4a9e8",
                             "name": "",
                             "rules": [
                                 {
                                     "t": "change",
                                     "p": "payload",
                                     "pt": "msg",
                                     "from": "(.*)\\s-\\s(.*)",
                                     "fromt": "re",
                                     "to": "$1",
                                     "tot": "str"
                                 }
                             ],
                             "action": "",
                             "property": "",
                             "from": "",
                             "to": "",
                             "reg": false,
                             "x": 680,
                             "y": 1040,
                             "wires": [
                                 [
                                     "fbf33226.1c49d"
                                 ]
                             ]
                         },
                         {
                             "id": "2f3891c9.82aece",
                             "type": "inject",
                             "z": "a37484bb.f4a9e8",
                             "name": "String skalar",
                             "props": [
                                 {
                                     "p": "payload"
                                 }
                             ],
                             "repeat": "",
                             "crontab": "",
                             "once": false,
                             "onceDelay": 0.1,
                             "topic": "",
                             "payload": "[\"Gäste WC - geöffnet\", \"Flur EG - geschlossen\"]",
                             "payloadType": "str",
                             "x": 190,
                             "y": 1040,
                             "wires": [
                                 [
                                     "82afd48.0a8e428"
                                 ]
                             ]
                         },
                         {
                             "id": "fbf33226.1c49d",
                             "type": "join",
                             "z": "a37484bb.f4a9e8",
                             "name": "",
                             "mode": "auto",
                             "build": "string",
                             "property": "payload",
                             "propertyType": "msg",
                             "key": "topic",
                             "joiner": "\\n",
                             "joinerType": "str",
                             "accumulate": "false",
                             "timeout": "",
                             "count": "",
                             "reduceRight": false,
                             "x": 870,
                             "y": 1040,
                             "wires": [
                                 [
                                     "1d91649e.46ff2b"
                                 ]
                             ]
                         },
                         {
                             "id": "1d91649e.46ff2b",
                             "type": "split",
                             "z": "a37484bb.f4a9e8",
                             "name": "",
                             "splt": "\\n",
                             "spltType": "str",
                             "arraySplt": 1,
                             "arraySpltType": "len",
                             "stream": false,
                             "addname": "",
                             "x": 530,
                             "y": 1120,
                             "wires": [
                                 [
                                     "ef16d85d.d10388"
                                 ]
                             ]
                         },
                         {
                             "id": "ef16d85d.d10388",
                             "type": "join",
                             "z": "a37484bb.f4a9e8",
                             "name": "",
                             "mode": "custom",
                             "build": "string",
                             "property": "payload",
                             "propertyType": "msg",
                             "key": "topic",
                             "joiner": "<br>",
                             "joinerType": "str",
                             "accumulate": false,
                             "timeout": "",
                             "count": "",
                             "reduceRight": false,
                             "reduceExp": "",
                             "reduceInit": "",
                             "reduceInitType": "",
                             "reduceFixup": "",
                             "x": 680,
                             "y": 1120,
                             "wires": [
                                 [
                                     "824e7b21.8d1a58"
                                 ]
                             ]
                         },
                         {
                             "id": "824e7b21.8d1a58",
                             "type": "ui_text",
                             "z": "a37484bb.f4a9e8",
                             "group": "12ead05f.01c93",
                             "order": 2,
                             "width": "6",
                             "height": "2",
                             "name": "",
                             "label": "Fenster:",
                             "format": "{{msg.payload}}",
                             "layout": "row-spread",
                             "className": "",
                             "x": 830,
                             "y": 1120,
                             "wires": []
                         },
                         {
                             "id": "d5c20a87.c53718",
                             "type": "ui_text",
                             "z": "a37484bb.f4a9e8",
                             "group": "12ead05f.01c93",
                             "order": 1,
                             "width": 0,
                             "height": 0,
                             "name": "",
                             "label": "Geöffnete Fenster",
                             "format": "{{msg.parts.count}}",
                             "layout": "row-spread",
                             "className": "",
                             "x": 690,
                             "y": 980,
                             "wires": []
                         },
                         {
                             "id": "12ead05f.01c93",
                             "type": "ui_group",
                             "name": "Fenster",
                             "tab": "f9bab960.c839b8",
                             "order": 4,
                             "disp": true,
                             "width": "6",
                             "collapse": false,
                             "className": ""
                         },
                         {
                             "id": "f9bab960.c839b8",
                             "type": "ui_tab",
                             "name": "testy",
                             "icon": "dashboard"
                         }
                      ]
                      

                      So nun hab ich glaub alle Möglichkeiten durchgespielt. Input also String aus Deinem Datenpunkt ist wieder der folgende String:

                      '["Gäste WC - geöffnet", "Flur EG - geschlossen"]'
                      
                      S Offline
                      S Offline
                      Saranger
                      schrieb am zuletzt editiert von
                      #10

                      @mickym Einen schönen guten Morgen, also erstmal vielen vielen Dank für den Einsatz :-). Das hätte ich so nicht hinbekommen. Ich habe mal eingefügt welchen Style ich genutzt habe :-). Eine Sache ist mir noch aufgefallen, wenn die Zahl 0 ist bleibt das letzte Fenster in der liste aber stehen, im Io Broker ist diese aber leer. Muss ich das irgendwie über eine Logik leerenlassen (wenn Zahl 0 dann ...)?

                      Übersicht.JPG

                      Übersicht detailiert.JPG

                      Vg 🙂

                      mickymM 1 Antwort Letzte Antwort
                      0
                      • S Saranger

                        @mickym Einen schönen guten Morgen, also erstmal vielen vielen Dank für den Einsatz :-). Das hätte ich so nicht hinbekommen. Ich habe mal eingefügt welchen Style ich genutzt habe :-). Eine Sache ist mir noch aufgefallen, wenn die Zahl 0 ist bleibt das letzte Fenster in der liste aber stehen, im Io Broker ist diese aber leer. Muss ich das irgendwie über eine Logik leerenlassen (wenn Zahl 0 dann ...)?

                        Übersicht.JPG

                        Übersicht detailiert.JPG

                        Vg 🙂

                        mickymM Offline
                        mickymM Offline
                        mickym
                        Most Active
                        schrieb am zuletzt editiert von mickym
                        #11

                        @saranger sagte in Aus String eine Übersichtliche Liste erstellen:

                        Muss ich das irgendwie über eine Logik leerenlassen (wenn Zahl 0 dann ...)?

                        Die Antwort ist JA. 🙂

                        Nun ich sehe halt nicht genau - wie Deine Datenpunkte aussehen, aber ja Du hast Recht - man muss um die Template Node zu leeren einen leeren String schicken. Der Grund ist die split Node - die halt auch nichts schickt, wenn es nichts zu splitten gibt. 😉 Im NodeRed nimmst Du für Filter oder Bedingungen grundsätzlich eine Switch Node.

                        @saranger sagte in Aus String eine Übersichtliche Liste erstellen:

                        im Io Broker ist diese aber leer.

                        Basierend auf dieser Aussage bin ich mal von einem leeren String ausgegangen, den man dann auch direkt weiterleiten kann. Ansonsten musst halt die Abprüfung so machen, wie es im iobroker ist und dann mit einer Change Node einen leeren String an die Template Node schicken:

                        Hier der abgewandelte Flow:

                        86998a9b-f3d0-4cc0-aa29-55a6708c17f0-image.png

                        [
                           {
                               "id": "d8215a8d.4c8008",
                               "type": "json",
                               "z": "a37484bb.f4a9e8",
                               "name": "",
                               "property": "payload",
                               "action": "",
                               "pretty": false,
                               "x": 490,
                               "y": 1300,
                               "wires": [
                                   [
                                       "5f04feb3.a02da"
                                   ]
                               ]
                           },
                           {
                               "id": "5f04feb3.a02da",
                               "type": "split",
                               "z": "a37484bb.f4a9e8",
                               "name": "",
                               "splt": "\\n",
                               "spltType": "str",
                               "arraySplt": 1,
                               "arraySpltType": "len",
                               "stream": false,
                               "addname": "",
                               "x": 630,
                               "y": 1300,
                               "wires": [
                                   [
                                       "1e3c9f33.14b471"
                                   ]
                               ]
                           },
                           {
                               "id": "1e3c9f33.14b471",
                               "type": "change",
                               "z": "a37484bb.f4a9e8",
                               "name": "",
                               "rules": [
                                   {
                                       "t": "change",
                                       "p": "payload",
                                       "pt": "msg",
                                       "from": "(.*)\\s-\\s(.*)",
                                       "fromt": "re",
                                       "to": "$1",
                                       "tot": "str"
                                   }
                               ],
                               "action": "",
                               "property": "",
                               "from": "",
                               "to": "",
                               "reg": false,
                               "x": 820,
                               "y": 1300,
                               "wires": [
                                   [
                                       "e43c748d.dae1b8"
                                   ]
                               ]
                           },
                           {
                               "id": "bcdf35fc.120a88",
                               "type": "inject",
                               "z": "a37484bb.f4a9e8",
                               "name": "String skalar",
                               "props": [
                                   {
                                       "p": "payload"
                                   }
                               ],
                               "repeat": "",
                               "crontab": "",
                               "once": false,
                               "onceDelay": 0.1,
                               "topic": "",
                               "payload": "[\"Gäste WC - geöffnet\", \"Flur EG - geschlossen\"]",
                               "payloadType": "str",
                               "x": 170,
                               "y": 1300,
                               "wires": [
                                   [
                                       "f79208ff.09d158"
                                   ]
                               ]
                           },
                           {
                               "id": "e43c748d.dae1b8",
                               "type": "join",
                               "z": "a37484bb.f4a9e8",
                               "name": "",
                               "mode": "auto",
                               "build": "string",
                               "property": "payload",
                               "propertyType": "msg",
                               "key": "topic",
                               "joiner": "\\n",
                               "joinerType": "str",
                               "accumulate": "false",
                               "timeout": "",
                               "count": "",
                               "reduceRight": false,
                               "x": 1010,
                               "y": 1300,
                               "wires": [
                                   [
                                       "62fad45b.a9a66c"
                                   ]
                               ]
                           },
                           {
                               "id": "62fad45b.a9a66c",
                               "type": "ui_template",
                               "z": "a37484bb.f4a9e8",
                               "group": "cc1b8ef1.492f5",
                               "name": "String Array",
                               "order": 1,
                               "width": "6",
                               "height": "4",
                               "format": "<style>\n.main\n{\n    height:100%;\n    width:100%;\n    /* background:lightblue; */\n\n}\n\n\n#t01 th {\n     \n  padding: 5px;\n  font-size:120%;\n  color: var(--nr-dashboard-groupTextColor);\n   /* color:#0eb8c0;  */\n}\n#t01 td {\n     \n  padding: 5px;\n\n}\n    \n</style>\n\n<div class=\"main\">\n\n    <table id=\"t01\">\n\n   \n    <tr ng-repeat=\"str in msg.payload\">\n        <td>{{str}}</td>\n    </tr>\n    \n    </table>\n</div>",
                               "storeOutMessages": true,
                               "fwdInMessages": true,
                               "resendOnRefresh": true,
                               "templateScope": "local",
                               "className": "",
                               "x": 1170,
                               "y": 1340,
                               "wires": [
                                   []
                               ]
                           },
                           {
                               "id": "f79208ff.09d158",
                               "type": "switch",
                               "z": "a37484bb.f4a9e8",
                               "name": "",
                               "property": "payload",
                               "propertyType": "msg",
                               "rules": [
                                   {
                                       "t": "nempty"
                                   },
                                   {
                                       "t": "empty"
                                   }
                               ],
                               "checkall": "true",
                               "repair": false,
                               "outputs": 2,
                               "x": 350,
                               "y": 1340,
                               "wires": [
                                   [
                                       "d8215a8d.4c8008"
                                   ],
                                   [
                                       "62fad45b.a9a66c"
                                   ]
                               ]
                           },
                           {
                               "id": "99fdf0de.e9b8b",
                               "type": "inject",
                               "z": "a37484bb.f4a9e8",
                               "name": "Leer \"\"",
                               "props": [
                                   {
                                       "p": "payload"
                                   }
                               ],
                               "repeat": "",
                               "crontab": "",
                               "once": false,
                               "onceDelay": 0.1,
                               "topic": "",
                               "payload": "",
                               "payloadType": "str",
                               "x": 170,
                               "y": 1340,
                               "wires": [
                                   [
                                       "f79208ff.09d158"
                                   ]
                               ]
                           },
                           {
                               "id": "cc1b8ef1.492f5",
                               "type": "ui_group",
                               "name": "Geöffnete Fenster",
                               "tab": "f9bab960.c839b8",
                               "order": 3,
                               "disp": true,
                               "width": "6",
                               "collapse": false,
                               "className": ""
                           },
                           {
                               "id": "f9bab960.c839b8",
                               "type": "ui_tab",
                               "name": "testy",
                               "icon": "dashboard"
                           }
                        ]
                        

                        Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                        S 1 Antwort Letzte Antwort
                        0
                        • mickymM mickym

                          @saranger sagte in Aus String eine Übersichtliche Liste erstellen:

                          Muss ich das irgendwie über eine Logik leerenlassen (wenn Zahl 0 dann ...)?

                          Die Antwort ist JA. 🙂

                          Nun ich sehe halt nicht genau - wie Deine Datenpunkte aussehen, aber ja Du hast Recht - man muss um die Template Node zu leeren einen leeren String schicken. Der Grund ist die split Node - die halt auch nichts schickt, wenn es nichts zu splitten gibt. 😉 Im NodeRed nimmst Du für Filter oder Bedingungen grundsätzlich eine Switch Node.

                          @saranger sagte in Aus String eine Übersichtliche Liste erstellen:

                          im Io Broker ist diese aber leer.

                          Basierend auf dieser Aussage bin ich mal von einem leeren String ausgegangen, den man dann auch direkt weiterleiten kann. Ansonsten musst halt die Abprüfung so machen, wie es im iobroker ist und dann mit einer Change Node einen leeren String an die Template Node schicken:

                          Hier der abgewandelte Flow:

                          86998a9b-f3d0-4cc0-aa29-55a6708c17f0-image.png

                          [
                             {
                                 "id": "d8215a8d.4c8008",
                                 "type": "json",
                                 "z": "a37484bb.f4a9e8",
                                 "name": "",
                                 "property": "payload",
                                 "action": "",
                                 "pretty": false,
                                 "x": 490,
                                 "y": 1300,
                                 "wires": [
                                     [
                                         "5f04feb3.a02da"
                                     ]
                                 ]
                             },
                             {
                                 "id": "5f04feb3.a02da",
                                 "type": "split",
                                 "z": "a37484bb.f4a9e8",
                                 "name": "",
                                 "splt": "\\n",
                                 "spltType": "str",
                                 "arraySplt": 1,
                                 "arraySpltType": "len",
                                 "stream": false,
                                 "addname": "",
                                 "x": 630,
                                 "y": 1300,
                                 "wires": [
                                     [
                                         "1e3c9f33.14b471"
                                     ]
                                 ]
                             },
                             {
                                 "id": "1e3c9f33.14b471",
                                 "type": "change",
                                 "z": "a37484bb.f4a9e8",
                                 "name": "",
                                 "rules": [
                                     {
                                         "t": "change",
                                         "p": "payload",
                                         "pt": "msg",
                                         "from": "(.*)\\s-\\s(.*)",
                                         "fromt": "re",
                                         "to": "$1",
                                         "tot": "str"
                                     }
                                 ],
                                 "action": "",
                                 "property": "",
                                 "from": "",
                                 "to": "",
                                 "reg": false,
                                 "x": 820,
                                 "y": 1300,
                                 "wires": [
                                     [
                                         "e43c748d.dae1b8"
                                     ]
                                 ]
                             },
                             {
                                 "id": "bcdf35fc.120a88",
                                 "type": "inject",
                                 "z": "a37484bb.f4a9e8",
                                 "name": "String skalar",
                                 "props": [
                                     {
                                         "p": "payload"
                                     }
                                 ],
                                 "repeat": "",
                                 "crontab": "",
                                 "once": false,
                                 "onceDelay": 0.1,
                                 "topic": "",
                                 "payload": "[\"Gäste WC - geöffnet\", \"Flur EG - geschlossen\"]",
                                 "payloadType": "str",
                                 "x": 170,
                                 "y": 1300,
                                 "wires": [
                                     [
                                         "f79208ff.09d158"
                                     ]
                                 ]
                             },
                             {
                                 "id": "e43c748d.dae1b8",
                                 "type": "join",
                                 "z": "a37484bb.f4a9e8",
                                 "name": "",
                                 "mode": "auto",
                                 "build": "string",
                                 "property": "payload",
                                 "propertyType": "msg",
                                 "key": "topic",
                                 "joiner": "\\n",
                                 "joinerType": "str",
                                 "accumulate": "false",
                                 "timeout": "",
                                 "count": "",
                                 "reduceRight": false,
                                 "x": 1010,
                                 "y": 1300,
                                 "wires": [
                                     [
                                         "62fad45b.a9a66c"
                                     ]
                                 ]
                             },
                             {
                                 "id": "62fad45b.a9a66c",
                                 "type": "ui_template",
                                 "z": "a37484bb.f4a9e8",
                                 "group": "cc1b8ef1.492f5",
                                 "name": "String Array",
                                 "order": 1,
                                 "width": "6",
                                 "height": "4",
                                 "format": "<style>\n.main\n{\n    height:100%;\n    width:100%;\n    /* background:lightblue; */\n\n}\n\n\n#t01 th {\n     \n  padding: 5px;\n  font-size:120%;\n  color: var(--nr-dashboard-groupTextColor);\n   /* color:#0eb8c0;  */\n}\n#t01 td {\n     \n  padding: 5px;\n\n}\n    \n</style>\n\n<div class=\"main\">\n\n    <table id=\"t01\">\n\n   \n    <tr ng-repeat=\"str in msg.payload\">\n        <td>{{str}}</td>\n    </tr>\n    \n    </table>\n</div>",
                                 "storeOutMessages": true,
                                 "fwdInMessages": true,
                                 "resendOnRefresh": true,
                                 "templateScope": "local",
                                 "className": "",
                                 "x": 1170,
                                 "y": 1340,
                                 "wires": [
                                     []
                                 ]
                             },
                             {
                                 "id": "f79208ff.09d158",
                                 "type": "switch",
                                 "z": "a37484bb.f4a9e8",
                                 "name": "",
                                 "property": "payload",
                                 "propertyType": "msg",
                                 "rules": [
                                     {
                                         "t": "nempty"
                                     },
                                     {
                                         "t": "empty"
                                     }
                                 ],
                                 "checkall": "true",
                                 "repair": false,
                                 "outputs": 2,
                                 "x": 350,
                                 "y": 1340,
                                 "wires": [
                                     [
                                         "d8215a8d.4c8008"
                                     ],
                                     [
                                         "62fad45b.a9a66c"
                                     ]
                                 ]
                             },
                             {
                                 "id": "99fdf0de.e9b8b",
                                 "type": "inject",
                                 "z": "a37484bb.f4a9e8",
                                 "name": "Leer \"\"",
                                 "props": [
                                     {
                                         "p": "payload"
                                     }
                                 ],
                                 "repeat": "",
                                 "crontab": "",
                                 "once": false,
                                 "onceDelay": 0.1,
                                 "topic": "",
                                 "payload": "",
                                 "payloadType": "str",
                                 "x": 170,
                                 "y": 1340,
                                 "wires": [
                                     [
                                         "f79208ff.09d158"
                                     ]
                                 ]
                             },
                             {
                                 "id": "cc1b8ef1.492f5",
                                 "type": "ui_group",
                                 "name": "Geöffnete Fenster",
                                 "tab": "f9bab960.c839b8",
                                 "order": 3,
                                 "disp": true,
                                 "width": "6",
                                 "collapse": false,
                                 "className": ""
                             },
                             {
                                 "id": "f9bab960.c839b8",
                                 "type": "ui_tab",
                                 "name": "testy",
                                 "icon": "dashboard"
                             }
                          ]
                          

                          S Offline
                          S Offline
                          Saranger
                          schrieb am zuletzt editiert von
                          #12

                          @mickym

                          hab es hin bekommen 🙂 Da ich ja eh die Zahlen auswerte und sich bei 0 die Farbe ändert hatte ich somit die 0 aus der switch Node und hab diese auf eine change node gelegt 🙂

                          hab es mal beigefügt wie es jetzt komplett ist.

                          final.JPG

                          mickymM 1 Antwort Letzte Antwort
                          0
                          • S Saranger

                            @mickym

                            hab es hin bekommen 🙂 Da ich ja eh die Zahlen auswerte und sich bei 0 die Farbe ändert hatte ich somit die 0 aus der switch Node und hab diese auf eine change node gelegt 🙂

                            hab es mal beigefügt wie es jetzt komplett ist.

                            final.JPG

                            mickymM Offline
                            mickymM Offline
                            mickym
                            Most Active
                            schrieb am zuletzt editiert von mickym
                            #13

                            @saranger Super 👍
                            Wie ich an Deinen iobroker In Nodes sehe hättest Du aber auch auf einen String "[]" abprüfen können (insofern ja die Change Node in jedem Fall erforderlich, da Du nicht wirklich einen leeren String in Deinem Datenpunkt hattest) - wie immer gibt es ja mehrere Wege - wichtig war ja nur, dass Du die Template Nodes mit einem leeren String löschen kannst. 🙂

                            Jeder Flow bzw. jedes Script, das ich hier poste implementiert jeder auf eigene Gefahr. Flows und Scripts können Fehler aufweisen und weder der Seitenbetreiber noch ich persönlich können hierfür haftbar gemacht werden. Das gleiche gilt für Empfehlungen aller Art.

                            1 Antwort Letzte Antwort
                            0
                            Antworten
                            • In einem neuen Thema antworten
                            Anmelden zum Antworten
                            • Älteste zuerst
                            • Neuste zuerst
                            • Meiste Stimmen


                            Support us

                            ioBroker
                            Community Adapters
                            Donate

                            342

                            Online

                            32.4k

                            Benutzer

                            81.4k

                            Themen

                            1.3m

                            Beiträge
                            Community
                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                            ioBroker Community 2014-2025
                            logo
                            • Anmelden

                            • Du hast noch kein Konto? Registrieren

                            • Anmelden oder registrieren, um zu suchen
                            • Erster Beitrag
                              Letzter Beitrag
                            0
                            • Aktuell
                            • Tags
                            • Ungelesen 0
                            • Kategorien
                            • Unreplied
                            • Beliebt
                            • GitHub
                            • Docu
                            • Hilfe