Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Praktische Anwendungen (Showcase)
    4. Material Design Widets: Netzwerk Status

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Material Design Widets: Netzwerk Status

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

      @Nickel sagte in Material Design Widets: Netzwerk Status:

      Hier mal zum testen ein etwas um modifiziertes Script ob alles Funktioniert.

      Hallo Nickel!

      Ich bekomm beim starten des Scripts gleich mehrere Fehler.
      Kannst du mal drüberschaun?

      javascript.0	2020-09-02 23:34:08.997	error	(595) at process._tickCallback (internal/process/next_tick.js:68:7)
      javascript.0	2020-09-02 23:34:08.997	error	(595) at promise.then (/opt/iobroker/node_modules/standard-as-callback/built/index.js:19:49)
      javascript.0	2020-09-02 23:34:08.997	error	(595) at tryCatcher (/opt/iobroker/node_modules/standard-as-callback/built/utils.js:11:23)
      javascript.0	2020-09-02 23:34:08.997	error	(595) at client.get (/opt/iobroker/node_modules/iobroker.js-controller/lib/states/statesInRedis.js:616:17)
      javascript.0	2020-09-02 23:34:08.997	error	(595) at adapter.getForeignState (/opt/iobroker/node_modules/iobroker.javascript/main.js:1139:17)
      javascript.0	2020-09-02 23:34:08.997	error	(595) at createProblemObject (/opt/iobroker/node_modules/iobroker.javascript/main.js:1555:17)
      javascript.0	2020-09-02 23:34:08.997	error	(595) at prepareScript (/opt/iobroker/node_modules/iobroker.javascript/main.js:1502:37)
      javascript.0	2020-09-02 23:34:08.997	error	(595) at compile (/opt/iobroker/node_modules/iobroker.javascript/main.js:1279:28)
      javascript.0	2020-09-02 23:34:08.997	error	(595) at Object.createScript (vm.js:277:10)
      javascript.0	2020-09-02 23:34:08.997	error	(595) at new Script (vm.js:83:7)
      javascript.0	2020-09-02 23:34:08.996	error	(595) SyntaxError: Unexpected token {
      javascript.0	2020-09-02 23:34:08.996	error	(595) ^
      javascript.0	2020-09-02 23:34:08.996	error	(595) { ip: "10.0.1.1", alias: "FritzBox", image: "fritzbox_6590_left_de_640x400.png", link: "10.0.1.1"}
      javascript.0	2020-09-02 23:34:08.996	error	at script.js.Fritz.Netzwerkgeraete:36
      javascript.0	2020-09-02 23:34:08.996	error	(595) script.js.Fritz.Netzwerkgeraete compile failed:
      javascript.0	2020-09-02 23:34:08.992	info	(595) Start javascript script.js.Fritz.Netzwerkgeraete
      

      /* FritzBox Presence Check
      * created by Nickel - based on Network Status from Machinima
      * 
      * Vorraussetztungen
      *  - Material Design Widgets
      *  - fb-checkpresence
      * 
      * Versionshistorie:
      * 1.0.0:
      * - Initial Release
      */
      // Skript Einstellungen *************************************************************************************************************************************************
      let dpList = '0_userdata.0.vis.NetzwerkStatus.jsonList';            // Datenpunkt für IconList Widget (Typ: Zeichenkette (String))
       
      let dpSortMode = '0_userdata.0.vis.NetzwerkStatus.sortMode';        // Datenpunkt für Sortieren (Typ: Zeichenkette (String))
      let dpFilterMode = '0_userdata.0.vis.NetzwerkStatus.filterMode';    // Datenpunkt für Filter (Typ: Zeichenkette (String))
       
      const checkInterval = 30;                                           // Interval wie oft Status der Skripte aktualisiert werden soll (in Sekunden)
       
      let imagePath = '/vis.0/main/icons/'                                // Pfad zu den verwendeten Bildern (bitte über den VIS Dateimanager hochladen)
                                                                         // Das Bild (Dateiformat png) in der Mapping-Liste hinterlegen
      let defaultImage1 = 'ip-network-outline';                           // Standardbild, Ethernet (Material Design Icons)
      let defaultImage2 = 'wifi';                                         // Standardbild, Wifi (Material Design Icons)
      let defaultImage3 = 'network-off-outline';                          // Standardbild, Offline (Material Design Icons)
       
      let farbeGeraetOnline = 'green';                                    // Status Bar Farbe wenn Geräte online ist
      let farbeGeraetOffline = 'FireBrick';                               // Status Bar Farbe wenn Geräte offline ist
       
      let sortResetAfter = 120;                                           // Sortierung nach X Sekunden auf sortReset zurücksetzen (0=deaktiviert)
      let sortReset = 'name'                                              // Sortierung auf die zurückgesetzt werden soll
      let filterResetAfter = 120;                                         // Filter nach X Sekunden zurücksetzen (0=deaktiviert)
       
      const deviceNames = 
      [
       { ip: "10.0.1.3",   alias: "Router-Daddy",              image: "router.png",            link: "10.0.1.3"}
       { ip: "10.0.1.1",   alias: "FritzBox",              image: "fritzbox_6590_left_de_640x400.png",            link: "10.0.1.1"}
       { ip: "10.0.1.2",   alias: "Router-Dina",              image: "router.png",            link: "10.0.1.2"}
       { ip: "10.0.1.5",   alias: "Repeater-Gang-EG",              image: "router.png",            link: "10.0.1.5"}
       { ip: "10.0.1.14",   alias: "Drucker-Color-LaserJet-Max",              image: "mfc9332cdw_main.png",            link: "10.0.1.14"}
       { ip: "10.0.1.15",   alias: "Drucker-Nega",              image: "mfc9332cdw_main.png",            link: "10.0.1.15"}
       { ip: "10.0.1.20",   alias: "Synology-Nega-1",              image: "ds718.png",            link: "10.0.1.20"}
       { ip: "10.0.1.21",   alias: "Synology-Nega-2",              image: "ds718.png",            link: "10.0.1.21"}
       { ip: "10.0.1.22",   alias: "Synology-Nega-3-1",              image: "ds718.png",            link: "10.0.1.22"}
       { ip: "10.0.1.23",   alias: "Synology-Nega-3-2",              image: "ds718.png",            link: "10.0.1.23"}
       { ip: "10.0.1.27",   alias: "Laptop-Margret",              image: "laptop.png",            link: "http"}
       { ip: "10.0.1.31",   alias: "PC-Nega",              image: "Medion Akoya E 2070 D.png",            link: "http"}
       { ip: "10.0.1.33",   alias: "Laptop-Max",              image: "laptop.png",            link: "http"}
       { ip: "10.0.1.34",   alias: "Receiver-Max",              image: "vuplus.png",            link: "10.0.1.34"}
       { ip: "10.0.1.35",   alias: "Receiver-Nega",              image: "vuplus.png",            link: "10.0.1.35"}
       { ip: "10.0.1.36",   alias: "TV-Nega",              image: "LG_TV_2.png",            link: "http"}
       { ip: "10.0.1.38",   alias: "Denon-AVR-2113",              image: "yamaha-rx-v481_klein.png",            link: "10.0.1.38"}
       { ip: "10.0.1.51",   alias: "Handy-Nega",              image: "Galaxy_S6.png",            link: "http"}
       { ip: "10.0.1.52",   alias: "Handy-Lisi",              image: "Galaxy_S6.png",            link: "http"}
       { ip: "10.0.1.53",   alias: "Handy-Max",              image: "Galaxy_S6.png",            link: "http"}
       { ip: "10.0.1.54",   alias: "Handy-Margret",              image: "Galaxy_S6.png",            link: "http"}
       { ip: "10.0.1.56",   alias: "Handy-Dina",              image: "Galaxy_S6.png",            link: "http"}
       { ip: "10.0.1.57",   alias: "Handy-Neli",              image: "Galaxy_S6.png",            link: "http"}
       { ip: "10.0.1.59",   alias: "Handy-Buz",              image: "Galaxy_S6.png",            link: "http"}
       { ip: "10.0.1.65",   alias: "Tablet-Nega",              image: "tablet.png",            link: "http"}
       { ip: "10.0.1.69",   alias: "Philips-Hue",              image: "PHILIPS-51180000-Hue--Bridge--3-Watt.png",            link: "http"}
       { ip: "10.0.1.70",   alias: "Harmony-Hub",              image: "logitechharmony.png",            link: "http"}
       { ip: "10.0.1.71",   alias: "TV-Buz",              image: "LG_TV_2.png",            link: "http"}
       { ip: "10.0.1.73",   alias: "Amazon-Echo-Schlafzimmer",              image: "echo_dot3.png",            link: "http"}
       { ip: "10.0.1.76",   alias: "TP-LINK-Smart-Plug-Pelletsofen",              image: "TPLINK_HS110_01.png",            link: "http"}
       { ip: "10.0.1.77",   alias: "TP-LINK-Smart-Plug-Aquarium",              image: "TPLINK_HS110_01.png",            link: "http"}
       { ip: "10.0.1.78",   alias: "TP-LINK-Smart-Plug-Kinderzimmer",              image: "TPLINK_HS110_01.png",            link: "http"}
       { ip: "10.0.1.79",   alias: "TP-LINK-Smart-Plug-PC",              image: "TPLINK_HS110_01.png",            link: "http"}
       { ip: "10.0.1.80",   alias: "TP-LINK-Smart-Plug-Serverschrank",              image: "TPLINK_HS110_01.png",            link: "http"}
       { ip: "10.0.1.81",   alias: "Xiaomi-Mijia-Gateway-1",              image: "Xiaomi-Mijia-Gateway.png",            link: "http"}
       { ip: "10.0.1.83",   alias: "XboxOneS",              image: "XboxOneS.png",            link: "http"}
       { ip: "10.0.1.84",   alias: "Doorbird",              image: "Doorbird.png",            link: "http"}
       { ip: "10.0.1.85",   alias: "Handy-Laura",              image: "Galaxy_S6.png",            link: "http"}
       { ip: "10.0.1.87",   alias: "Amazon-Echo-Küche",              image: "echo_dot3.png",            link: "http"}
       { ip: "10.0.1.88",   alias: "Amazon-Echo-Kinderzimmer",              image: "echo_dot3.png",            link: "http"}
       { ip: "10.0.1.89",   alias: "Amazon-Echo-Wohnzimmer",              image: "echostudio.png",            link: "http"}
       { ip: "10.0.1.90",   alias: "Photovoltaik-Max",              image: "Photovoltaik.png",            link: "10.0.1.90"}
       { ip: "10.0.1.93",   alias: "Volkszähler",              image: "Raspberry_Pi_3_Model_B.png",            link: "10.0.1.93"}
       { ip: "10.0.1.94",   alias: "Photovoltaik-Buz-1-1",              image: "Photovoltaik.png",            link: "10.0.1.94"}
       { ip: "10.0.1.95",   alias: "Photovoltaik-Buz-2-1",              image: "Photovoltaik.png",            link: "10.0.1.95"}
       { ip: "10.0.1.97",   alias: "CCU3",              image: "ccu3-v_1.png",            link: "10.0.1.97"}
       { ip: "10.0.1.100",   alias: "TV-Max",              image: "LG_TV_2.png",            link: "http"}
       { ip: "10.0.1.101",   alias: "LAN-Switch-Buero-Max",              image: "TP-Link TL-SG105E.png",            link: "10.0.1.101"}
       { ip: "10.0.1.112",   alias: "Photovoltaik-Akku-Buz",              image: "fronius-Akku.png",            link: "10.0.1.112"}
       { ip: "10.0.1.150",   alias: "DietPi",              image: "DietPi.png",            link: "10.0.1.150"}
       { ip: "10.0.1.167",   alias: "Froggit-WS4000",              image: "Froggit-WS4000.png",            link: "http"}
       { ip: "10.0.1.200",   alias: "ioBroker-Admin",              image: "ioBroker-Admin.png",            link: "10.0.1.200"}
       { ip: "10.0.1.4",   alias: "Router-Nega-Wohnzimmer",              image: "router.png",            link: "10.0.1.4"}
       { ip: "10.0.1.12",   alias: "Drucker-Dina",              image: "mfc9332cdw_main.png",            link: "10.0.1.12"}
       { ip: "10.0.1.30",   alias: "Laptop-Lisi",              image: "laptop.png",            link: "http"}
       { ip: "10.0.1.37",   alias: "Laptop-Dina",              image: "laptop.png",            link: "http"}
       { ip: "10.0.1.39",   alias: "Receiver-Nega-Schlafzimmer",              image: "vuplus.png",            link: "10.0.1.39"}
       { ip: "10.0.1.55",   alias: "Handy-Emely",              image: "Galaxy_S6.png",            link: "http"}
       { ip: "10.0.1.58",   alias: "Handy-Kloane",              image: "Galaxy_S6.png",            link: "http"}
       { ip: "10.0.1.60",   alias: "Handy-Marcel",              image: "Galaxy_S6.png",            link: "http"}
       { ip: "10.0.1.61",   alias: "Handy-Tamara",              image: "Galaxy_S6.png",            link: "http"}
       { ip: "10.0.1.62",   alias: "Tablet-Buz",              image: "tablet.png",            link: "http"}
       { ip: "10.0.1.63",   alias: "Laptop-Neli",              image: "laptop.png",            link: "http"}
       { ip: "10.0.1.64",   alias: "Powerline-Nega",              image: "Powerline.png",            link: "10.0.1.64"}
       { ip: "10.0.1.67",   alias: "Laptop-Nega",              image: "laptop.png",            link: "http"}
       { ip: "10.0.1.68",   alias: "Tablet-Laura",              image: "tablet.png",            link: "http"}
       { ip: "10.0.1.72",   alias: "LED-Controller-Aquarium",              image: "sunriser8.png",            link: "10.0.1.72"}
       { ip: "10.0.1.82",   alias: "Xiaomi-Mijia-Gateway-2",              image: "Xiaomi-Mijia-Gateway.png",            link: "http"}
       { ip: "10.0.1.86",   alias: "Laptop-Emely",              image: "laptop.png",            link: "http"}
       { ip: "10.0.1.91",   alias: "Photovoltaik-Buz-1",              image: "Photovoltaik.png",            link: "10.0.1.91"}
       { ip: "10.0.1.92",   alias: "Photovoltaik-Buz-2",              image: "Photovoltaik.png",            link: "10.0.1.92"}
       { ip: "10.0.1.98",   alias: "Instar-3011",              image: "Instar-3011.png",            link: "10.0.1.98"}
       { ip: "10.0.1.151",   alias: "PC-Marcel",              image: "Medion Akoya E 2070 D.png",            link: "http"}
       { ip: "10.0.1.152",   alias: "Handy-Ramon",              image: "Galaxy_S6.png",            link: "http"}
       { ip: "10.0.1.156",   alias: "Laptop-Ramon",              image: "laptop.png",            link: "http"}
       { ip: "10.0.1.161",   alias: "Tablet-Lisi",              image: "tablet.png",            link: "http"}
       { ip: "10.0.1.165",   alias: "Handy-Kloane-Arbeit",              image: "Galaxy_S6.png",            link: "http"}
      ];
       
      // **********************************************************************************************************************************************************************
       
      // Selector für LAN & WLAN Devices
      let devices = $(`[id=fb-checkpresence.*.fb-devices.*.active]`);
       
      // Funktion adapterStatus alle x Sekunden ausführen
      schedule('*/' + checkInterval + ' * * * * *', netzwerkStatus);
       
      // auf Änderungen der Sortieung hören
      on({ id: dpSortMode, change: 'any' }, netzwerkStatus);
      on({ id: dpSortMode, change: 'any' }, resetSort);
       
      // // auf Änderungen der Filter hören
      on({ id: dpFilterMode, change: 'any' }, netzwerkStatus);
      on({ id: dpFilterMode, change: 'any' }, resetFilter);
       
      // Hauptfunktion
      function netzwerkStatus() {
         try {
             let deviceList = [];
       
             for (var i = 0; i <= devices.length - 1; i++) {
                 let idDevice = devices[i].replace('.active', '');
                 let isConn = (getStateIfExist(devices[i]) == '1') ? true : false;
                 let ipAddress = getStateIfExist(idDevice + ".ipaddress", '-');
                 let mac = getStateIfExist(idDevice + ".macaddress");
                 let name = idDevice.replace(/fb-checkpresence\.[0-9]\.fb-devices\./i, "");
                 let connection = getStateIfExist(idDevice + '.interfacetype', '-');
                 let speed = getStateIfExist(idDevice + '.speed', '0');
                 speed = (speed == "0") ? '-' : speed + ' MBit/s';
                 let isGuest = getState(idDevice + ".guest").val;
                 let isWired = true;
       
                 let listType = 'text';
                 let image = defaultImage3;
                 let buttonLink = '';
                 let statusBarColor = farbeGeraetOffline;
       
                 if (isConn === true) {
                     statusBarColor = farbeGeraetOnline;
                     image = (connection == "802.11") ? defaultImage2 : defaultImage1
                 }
       
                 if (connection == "802.11") {
                     connection = "Wireless-Lan";
                     isWired = false;
                 }
       
                 let device = deviceNames.find(element => element.ip == ipAddress);
                 if (device) {
                     name = device.alias;
                     if (device.image.search("png") > 0) {
                         image = imagePath + device.image;
                     } 
                     if (device.link) {
                         listType = 'buttonLink';
                         name = `<span style="text-decoration: underline">${name}</span>`
                         buttonLink = (device.link == 'http') ?  'http://${ipAddress}' : device.link
                     }
                 }
       
                 let text = name;
                 if (isGuest === true) {
                     text = '<span class="mdi mdi-account-box" style="color: #ff9800;"> ${name}</span>';
                 }
                 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; width: 1px; text-overflow: ellipsis; overflow: hidden;">IP-Addresse</div>
                                     <div style="color: grey; font-size: 14px; font-family: RobotoCondensed-LightItalic; text-align: right;">${ipAddress}</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; width: 1px; text-overflow: ellipsis; overflow: hidden;">Verbindung</div>
                                     <div style="color: grey; font-size: 14px; font-family: RobotoCondensed-LightItalic; text-align: right;">${connection}</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; width: 1px; text-overflow: ellipsis; overflow: hidden;">Geschwindigkeit</div>
                                     <div style="color: grey; font-size: 14px; font-family: RobotoCondensed-LightItalic; text-align: right;">${speed}</div>
                                 </div>`
                     
                 deviceList.push({
                     text: text,
                     subText: subText,
                     listType: listType,
                     buttonLink: buttonLink,
                     image: image,
                     statusBarColor: statusBarColor,
                     name: name,
                     ipAddress: ipAddress,
                     speed: parseFloat(getStateIfExist(idDevice + '.speed', '0')),
                     status: isConn,
                     isWired: isWired
                 });
             }
       
             let sortMode = existsState(dpSortMode) ? getState(dpSortMode).val : 'ipAddress';
       
             if (sortMode === 'name') {
                 deviceList.sort(function (a, b) {
                     return a[sortMode].toLowerCase() == b[sortMode].toLowerCase() ? 0 : +(a[sortMode].toLowerCase() > b[sortMode].toLowerCase()) || -1;
                 });
             } else if (sortMode === 'ipAddress') {
                 deviceList.sort(function (a, b) {
                     return a[sortMode].split('.')[0] - b[sortMode].split('.')[0] || a[sortMode].split('.')[1] - b[sortMode].split('.')[1] || a[sortMode].split('.')[2] - b[sortMode].split('.')[2] || a[sortMode].split('.')[3] - b[sortMode].split('.')[3]
                 });
             } else if (sortMode === 'status' || sortMode === 'speed') {
                 deviceList.sort(function (a, b) {
                     return a[sortMode] == b[sortMode] ? 0 : +(a[sortMode] < b[sortMode]) || -1;
                 });
             } else {
                 // default: nach name sortieren
                 sortMode = 'name'
                 deviceList.sort(function (a, b) {
                     return a[sortMode].toLowerCase() == b[sortMode].toLowerCase() ? 0 : +(a[sortMode].toLowerCase() > b[sortMode].toLowerCase()) || -1;
                 });
             }
       
             let filterMode = existsState(dpFilterMode) ? getState(dpFilterMode).val : '';
       
             if (filterMode && filterMode !== null && filterMode !== '') {
                 if (filterMode === 'offline') {
                     deviceList = deviceList.filter(function (item) {
                         return item.status === false;
                     });
                 } else if (filterMode === 'online') {
                     deviceList = deviceList.filter(function (item) {
                         return item.status === true;
                     });
                 }
             }
       
             let result = JSON.stringify(deviceList);
             if (existsState(dpList) && getState(dpList).val !== result) {
                 setState(dpList, result, true);
             } else {
                 setState(dpList, result, true);
             }
       
         } catch (err) {
             console.error(`[netzwerkStatus] error: ${err.message}, stack: ${err.stack}`);
         }
       
         // Funktionen
         function getStateIfExist(id, nullValue = '', prepand = '', append = '') {
             if (existsState(id)) {
                 return prepand + getState(id).val + append;
             } else {
                 return nullValue;
             }
         }
      }
       
      // Beim Staren des Skriptes Status abrufen
      netzwerkStatus();
       
       
      function resetSort() {
         let sortMode = existsState(dpSortMode) ? getState(dpSortMode).val : '';
       
         if (sortResetAfter > 0) {
             setTimeout(function () {
                 if (existsState(dpSortMode) && sortMode === getState(dpSortMode).val) {
                     setState(dpSortMode, sortReset);
                 }
             }, sortResetAfter * 1000);
         }
      }
       
      function resetFilter() {
         let filterMode = existsState(dpFilterMode) ? getState(dpFilterMode).val : '';
       
         if (filterResetAfter > 0) {
             setTimeout(function () {
                 if (existsState(dpFilterMode) && filterMode === getState(dpFilterMode).val) {
                     setState(dpFilterMode, '');
                 }
             }, filterResetAfter * 1000);
         }
      }
      


      EDIT: Kommando retour! Was so ein kleines ,ausmachen kann. 🙂

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

        @All

        Irgendwie mag mich das Script von @Nickel nicht so recht.

        Es zeigt mir Geräte an, die nicht mehr existieren.
        In der Fritz sind sie gelöscht, im FB-Checkpresence existieren sie nicht, in den Objekten nicht.
        Aber das Script zeigt sie trotzdem an.

        Hab das Script schon neu angelegt, den JSON Datenpunkt gelöscht, Maschine neu gestartet. Hat nichts geholfen.

        Hat jemand eine Idee?

        Screenshot_2020-09-03 vis.png objects - ioBroker.png FRITZ!Box 7580 (1).png FRITZ!Box 7580 (2).png

        1 Reply Last reply Reply Quote 0
        • W
          Werner303 @Machinima last edited by Negalein

          @Machinima Ich habe Dein Script ausprobiert. Leider erhalte ich folgende Fehlermeldung beim Starten:

          javascript.0	2020-09-08 13:07:49.274	error	at tryCatcher (/opt/iobroker/node_modules/standard-as-callback/built/utils.js:11:23)
          javascript.0	2020-09-08 13:07:49.274	error	at /opt/iobroker/node_modules/iobroker.js-controller/lib/states/statesInRedis.js:608:33
          javascript.0	2020-09-08 13:07:49.274	error	at /opt/iobroker/node_modules/iobroker.javascript/main.js:1137:17
          javascript.0	2020-09-08 13:07:49.274	error	at /opt/iobroker/node_modules/iobroker.javascript/main.js:1556:17
          javascript.0	2020-09-08 13:07:49.274	error	at prepareScript (/opt/iobroker/node_modules/iobroker.javascript/main.js:1501:38)
          javascript.0	2020-09-08 13:07:49.274	error	at execute (/opt/iobroker/node_modules/iobroker.javascript/main.js:1317:27)
          javascript.0	2020-09-08 13:07:49.274	error	at Script.runInNewContext (vm.js:135:17)
          javascript.0	2020-09-08 13:07:49.274	error	at Script.runInContext (vm.js:130:18)
          javascript.0	2020-09-08 13:07:49.274	error	at script.js.common.Abfragen.Netzwerk:227:1
          javascript.0	2020-09-08 13:07:49.274	error	at netzwerkStatus (script.js.common.Abfragen.Netzwerk:89:59)
          javascript.0	2020-09-08 13:07:49.274	error	(30995) script.js.common.Abfragen.Netzwerk: [netzwerkStatus] error: Cannot read property '0' of null, stack: TypeError: Cannot read property '0' of null
          javascript.0	2020-09-08 13:07:49.215	info	(30995) Start javascript script.js.common.Abfragen.Netzwerk
          

          Wo liegt der Fehler? Ich habe keine Änderungen vorgenommen. Ich hatte auch schon eine andere Version probiert. Keine Fehlermeldung: keine IP Werte, die anderen Werte sind aber vorhanden. Was kann ich noch machen?

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

            @Werner303

            Dies in Javascript-Instanz eingetragen !?

            Folgende NPM-Module müsst ihr in eurer Javascript-Instanz hinzufügen: moment, moment-timezone, moment-duration-format
            Außerdem bitte die Einstellung "Erlaube das Kommando setObject" in eurer Javascript-Instanz aktivieren
            
            W 1 Reply Last reply Reply Quote 0
            • W
              Werner303 @Glasfaser last edited by

              @Glasfaser
              Vielen Dank für die Antwort. Aber ich habe es schon länger in der Instanz eingetragen.

              Javascript.jpg

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

                @Werner303

                Siehe mal ganz oben , da hatte @AxelF1977 fast den gleichen Fehler .

                Link Text

                und hier die Antwort dazu
                Link Text

                W 1 Reply Last reply Reply Quote 1
                • W
                  Werner303 @Glasfaser last edited by

                  @Glasfaser Ich kann mich nur bedanken. In solch kurzer Zeit eine Lösung zu vermitteln.
                  Sie war:
                  Zum testen die Zeile mit der IP wo der Fehler war (ca Zeile 85) ändern in:

                  let ipAddress = myHelper().getStateValueIfExist(id + '.lastIP', "0.0.0.0")

                  Nochmals vielen Dank

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

                    @Werner303 sagte in Material Design Widets: Netzwerk Status:

                    Nochmals vielen Dank

                    Kein Problem ... sehr gerne 😉

                    1 Reply Last reply Reply Quote 1
                    • A
                      aldoa1 @Guest last edited by

                      @Nickel

                      könnte man Dein Script in einem eigenen Bereich auslagern?
                      Es sind ja nun 2 Scripte aktiv. Ist etwas verwirrend

                      1 Reply Last reply Reply Quote 0
                      • Almixx
                        Almixx last edited by Almixx

                        Hallo. Bitte jetzt nicht auslachen, bin mit Javascript nicht so vertraut...
                        Meine Frage wäre, wie muss ich das Script einsetzten, dass ich etwas in der View sehe?
                        In der View selber unter Scripte oder im Adminbereich der Vis unter Scripte?

                        Habe soweit meine Vis erstellt, würde aber gerne eine View mit diesem Netzwerkstatus hinzufügen. Hab nur keinen blassen Schimmer wie? Vielleicht könnt ihr mir auch einen Link posten, wo ich das nachlesen könnte.
                        Instanz Javascript mit passenden Einträgen und TR064 Adapter sind installiert.
                        Vielen Dank schonmal vorab...

                        1 Reply Last reply Reply Quote 0
                        • D3ltoroxp
                          D3ltoroxp last edited by D3ltoroxp

                          Hm, komisch. Seit glaube gestern oder heute habe ich hier folgende Errors in der Log..

                          0e9978dd-ba1d-4932-a0a2-b5886cf50939-image.png

                          Habe an dem Script, dem tr 064 Adapter und Co nichts geändert. Die Tage auch kein Update von irgendwas gemacht. Aber auf einmal sehe ich diese Fehler in der Log.
                          Könnt ihr sehen, was hier los ist ?

                          (29672) script.js.VIS.Netzwerkstatus_für_VIS: [netzwerkStatus] error: Cannot read property '0' of null, stack: TypeError: Cannot read property '0' of null
                          
                          V J 2 Replies Last reply Reply Quote 0
                          • V
                            vsa @D3ltoroxp last edited by

                            Hallo Zusammen,
                            ich habe leider die gleichen Fehlermeldungen wie D3ltoroxp. Script frisch installiert, alle Adapter / ioBroker / JS auf dem neusten Stand.
                            Hat jemand schon eine Lösung dafür?
                            VG und schöne Feiertage
                            vsa

                            Knallochse 1 Reply Last reply Reply Quote 0
                            • Knallochse
                              Knallochse @vsa last edited by

                              @vsa Script mal neu starten

                              1 Reply Last reply Reply Quote 0
                              • K
                                KHK @Machinima last edited by

                                @Machinima
                                Bin mal am probieren deines View/Script.

                                Im Script steht" Das Bild (Dateiformat png) in der Mapping-Liste hinterlegen" - Was deutet das, wo ist das zu hinterlegen?

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

                                  @KHK
                                  1 .Hier ist deine Hauptquelle von den Bildern einzutragen :

                                  let imagePath = '/vis.0/myImages/networkDevices/'                 // Pfad zu den verwendeten Bildern (bitte über den VIS Dateimanager hochladen)
                                  
                                  1. hier dein Bild rein... bei : image:"meinBild.png"
                                  const deviceNames = 
                                  [{ ip: "192.168.178.11", alias: "Your Computer", 	  image: "desktop-classic" },
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • J
                                    jwerlsdf @D3ltoroxp last edited by

                                    @D3ltoroxp
                                    Diesen Fehler hatte ich auch. Abhilfe schafft den tr.064 Adapter neuzustarten, danach die Tabelle aus dem Datenpunkt (Netzwerkstatus Skript) zu löschen und Netzwerkstatus neuzustarten.

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

                                      Servus,

                                      kann mir Bitte jemand weiterhelfen, da ich alle meine Skripte angezeigt bekomme und nicht meine Netzwerkgeräte ;(

                                      Bildschirmfoto 2021-01-20 um 13.34.07.png

                                      Mit noobischen Grüßen & Danke

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

                                        @rehmosch sagte in Material Design Widets: Netzwerk Status:

                                        da ich alle meine Skripte angezeigt bekomme

                                        Du hast ein falsches Script hinterlegt bzw. angewählt zum anzeigen , dieses hier im Thread würde niemals JS abfragen.

                                        Schau mal hier :

                                        https://forum.iobroker.net/topic/30662/material-design-widgets-skript-status

                                        R 1 Reply Last reply Reply Quote 1
                                        • R
                                          rehmosch @Glasfaser last edited by

                                          @glasfaser Danke für die schnelle Antwort 😉 Da bin ich wohl beim Kopieren ein bisschen im Tab verrutscht 😉

                                          jetzt erhalte ich diesen error:

                                          14:54:56.905	info	javascript.0 (30195) Start javascript script.js.netzwerk
                                          14:54:56.924	error	javascript.0 (30195) script.js.netzwerk: no result for selector '[id=tr-064.*.devices.*.active]'
                                          14:54:56.927	info	javascript.0 (30195) script.js.netzwerk: registered 4 subscriptions and 1 schedule
                                          

                                          Wo verlinke ich denn meinen id-tr064?

                                          Danke

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

                                            @rehmosch

                                            Da brauchst du nicht verlinken , die Daten werden durch das Script geholt.

                                            Du mußt nur schauen ob die Datenpunkte stimmen vom tr064 Adapter , kenne deine Version nicht .

                                            Das Script holt sich hier alles :

                                            // auf Änderungen aktiver Skripts hören
                                            
                                            let activeSelector = `[id=tr-064.*.devices.*.active]`;
                                            

                                            oder ist es bei dir so ...

                                            https://forum.iobroker.net/topic/30812/material-design-widets-netzwerk-status/21

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            488
                                            Online

                                            31.7k
                                            Users

                                            79.6k
                                            Topics

                                            1.3m
                                            Posts

                                            50
                                            280
                                            36135
                                            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