Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Praktische Anwendungen (Showcase)
    4. View Adapter Status

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    View Adapter Status

    This topic has been deleted. Only users with topic management privileges can see it.
    • Scrounger
      Scrounger Developer @Negalein last edited by

      @Negalein
      Ja korrekt.

      Negalein 1 Reply Last reply Reply Quote 0
      • Negalein
        Negalein Global Moderator @Scrounger last edited by

        @Scrounger sagte in View Adapter Status:

        Ja korrekt.

        Deshalb bitte im Script belassen 🙂

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

          Das neue skript läuft bei mir auch super und ist optisch nochmal besser 😊 👍

          sigi234 1 Reply Last reply Reply Quote 0
          • sigi234
            sigi234 Forum Testing Most Active @saeft_2003 last edited by

            @saeft_2003 sagte in View Adapter Status:

            Das neue skript läuft bei mir auch super und ist optisch nochmal besser 😊 👍

            Ja, sehr gut geworden.

            Screenshot (1803).png

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

              ada.jpg

              Wie schon mal erwähnt wäre eine Sortierung nach läuft und gestoppt nicht schlecht.

              sigi234 Scrounger 2 Replies Last reply Reply Quote 0
              • sigi234
                sigi234 Forum Testing Most Active @saeft_2003 last edited by sigi234

                @saeft_2003 sagte in View Adapter Status:

                Wie schon mal erwähnt wäre eine Sortierung nach läuft und gestoppt nicht schlecht.

                Jupp, könnte man ja nach Farbe sortieren?

                Überlege mir gerade wie man auch nach Ramverbrauch oder CPU sortieren könnte?

                1 Reply Last reply Reply Quote 0
                • Scrounger
                  Scrounger Developer @saeft_2003 last edited by

                  @saeft_2003 sagte in View Adapter Status:

                  Wie schon mal erwähnt wäre eine Sortierung nach läuft und gestoppt nicht schlecht.

                  @sigi234 sagte in View Adapter Status:

                  Jupp, könnte man ja nach Farbe sortieren?

                  Überlege mir gerade wie man auch nach Ramverbrauch oder CPU sortieren könnte?

                  Kann man z.B. mit dem Select Widget realisieren. Dazu muss ein weiterer Datenpunkt angelegt werden, ein listener für diesen Datenpunkt im Skript erzeugt werden und je nachdem welchen state der Datenpunkt hat, muss eine entsprechende Sortierung angestoßen werden (siehe Zeile 156).

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    saeft_2003 Most Active @Scrounger last edited by

                    @Scrounger

                    ok danke für die Info.

                    @sigi234

                    Bekommst du das hin? Ich habs zwar noch nicht probiert, aber ich habe da doch meine selbstzweifel...

                    sigi234 1 Reply Last reply Reply Quote 0
                    • Stephan Schleich
                      Stephan Schleich last edited by Stephan Schleich

                      Wenn man die View etwas verkleinert aber die Listenelementr pro Zeile gleich lässt kommt bei mir ein Anzeige Fehler (ändert man die Listenelemente (weniger) ist der Fehler weg) - Nur zur Info.

                      a7784782-c094-44bf-a227-ee6737755987-image.png

                      1 Reply Last reply Reply Quote 0
                      • sigi234
                        sigi234 Forum Testing Most Active @saeft_2003 last edited by

                        @saeft_2003 sagte in View Adapter Status:

                        Bekommst du das hin? Ich habs zwar noch nicht probiert, aber ich habe da doch meine selbstzweifel...

                        Nö, das würde ich eher @Scrounger überlassen. 😀

                        1 Reply Last reply Reply Quote 0
                        • K
                          Kuddel last edited by

                          Wo genau finde ich die aktuelle Version vom Skript ?

                          sigi234 1 Reply Last reply Reply Quote 0
                          • sigi234
                            sigi234 Forum Testing Most Active @Kuddel last edited by sigi234

                            @Kuddel sagte in View Adapter Status:

                            Wo genau finde ich die aktuelle Version vom Skript ?

                            post 383428
                            https://forum.iobroker.net/topic/26533/view-adapter-status/109

                            1 Reply Last reply Reply Quote 0
                            • Scrounger
                              Scrounger Developer last edited by Scrounger

                              Sodele nochmal eine neue Version des Skriptes

                              Voraussetzung Material Design Widgets v0.2.62 (demnächst im latest) !!!

                              • mehr Farbeinstellung
                              • Sortier Funktion
                              • Filter Funktion - wäre sicher als nächster Wunsch gekommen, deshalb hab ich es schon mal eingebaut 😉
                                (Benötigt ihr weitere schaut ins skript und passt es auf eure Bedürfnisse an)
                              • Adapter Modus wird angezeigt
                              • Fehler behoben

                              AdapterStatus.gif

                              Ist auch im Online Beispiel enthalten

                              View:

                              {
                                "settings": {
                                  "style": {
                                    "background_class": ""
                                  },
                                  "theme": "redmond",
                                  "sizex": "",
                                  "sizey": "",
                                  "gridSize": "",
                                  "snapType": null
                                },
                                "widgets": {
                                  "e00001": {
                                    "tpl": "tplVis-materialdesign-Icon-List",
                                    "data": {
                                      "g_fixed": false,
                                      "g_visibility": false,
                                      "g_css_font_text": false,
                                      "g_css_background": false,
                                      "g_css_shadow_padding": false,
                                      "g_css_border": false,
                                      "g_gestures": false,
                                      "g_signals": false,
                                      "g_last_change": false,
                                      "visibility-cond": "==",
                                      "visibility-val": 1,
                                      "visibility-groups-action": "hide",
                                      "wrapItems": true,
                                      "listItemDataMethod": "jsonStringObject",
                                      "countListItems": "1",
                                      "vibrateOnMobilDevices": "50",
                                      "listLayout": "card",
                                      "itemLayout": "horizontal",
                                      "listType0": "text",
                                      "showValueLabel0": "true",
                                      "listType1": "text",
                                      "showValueLabel1": "true",
                                      "signals-cond-0": "==",
                                      "signals-val-0": true,
                                      "signals-icon-0": "/vis/signals/lowbattery.png",
                                      "signals-icon-size-0": 0,
                                      "signals-blink-0": false,
                                      "signals-horz-0": 0,
                                      "signals-vert-0": 0,
                                      "signals-hide-edit-0": false,
                                      "signals-cond-1": "==",
                                      "signals-val-1": true,
                                      "signals-icon-1": "/vis/signals/lowbattery.png",
                                      "signals-icon-size-1": 0,
                                      "signals-blink-1": false,
                                      "signals-horz-1": 0,
                                      "signals-vert-1": 0,
                                      "signals-hide-edit-1": false,
                                      "signals-cond-2": "==",
                                      "signals-val-2": true,
                                      "signals-icon-2": "/vis/signals/lowbattery.png",
                                      "signals-icon-size-2": 0,
                                      "signals-blink-2": false,
                                      "signals-horz-2": 0,
                                      "signals-vert-2": 0,
                                      "signals-hide-edit-2": false,
                                      "lc-type": "last-change",
                                      "lc-is-interval": true,
                                      "lc-is-moment": false,
                                      "lc-format": "",
                                      "lc-position-vert": "top",
                                      "lc-position-horz": "right",
                                      "lc-offset-vert": 0,
                                      "lc-offset-horz": 0,
                                      "lc-font-size": "12px",
                                      "lc-font-family": "",
                                      "lc-font-style": "",
                                      "lc-bkg-color": "",
                                      "lc-color": "",
                                      "lc-border-width": "0",
                                      "lc-border-style": "",
                                      "lc-border-color": "",
                                      "lc-border-radius": 10,
                                      "lc-zindex": 0,
                                      "json_string_oid": "0_userdata.0.vis.AdapterStatus.jsonList",
                                      "maxItemsperRow": "6",
                                      "iconItemMinWidth": "300",
                                      "iconHeight": "60",
                                      "buttonHeight": "100",
                                      "labelFontSize": "22",
                                      "subLabelFontSize": "14",
                                      "subLabelFontColor": "#000000",
                                      "labelFontFamily": "RobotoCondensed-Regular",
                                      "subLabelFontFamily": "RobotoCondensed-Light",
                                      "horizontalIconContainerWidth": "120"
                                    },
                                    "style": {
                                      "left": "0px",
                                      "top": "50px",
                                      "width": "100%",
                                      "height": "calc(100% - 50px)",
                                      "overflow-x": "",
                                      "overflow-y": "auto",
                                      "z-index": "1"
                                    },
                                    "widgetSet": "materialdesign"
                                  },
                                  "e00002": {
                                    "tpl": "tplHtml",
                                    "data": {
                                      "g_fixed": false,
                                      "g_visibility": false,
                                      "g_css_font_text": false,
                                      "g_css_background": true,
                                      "g_css_shadow_padding": false,
                                      "g_css_border": false,
                                      "g_gestures": false,
                                      "g_signals": false,
                                      "g_last_change": false,
                                      "visibility-cond": "==",
                                      "visibility-val": 1,
                                      "visibility-groups-action": "hide",
                                      "refreshInterval": "0",
                                      "signals-cond-0": "==",
                                      "signals-val-0": true,
                                      "signals-icon-0": "/vis/signals/lowbattery.png",
                                      "signals-icon-size-0": 0,
                                      "signals-blink-0": false,
                                      "signals-horz-0": 0,
                                      "signals-vert-0": 0,
                                      "signals-hide-edit-0": false,
                                      "signals-cond-1": "==",
                                      "signals-val-1": true,
                                      "signals-icon-1": "/vis/signals/lowbattery.png",
                                      "signals-icon-size-1": 0,
                                      "signals-blink-1": false,
                                      "signals-horz-1": 0,
                                      "signals-vert-1": 0,
                                      "signals-hide-edit-1": false,
                                      "signals-cond-2": "==",
                                      "signals-val-2": true,
                                      "signals-icon-2": "/vis/signals/lowbattery.png",
                                      "signals-icon-size-2": 0,
                                      "signals-blink-2": false,
                                      "signals-horz-2": 0,
                                      "signals-vert-2": 0,
                                      "signals-hide-edit-2": false,
                                      "lc-type": "last-change",
                                      "lc-is-interval": true,
                                      "lc-is-moment": false,
                                      "lc-format": "",
                                      "lc-position-vert": "top",
                                      "lc-position-horz": "right",
                                      "lc-offset-vert": 0,
                                      "lc-offset-horz": 0,
                                      "lc-font-size": "12px",
                                      "lc-font-family": "",
                                      "lc-font-style": "",
                                      "lc-bkg-color": "",
                                      "lc-color": "",
                                      "lc-border-width": "0",
                                      "lc-border-style": "",
                                      "lc-border-color": "",
                                      "lc-border-radius": 10,
                                      "lc-zindex": 0
                                    },
                                    "style": {
                                      "left": "0",
                                      "top": "0",
                                      "width": "100%",
                                      "height": "50px",
                                      "background-color": "#44739e"
                                    },
                                    "widgetSet": "basic"
                                  },
                                  "e00003": {
                                    "tpl": "tplVis-materialdesign-Select",
                                    "data": {
                                      "oid": "0_userdata.0.vis.AdapterStatus.sortMode",
                                      "g_fixed": false,
                                      "g_visibility": false,
                                      "g_css_font_text": false,
                                      "g_css_background": false,
                                      "g_css_shadow_padding": false,
                                      "g_css_border": false,
                                      "g_gestures": false,
                                      "g_signals": false,
                                      "g_last_change": false,
                                      "visibility-cond": "==",
                                      "visibility-val": 1,
                                      "visibility-groups-action": "hide",
                                      "inputType": "text",
                                      "inputLayout": "regular",
                                      "showInputMessageAlways": "true",
                                      "showInputCounter": false,
                                      "clearIconShow": false,
                                      "listDataMethod": "jsonStringObject",
                                      "countSelectItems": "1",
                                      "listPosition": "bottom",
                                      "showSelectedIcon": "prepend-inner",
                                      "showValue": false,
                                      "signals-cond-0": "==",
                                      "signals-val-0": true,
                                      "signals-icon-0": "/vis/signals/lowbattery.png",
                                      "signals-icon-size-0": 0,
                                      "signals-blink-0": false,
                                      "signals-horz-0": 0,
                                      "signals-vert-0": 0,
                                      "signals-hide-edit-0": false,
                                      "signals-cond-1": "==",
                                      "signals-val-1": true,
                                      "signals-icon-1": "/vis/signals/lowbattery.png",
                                      "signals-icon-size-1": 0,
                                      "signals-blink-1": false,
                                      "signals-horz-1": 0,
                                      "signals-vert-1": 0,
                                      "signals-hide-edit-1": false,
                                      "signals-cond-2": "==",
                                      "signals-val-2": true,
                                      "signals-icon-2": "/vis/signals/lowbattery.png",
                                      "signals-icon-size-2": 0,
                                      "signals-blink-2": false,
                                      "signals-horz-2": 0,
                                      "signals-vert-2": 0,
                                      "signals-hide-edit-2": false,
                                      "lc-type": "last-change",
                                      "lc-is-interval": true,
                                      "lc-is-moment": false,
                                      "lc-format": "",
                                      "lc-position-vert": "top",
                                      "lc-position-horz": "right",
                                      "lc-offset-vert": 0,
                                      "lc-offset-horz": 0,
                                      "lc-font-size": "12px",
                                      "lc-font-family": "",
                                      "lc-font-style": "",
                                      "lc-bkg-color": "",
                                      "lc-color": "",
                                      "lc-border-width": "0",
                                      "lc-border-style": "",
                                      "lc-border-color": "",
                                      "lc-border-radius": 10,
                                      "lc-zindex": 0,
                                      "inputLabelText": "Sortieren nach",
                                      "inputLabelColor": "#ffffff",
                                      "inputLabelFontFamily": "RobotoCondensed-LightItalic",
                                      "collapseIconColor": "#ffffff",
                                      "collapseIconSize": "",
                                      "jsonStringObject": "[\n\t{\n\t\t\"text\": \"Adaptername\",\n\t\t\"value\": \"name\",\n\t\t\"icon\": \"sort-alphabetical\"\n\t},\n\t{\n\t\t\"text\": \"Status\",\n\t\t\"value\": \"status\",\n\t\t\"icon\": \"information-variant\"\n\t},\t\n\t{\n\t\t\"text\": \"Modus\",\n\t\t\"value\": \"mode\",\n\t\t\"icon\": \"view-dashboard\"\n\t},\n\t{\n\t\t\"text\": \"Updates verfügbar\",\n\t\t\"value\": \"hasUpdates\",\n\t\t\"icon\": \"package-down\"\n\t},\n\t{\n\t\t\"text\": \"CPU\",\n\t\t\"value\": \"cpu\",\n\t\t\"icon\": \"cpu-64-bit\"\n\t},\n\t{\n\t\t\"text\": \"RAM total\",\n\t\t\"value\": \"memHeapTotal\",\n\t\t\"icon\": \"memory\"\n\t},\n\t{\n\t\t\"text\": \"RAM verwendet\",\n\t\t\"value\": \"memHeapUsed\",\n\t\t\"icon\": \"memory\"\n\t},\n\t{\n\t\t\"text\": \"RAM reserviert\",\n\t\t\"value\": \"memRss\",\n\t\t\"icon\": \"memory\"\n\t},\n\t{\n\t\t\"text\": \"Betriebszeit\",\n\t\t\"value\": \"uptime\",\n\t\t\"icon\": \"clock-check-outline\"\n\t}\n]",
                                      "listPositionOffset": true,
                                      "inputLayoutBackgroundColor": "transparent",
                                      "inputLabelColorSelected": "#ffffff",
                                      "inputTranslateX": "-15",
                                      "clearIcon": "",
                                      "inputLayoutBorderColorHover": "#ffffff",
                                      "inputLayoutBorderColorSelected": "#ffffff",
                                      "inputLayoutBorderColor": "#a1a1a1",
                                      "listItemFontColor": "",
                                      "inputTextColor": "#ffffff",
                                      "inputTextFontFamily": "RobotoCondensed-LightItalic",
                                      "prepandIcon": "",
                                      "prepandIconColor": "",
                                      "prepandIconSize": "",
                                      "prepandInnerIcon": "",
                                      "prepandInnerIconColor": "#ffffff",
                                      "prepandInnerIconSize": "18",
                                      "collapseIcon": "",
                                      "inputTranslateY": "-12",
                                      "listIconSelectedColor": "#44739e",
                                      "listIconColor": "",
                                      "appendOuterIcon": "",
                                      "appendOuterIconSize": "2",
                                      "listItemFont": "RobotoCondensed-Regular",
                                      "listItemRippleEffectColor": "",
                                      "inputLayoutBackgroundColorSelected": "",
                                      "inputLayoutBackgroundColorHover": ""
                                    },
                                    "style": {
                                      "left": "10px",
                                      "top": "0px",
                                      "z-index": "1",
                                      "width": "calc(50% - 20px)",
                                      "height": "40px"
                                    },
                                    "widgetSet": "materialdesign"
                                  },
                                  "e00004": {
                                    "tpl": "tplVis-materialdesign-Select",
                                    "data": {
                                      "oid": "0_userdata.0.vis.AdapterStatus.filterMode",
                                      "g_fixed": false,
                                      "g_visibility": false,
                                      "g_css_font_text": false,
                                      "g_css_background": false,
                                      "g_css_shadow_padding": false,
                                      "g_css_border": false,
                                      "g_gestures": false,
                                      "g_signals": false,
                                      "g_last_change": false,
                                      "visibility-cond": "==",
                                      "visibility-val": 1,
                                      "visibility-groups-action": "hide",
                                      "inputType": "text",
                                      "inputLayout": "regular",
                                      "showInputMessageAlways": "true",
                                      "showInputCounter": false,
                                      "clearIconShow": true,
                                      "listDataMethod": "jsonStringObject",
                                      "countSelectItems": "1",
                                      "listPosition": "bottom",
                                      "showSelectedIcon": "prepend-inner",
                                      "showValue": false,
                                      "signals-cond-0": "==",
                                      "signals-val-0": true,
                                      "signals-icon-0": "/vis/signals/lowbattery.png",
                                      "signals-icon-size-0": 0,
                                      "signals-blink-0": false,
                                      "signals-horz-0": 0,
                                      "signals-vert-0": 0,
                                      "signals-hide-edit-0": false,
                                      "signals-cond-1": "==",
                                      "signals-val-1": true,
                                      "signals-icon-1": "/vis/signals/lowbattery.png",
                                      "signals-icon-size-1": 0,
                                      "signals-blink-1": false,
                                      "signals-horz-1": 0,
                                      "signals-vert-1": 0,
                                      "signals-hide-edit-1": false,
                                      "signals-cond-2": "==",
                                      "signals-val-2": true,
                                      "signals-icon-2": "/vis/signals/lowbattery.png",
                                      "signals-icon-size-2": 0,
                                      "signals-blink-2": false,
                                      "signals-horz-2": 0,
                                      "signals-vert-2": 0,
                                      "signals-hide-edit-2": false,
                                      "lc-type": "last-change",
                                      "lc-is-interval": true,
                                      "lc-is-moment": false,
                                      "lc-format": "",
                                      "lc-position-vert": "top",
                                      "lc-position-horz": "right",
                                      "lc-offset-vert": 0,
                                      "lc-offset-horz": 0,
                                      "lc-font-size": "12px",
                                      "lc-font-family": "",
                                      "lc-font-style": "",
                                      "lc-bkg-color": "",
                                      "lc-color": "",
                                      "lc-border-width": "0",
                                      "lc-border-style": "",
                                      "lc-border-color": "",
                                      "lc-border-radius": 10,
                                      "lc-zindex": 0,
                                      "inputLabelText": "Filtern nach",
                                      "inputLabelColor": "#ffffff",
                                      "inputLabelFontFamily": "RobotoCondensed-LightItalic",
                                      "collapseIconColor": "#ffffff",
                                      "collapseIconSize": "",
                                      "jsonStringObject": "[\n\t{\n\t\t\"text\": \"nicht verbunden\",\n\t\t\"value\": \"notConnected\",\n\t\t\"icon\": \"network-off\"\n\t},\n\t{\n\t\t\"text\": \"deaktiviert\",\n\t\t\"value\": \"deactivated\",\n\t\t\"icon\": \"checkbox-blank-outline\"\n\t},\t\n\t{\n\t\t\"text\": \"aktiviert\",\n\t\t\"value\": \"activated\",\n\t\t\"icon\": \"checkbox-intermediate\"\n\t},\n\t{\n\t\t\"text\": \"Updates verfügbar\",\n\t\t\"value\": \"hasUpdates\",\n\t\t\"icon\": \"package-down\"\n\t}\n]",
                                      "listPositionOffset": true,
                                      "inputLayoutBackgroundColor": "transparent",
                                      "inputLabelColorSelected": "#ffffff",
                                      "inputTranslateX": "-15",
                                      "clearIcon": "",
                                      "inputLayoutBorderColorHover": "#ffffff",
                                      "inputLayoutBorderColorSelected": "#ffffff",
                                      "inputLayoutBorderColor": "#a1a1a1",
                                      "listItemFontColor": "",
                                      "inputTextColor": "#ffffff",
                                      "inputTextFontFamily": "RobotoCondensed-LightItalic",
                                      "prepandIcon": "",
                                      "prepandIconColor": "",
                                      "prepandIconSize": "",
                                      "prepandInnerIcon": "",
                                      "prepandInnerIconColor": "#ffffff",
                                      "prepandInnerIconSize": "18",
                                      "collapseIcon": "",
                                      "inputTranslateY": "-12",
                                      "listIconSelectedColor": "#44739e",
                                      "listIconColor": "",
                                      "appendOuterIcon": "",
                                      "appendOuterIconSize": "2",
                                      "listItemFont": "RobotoCondensed-Regular",
                                      "listItemRippleEffectColor": "",
                                      "inputLayoutBackgroundColorSelected": "",
                                      "inputLayoutBackgroundColorHover": "",
                                      "clearIconColor": "#ffffff"
                                    },
                                    "style": {
                                      "left": "calc(50% + 10px)",
                                      "top": "0px",
                                      "z-index": "1",
                                      "width": "calc(50% - 20px)",
                                      "height": "40px"
                                    },
                                    "widgetSet": "materialdesign"
                                  }
                                },
                                "name": "AdapterStatus",
                                "filterList": []
                              }
                              

                              Skript

                              // Imports -> müssen im Javascript Adapter unter 'Zusätzliche NPM-Module' eingetragen sein
                              const moment = require("moment");
                              const momentDurationFormatSetup = require("moment-duration-format");
                              
                              
                              // Skript Einstellungen *************************************************************************************************************************************************
                              
                              let dpList = '0_userdata.0.vis.AdapterStatus.jsonList';                     // Datenpunkt für IconList Widget (Typ: Zeichenkette (String))
                              let dpAdapterRestart = '0_userdata.0.vis.AdapterStatus.restartTrigger';     // Datenpunkt für Adapter restart (Typ: Zeichenkette (String))
                              
                              let dpSortMode = '0_userdata.0.vis.AdapterStatus.sortMode';                 // Datenpunkt für Sortieren (Typ: Zeichenkette (String))
                              let dpFilterMode = '0_userdata.0.vis.AdapterStatus.filterMode';             // Datenpunkt für Filter (Typ: Zeichenkette (String))
                              
                              let adminUpdatesList = 'admin.0.info.updatesList';                          // Datenpunkt Admin Adapter für verfübare Updates der Adapter
                              
                              const checkInterval = 30;                                                   // Interval wie oft Status der Adapter aktualisiert werden soll (in Sekunden)
                              
                              let sprache = 'de';                                                         // Sprache für formatierung Dauer 
                              let formatierungDauer = "dd[T] hh[h] mm[m]";                                // Formatierung der Dauer -> siehe momentjs library
                              
                              let neustarten = true;                                                      // true: Adapter wird neugestartet, false: Adapter wird gestoppt oder gestartet
                              
                              let farbeAdapterAktiv = 'green';                                            // Status Bar Farbe wenn Adapter aktiv ist
                              let farbeAdapterNichtAktiv = 'FireBrick';                                   // Status Bar Farbe wenn Adapter nicht aktiv ist oder Fehler vorliegt
                              let farbeAdapterDeaktiviert = 'darkgrey';                                   // Status Bar Farbe wenn Adapter deaktiviert ist
                              let farbeAdapterNichtVerbunden = 'yellow';                                  // Status Bar Farbe wenn Adapter nicht verbunden ist
                              let farbeAdapterZeitgesteuert = 'lightgreen';                               // Status Bar Farbe wenn Adapter zeitgesteuert ist
                              let farbeAdapterErweiterung = '#44739e';                                    // Status Bar Farbe wenn Adapter Erweiterung ist
                              let farbeAdapterSystem = '#44739e';                                         // Status Bar Farbe wenn Adapter mit System gestartet wird
                              
                              let sortResetAfter = 120;                                                   // Sortierung nach X Sekunden auf sortReset zurücksetzen (0=deaktiviert)
                              let sortReset = 'memHeapUsed'                                               // Sortierung auf die zurückgesetzt werden soll
                              
                              let filterResetAfter = 120;                                                 // Filter nach X Sekunden zurücksetzen (0=deaktiviert)
                              
                              // **********************************************************************************************************************************************************************
                              
                              
                              // Fomate für moment Lib
                              moment.locale(sprache);
                              
                              // auf .alive Änderungen hören
                              let aliveSelector = `[id=system.adapter.*.alive]`;
                              let adapterAliveList = $(aliveSelector);
                              if (adapterAliveList.length === 0) {
                                  // Fehlermeldung ausgeben, wenn selector kein result liefert
                                  console.error(`no result for selector '${aliveSelector}'`)
                              } else {
                                  // listener nur für Änderung bei alive
                                  adapterAliveList.on(adapterStatus);
                              }
                              
                              // auf .connection Änderungen hören
                              let connectionSelector = `[id=*.info.connection]`;
                              let adapterConnectionList = $(connectionSelector);
                              if (adapterConnectionList.length === 0) {
                                  // Fehlermeldung ausgeben, wenn selector kein result liefert
                                  console.error(`no result for selector '${connectionSelector}'`)
                              } else {
                                  // listener nur für Änderung bei alive
                                  adapterConnectionList.on(adapterStatus);
                              }
                              
                              // auf .connected Änderungen hören
                              let connectedSelector = `[id=system.adapter.*.connected]`;
                              let adapterConnectedList = $(connectedSelector);
                              if (adapterConnectedList.length === 0) {
                                  // Fehlermeldung ausgeben, wenn selector kein result liefert
                                  console.error(`no result for selector '${connectedSelector}'`)
                              } else {
                                  // listener nur für Änderung bei alive
                                  adapterConnectedList.on(adapterStatus);
                              }
                              
                              // auf Änderungen der Sortieung hören
                              on({ id: dpSortMode, change: 'any' }, adapterStatus);
                              on({ id: dpSortMode, change: 'any' }, resetSort);
                              
                              // auf Änderungen der Filter hören
                              on({ id: dpFilterMode, change: 'any' }, adapterStatus);
                              on({ id: dpFilterMode, change: 'any' }, resetFilter);
                              
                              // Funktion adapterStatus alle x Sekunden ausführen
                              schedule('*/' + checkInterval + ' * * * * *', adapterStatus);
                              
                              function adapterStatus() {
                                  // Funktion um Status der Adapter abzurufen und als JSON String für das Material Design Widget IconList aufbereiten
                                  let adapterList = [];
                                  let updateList = myHelper().getStateValueIfExist(adminUpdatesList);
                              
                                  try {
                                      for (var i = 0; i <= adapterAliveList.length - 1; i++) {
                                          let id = adapterAliveList[i].replace('.alive', '');
                                          let obj = getObject(adapterAliveList[i].replace('.alive', ''));
                              
                                          let nameArray = id.replace('system.adapter.', '').split(".");
                              
                                          let name = nameArray[0];
                                          name = name.charAt(0).toUpperCase() + name.slice(1);
                              
                                          let nameWithInstance = name;
                                          let adapterInstance = nameArray[1];
                                          if (parseInt(adapterInstance) > 0) {
                                              nameWithInstance = name + '.' + adapterInstance;
                                          }
                              
                                          let uptime = (existsState(id + '.uptime')) ? moment.duration(getState(id + '.uptime').val, 'seconds').format(formatierungDauer, 0) : '-';
                                          let image = (myHelper().checkCommonPropertyExist(obj, 'icon')) ? `/${nameArray[0]}.admin/${obj.common.icon}` : 'image-off-outline';
                              
                                          let hasUpdates = updateList && updateList.includes(nameArray[0]);
                                          let newVersion = (hasUpdates) ? '<span class="mdi mdi-update" style="color: #ec0909;"></span>' : '';
                              
                                          let text = `<div style="display: flex; flex-direction: row; line-height: 1.5; padding-right: 8px; align-items: center;">
                                                          <div style="flex: 1">${newVersion} ${nameWithInstance}</div>
                                                          <div style="color: grey; font-size: 12px; font-family: RobotoCondensed-LightItalic;">${myHelper().getCommonPropertyIfExist(obj, 'version', '-', 'v', '')}</div>
                                                      </div>`
                              
                                          let subText = `<div style="display: flex; flex-direction: row; line-height: 1.3; padding-left: 1px; padding-right: 8px; align-items: center;">
                                                              <div style="flex: 1;">CPU</div>
                                                              <div style="color: grey; font-size: 14px; font-family: RobotoCondensed-LightItalic;">${myHelper().getStateValueIfExist(id + '.cpu', '-', '', ' %')}</div>
                                                          </div>
                                                          <div style="display: flex; flex-direction: row; line-height: 1.3; padding-left: 1px; padding-right: 8px; align-items: center;">
                                                              <div style="flex: 1;">RAM total</div>
                                                              <div style="color: grey; font-size: 14px; font-family: RobotoCondensed-LightItalic;">${myHelper().getStateValueIfExist(id + '.memHeapTotal', '-', '', ' MB')}</div>
                                                          </div>
                                                          <div style="display: flex; flex-direction: row; line-height: 1.3; padding-left: 1px; padding-right: 8px; align-items: center;">
                                                              <div style="flex: 1;">RAM verwendet</div>
                                                              <div style="color: grey; font-size: 14px; font-family: RobotoCondensed-LightItalic;">${myHelper().getStateValueIfExist(id + '.memHeapUsed', '-', '', ' MB')}</div>
                                                          </div>
                                                          <div style="display: flex; flex-direction: row; line-height: 1.3; padding-left: 1px; padding-right: 8px; align-items: center;">
                                                              <div style="flex: 1;">RAM reserviert</div>
                                                              <div style="color: grey; font-size: 14px; font-family: RobotoCondensed-LightItalic;">${myHelper().getStateValueIfExist(id + '.memRss', '-', '', ' MB')}</div>
                                                          </div>
                                                          <div style="display: flex; flex-direction: row; line-height: 1.3; padding-left: 1px; padding-right: 8px; align-items: center;">
                                                              <div style="flex: 1;">Betriebszeit</div>
                                                              <div style="color: grey; font-size: 14px; font-family: RobotoCondensed-LightItalic;">${uptime}</div>
                                                          </div>
                                                          <div style="display: flex; flex-direction: row; line-height: 1.3; padding-left: 1px; padding-right: 8px; align-items: center;">
                                                              <div style="flex: 1;">Modus</div>
                                                              <div style="color: grey; font-size: 14px; font-family: RobotoCondensed-LightItalic;">${myHelper().getCommonPropertyIfExist(obj, 'mode', '-')}</div>
                                                          </div>`
                              
                                          let statusBarColor = farbeAdapterNichtAktiv;
                                          let status = 3;
                              
                                          if (myHelper().getStateValueIfExist(adapterAliveList[i]) === 'true') {
                                              statusBarColor = farbeAdapterAktiv;
                                              status = 0;
                              
                                              if (existsState(id.replace('system.adapter.', '') + '.info.connection')) {
                                                  if (!getState(id.replace('system.adapter.', '') + '.info.connection').val) {
                                                      statusBarColor = farbeAdapterNichtVerbunden;
                                                      status = 4;
                                                  }
                                              } else {
                                                  if (myHelper().getStateValueIfExist(adapterAliveList[i].replace('.alive', '.connected')) === 'false') {
                                                      statusBarColor = farbeAdapterNichtVerbunden;
                                                      status = 4;
                                                  }
                                              }
                                          }
                              
                                          if (myHelper().getCommonPropertyIfExist(obj, 'mode') === 'schedule') {
                                              // Adapter ist zeitgesteuert
                                              statusBarColor = farbeAdapterZeitgesteuert;
                                              status = 1;
                                          }
                              
                                          if (myHelper().getCommonPropertyIfExist(obj, 'mode') === 'extension') {
                                              // Adapter ist Extension
                                              statusBarColor = farbeAdapterErweiterung;
                                              status = 1;
                                          }
                              
                                          if (myHelper().getCommonPropertyIfExist(obj, 'mode') === 'once') {
                                              // Adapter wird mit System gestartet
                                              statusBarColor = farbeAdapterSystem;
                                              status = 1;
                                          }
                              
                                          if (myHelper().getCommonPropertyIfExist(obj, 'enabled', false).toString() === 'false') {
                                              // Adapter ist deaktiviert
                                              statusBarColor = farbeAdapterDeaktiviert;
                                              status = 2;
                                          }
                              
                                          adapterList.push({
                                              text: text,
                                              subText: subText,
                                              image: image,
                                              listType: "buttonState",
                                              objectId: dpAdapterRestart,
                                              buttonStateValue: id,
                                              statusBarColor: statusBarColor,
                                              showValueLabel: false,
                                              name: name,
                                              mode: myHelper().getCommonPropertyIfExist(obj, 'mode'),
                                              hasUpdates: hasUpdates,
                                              cpu: parseFloat(myHelper().getStateValueIfExist(id + '.cpu', '0')),
                                              memHeapTotal: parseFloat(myHelper().getStateValueIfExist(id + '.memHeapTotal', '0')),
                                              memHeapUsed: parseFloat(myHelper().getStateValueIfExist(id + '.memHeapUsed', '0')),
                                              memRss: parseFloat(myHelper().getStateValueIfExist(id + '.memRss', '0')),
                                              uptime: parseFloat(myHelper().getStateValueIfExist(id + '.uptime', 0)),
                                              status: status
                                          })
                                      }
                              
                                  } catch (err) {
                                      console.error(`[adapterStatus] error: ${err.message}, stack: ${err.stack}`);
                                  }
                              
                                  let sortMode = myHelper().getStateValueIfExist(dpSortMode, 'name');
                              
                                  if (sortMode === 'name' || sortMode === 'mode') {
                                      adapterList.sort(function (a, b) {
                                          return a[sortMode] == b[sortMode] ? 0 : +(a[sortMode] > b[sortMode]) || -1;
                                      });
                                  } else if (sortMode === 'hasUpdates' || sortMode === 'cpu' || sortMode === 'memHeapTotal' || sortMode === 'memHeapUsed' || sortMode === 'memRss' || sortMode === 'uptime' || sortMode === 'status') {
                                      adapterList.sort(function (a, b) {
                                          return a[sortMode] == b[sortMode] ? 0 : +(a[sortMode] < b[sortMode]) || -1;
                                      });
                                  } else {
                                      // default: nach name sortieren
                                      sortMode = 'name'
                                      adapterList.sort(function (a, b) {
                                          return a[sortMode] == b[sortMode] ? 0 : +(a[sortMode] > b[sortMode]) || -1;
                                      });
                                  }
                              
                                  // Filter: not connected, updates, deaktiviert, aktiviert
                              
                                  let filterMode = myHelper().getStateValueIfExist(dpFilterMode, null);
                              
                                  if (filterMode && filterMode !== null && filterMode !== '') {
                                      if (filterMode === 'hasUpdates') {
                                          adapterList = adapterList.filter(function (item) {
                                              return item.hasUpdates === true;
                                          });
                                      } else if (filterMode === 'notConnected') {
                                          adapterList = adapterList.filter(function (item) {
                                              return item.status === 4;
                                          });
                                      } else if (filterMode === 'deactivated') {
                                          adapterList = adapterList.filter(function (item) {
                                              return item.status === 2;
                                          });
                                      } else if (filterMode === 'activated') {
                                          adapterList = adapterList.filter(function (item) {
                                              return item.status <= 1;
                                          });
                                      }
                                  }
                              
                                  // adapterList = adapterList.filter(function(item){
                                  //     return item.status === 4;
                                  // })
                              
                                  let result = JSON.stringify(adapterList);
                                  if (getState(dpList) !== result) {
                                      setState(dpList, result, true);
                                  }
                              
                              
                              }
                              
                              // Beim Staren des Skriptes Adapter Status abrufen
                              adapterStatus();
                              
                              // Funktion um Adapter zu starten / neu starten
                              on({ id: dpAdapterRestart }, function (obj) {
                                  var adapter = getObject(obj.state.val.toString());
                              
                                  if (neustarten) {
                                      if (adapter.common && adapter.common.enabled === false) {
                                          // Adapter deaktiviert -> starten
                                          adapter.common.enabled = true;
                                      }
                                  } else {
                                      if (adapter.common && adapter.common.enabled) {
                                          adapter.common.enabled = !adapter.common.enabled;
                                      } else {
                                          adapter.common.enabled = true;
                                      }
                                  }
                              
                                  setObject(obj.state.val, adapter);
                                  console.log(`${obj.state.val.replace('system.adapter.', '')} neugestartet`);
                              });
                              
                              
                              function resetSort() {
                                  let sortMode = myHelper().getStateValueIfExist(dpSortMode, null);
                              
                                  if (sortResetAfter > 0) {
                                      setTimeout(function () {
                                          if (sortMode !== null && sortMode === myHelper().getStateValueIfExist(dpSortMode, null)) {
                                              setState(dpSortMode, sortReset);
                                          }
                                      }, sortResetAfter * 1000);
                                  }
                              }
                              
                              function resetFilter() {
                                  let filterMode = myHelper().getStateValueIfExist(dpFilterMode, null);
                              
                                  if (filterResetAfter > 0) {
                                      setTimeout(function () {
                                          if (filterMode !== null && filterMode === myHelper().getStateValueIfExist(dpFilterMode, null)) {
                                              setState(dpFilterMode, '');
                                          }
                                      }, filterResetAfter * 1000);
                                  }
                              }
                              
                              function myHelper() {
                                  return {
                                      getStateValueIfExist: function (id, nullValue = undefined, prepand = '', append = '') {
                                          if (existsState(id)) {
                                              return prepand + getState(id).val + append;
                                          } else {
                                              return nullValue;
                                          }
                                      },
                                      getCommonPropertyIfExist: function (object, prop, nullValue = undefined, prepand = '', append = '') {
                                          if (myHelper().checkCommonPropertyExist(object, prop)) {
                                              return prepand + object.common[prop] + append;
                                          } else {
                                              return nullValue;
                                          }
                                      },
                                      checkCommonPropertyExist: function (object, prop) {
                                          if (object && object.common && object.common[prop]) {
                                              return true;
                                          } else {
                                              return false;
                                          }
                                      }
                                  }
                              }
                              
                              sigi234 ub.privat S 4 Replies Last reply Reply Quote 6
                              • sigi234
                                sigi234 Forum Testing Most Active @Scrounger last edited by

                                @Scrounger

                                Das ist MEGA Geil!👍

                                C 1 Reply Last reply Reply Quote 0
                                • C
                                  Conquest @sigi234 last edited by

                                  @sigi234 sagte in View Adapter Status:

                                  @Scrounger

                                  Das ist MEGA Geil!👍

                                  Das ist aber weit untertrieben 😂
                                  Ich fang wieder bei null an wenn ich die ganzen neuen Sachen hier sehe.

                                  1 Reply Last reply Reply Quote 0
                                  • sigi234
                                    sigi234 Forum Testing Most Active @Scrounger last edited by

                                    @Scrounger

                                    Screenshot (1837).png

                                    Scrounger 1 Reply Last reply Reply Quote 0
                                    • Scrounger
                                      Scrounger Developer @sigi234 last edited by Scrounger

                                      @sigi234
                                      Du brauchst Version 0.2.62!
                                      Und die scheinst du nicht zu haben, da der JSON-String noch als html input im Editor ist, man aber ab der Version 0.2.62 eine Objekt Id angeben muss.

                                      siehe Online Beispiel

                                      1 Reply Last reply Reply Quote 0
                                      • Negalein
                                        Negalein Global Moderator last edited by

                                        @Scrounger

                                        läuft 🙂
                                        vis (34).png

                                        Glasfaser 1 Reply Last reply Reply Quote 0
                                        • Glasfaser
                                          Glasfaser @Negalein last edited by Glasfaser

                                          @Scrounger

                                          Mein View geht im Popup Widget auf ... kann aber nichts anwählen über die Select , dort geht nichts auf.

                                          1.JPG

                                          Normaler View geht :

                                          2.JPG

                                          Geht das nicht über ein Popup !?

                                          Scrounger 1 Reply Last reply Reply Quote 0
                                          • Scrounger
                                            Scrounger Developer @Glasfaser last edited by

                                            @Glasfaser sagte in View Adapter Status:

                                            Mein View geht im Popup Widget auf ... kann aber nichts anwählen über die Select , dort geht nichts auf.

                                            Was meinst du mit Popup? Welches Widget?
                                            Mach am besten mal nen export.

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            824
                                            Online

                                            31.7k
                                            Users

                                            79.8k
                                            Topics

                                            1.3m
                                            Posts

                                            view view adapter
                                            31
                                            212
                                            25523
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo