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

  • Standard: (Kein Skin)
  • Kein Skin
Einklappen
ioBroker Logo

Community Forum

  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. JS / connection-status der linkeddevices anzeigen

NEWS

  • UPDATE 31.10.: Amazon Alexa - ioBroker Skill lĂ€uft aus ?
    apollon77A
    apollon77
    48
    3
    8.2k

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

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

JS / connection-status der linkeddevices anzeigen

Geplant Angeheftet Gesperrt Verschoben Skripten / Logik
3 BeitrÀge 2 Kommentatoren 193 Aufrufe 2 Watching
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • R Offline
    R Offline
    Roland Ambrosch
    schrieb am zuletzt editiert von Roland Ambrosch
    #1

    Hi,

    nachdem ich immer nur mitlese, mal was sinnvoll zu Teilendes:
    Falls jemand auch linkeddevices verwendet und gerne in VIS eine Übersicht hĂ€tte ob irgendwelche verlinkten GerĂ€te aus zwave2, sonoff oder shelly Probleme machen, kann gerne mein Script verwenden.

    Der Output sieht dann so aus:
    a9f300f0-3123-4e3f-82ad-1b9f08c08de9-image.png

    var StatusHTMLzwave = 'javascript.0.zwave2NodeStatus';
    var StatusHTMLshelly = 'javascript.0.shellyNodeStatus';
    var StatusHTMLsonoff = 'javascript.0.sonoffNodeStatus';
    var StatusHTMLlinkeddevices = 'javascript.0.linkeddeviceNodeStatus';
    
    createState(StatusHTMLzwave, false, {
        read: true,
        write: true,
        type: 'string',
        name: 'Status aller IoT Sensoren/Aktoren als HTML',
        desc: 'Status aller IoT Sensoren/Aktoren als HTML'
    });
    
    
    createState(StatusHTMLshelly, false, {
        read: true,
        write: true,
        type: 'string',
        name: 'Status aller IoT Sensoren/Aktoren als HTML',
        desc: 'Status aller IoT Sensoren/Aktoren als HTML'
    });
    
    
    createState(StatusHTMLsonoff, false, {
        read: true,
        write: true,
        type: 'string',
        name: 'Status aller IoT Sensoren/Aktoren als HTML',
        desc: 'Status aller IoT Sensoren/Aktoren als HTML'
    });
    createState(StatusHTMLlinkeddevices, false, {
        read: true,
        write: true,
        type: 'string',
        name: 'Status aller IoT Sensoren/Aktoren als HTML',
        desc: 'Status aller IoT Sensoren/Aktoren als HTML'
    });
    function checkIoT(){
        /////////////////////ZWAVE
        // Get a list of all nodes under the Z-Wave2 root
        var nodes = $('zwave2.0.*.ready');
    
        // Initialize the HTML string
        let itemListHTML = '<h1>Z-Wave2 Node Status</h1>';
    
        nodes.each(function (id, i) {
            const nodeReady = getState(id);
            // Determine the circle color based on the "ready" state
            const circleClass = nodeReady.val ? 'green' : 'red';
    
            // Add the item to the HTML list
            itemListHTML += `
                <div class="item">
                    <div class="circle ${circleClass}"></div>
                    <span>${id}: ${nodeReady.val ? 'Ready' : 'Not Ready'}</span>
                </div>
            `;
        });
    
        // Create or update an HTML state in ioBroker to display the list
        setState(StatusHTMLzwave, itemListHTML, true);
        /////////////////////SONOFF
        // Get a list of all nodes under the Z-Wave2 root
        nodes = $('sonoff.0.*.alive');
    
        // Initialize the HTML string
        itemListHTML = '<h1>SONOFF Node Status</h1>';
    
        nodes.each(function (id, i) {
            const nodeReady = getState(id);
            // Determine the circle color based on the "ready" state
            const circleClass = nodeReady.val ? 'green' : 'red';
    
            // Add the item to the HTML list
            itemListHTML += `
                <div class="item">
                    <div class="circle ${circleClass}"></div>
                    <span>${id}: ${nodeReady.val ? 'Ready' : 'Not Ready'}</span>
                </div>
            `;
        });
    
        // Create or update an HTML state in ioBroker to display the list
        setState(StatusHTMLsonoff, itemListHTML, true);
        /////////////////////SHELLY
        // Get a list of all nodes under the Z-Wave2 root
        nodes = $('shelly.0.*.online');
    
        // Initialize the HTML string
        itemListHTML = '<h1>SHELLY Node Status</h1>';
    
        nodes.each(function (id, i) {
            const nodeReady = getState(id);
            // Determine the circle color based on the "ready" state
            const circleClass = nodeReady.val ? 'green' : 'red';
            // Add the item to the HTML list
            itemListHTML += `
                <div class="item">
                    <div class="circle ${circleClass}"></div>
                    <span>${id}: ${nodeReady.val ? 'Ready' : 'Not Ready'}</span>
                </div>
            `;
        });
        // Create or update an HTML state in ioBroker to display the list
        setState(StatusHTMLshelly, itemListHTML, true);
        /////////////////////LINKED DEVICES
        nodes = $('linkeddevices.0.*');
        // Initialize the HTML string
        itemListHTML = '';
    
        nodes.each(function (id, i) {
            var dPoint = getObject(id,"true");
            if (dPoint && dPoint.common) {
                var settings = dPoint.common.custom;
                //check if it is a linkeddevice
                var dpCustom = false;
                if(settings)
                    if(settings['linkeddevices.0'])
                        if(settings['linkeddevices.0'].enabled)
                            dpCustom = settings['linkeddevices.0'].enabled;
               
                if(dpCustom) {
                    //explode the parentid
                    var parentid = settings['linkeddevices.0'].parentId ? settings['linkeddevices.0'].parentId : "";
                    if(parentid == "")
                        return;
                    const parts = parentid.split('.');
                    if (parts.length >= 3) {
                        //extract the parentState
                        const parentState = parts.slice(0, 3).join('.');
                        if(parts[0] == 'zwave2')
                        {
                            const nodeReady = getState(parentState + '.ready');
                            // Determine the circle color based on the "ready" state
                            const circleClass = nodeReady.val ? 'green' : 'red';
                            // Add the item to the HTML list
                            itemListHTML += `
                                <div class="item">
                                    <div class="circle ${circleClass}"></div>
                                    <span>${id}: ${nodeReady.val ? 'Ready' : 'Not Ready'}</span>
                                </div>
                            `;
                        }
                    } 
                }
            }
        });
        // Create or update an HTML state in ioBroker to display the list
        setState(StatusHTMLlinkeddevices, itemListHTML, true);
        
    }
    checkIoT();
    schedule('* * * * *',checkIoT);
    
    
    
    
    
    
    arteckA 1 Antwort Letzte Antwort
    0
    • R Roland Ambrosch

      Hi,

      nachdem ich immer nur mitlese, mal was sinnvoll zu Teilendes:
      Falls jemand auch linkeddevices verwendet und gerne in VIS eine Übersicht hĂ€tte ob irgendwelche verlinkten GerĂ€te aus zwave2, sonoff oder shelly Probleme machen, kann gerne mein Script verwenden.

      Der Output sieht dann so aus:
      a9f300f0-3123-4e3f-82ad-1b9f08c08de9-image.png

      var StatusHTMLzwave = 'javascript.0.zwave2NodeStatus';
      var StatusHTMLshelly = 'javascript.0.shellyNodeStatus';
      var StatusHTMLsonoff = 'javascript.0.sonoffNodeStatus';
      var StatusHTMLlinkeddevices = 'javascript.0.linkeddeviceNodeStatus';
      
      createState(StatusHTMLzwave, false, {
          read: true,
          write: true,
          type: 'string',
          name: 'Status aller IoT Sensoren/Aktoren als HTML',
          desc: 'Status aller IoT Sensoren/Aktoren als HTML'
      });
      
      
      createState(StatusHTMLshelly, false, {
          read: true,
          write: true,
          type: 'string',
          name: 'Status aller IoT Sensoren/Aktoren als HTML',
          desc: 'Status aller IoT Sensoren/Aktoren als HTML'
      });
      
      
      createState(StatusHTMLsonoff, false, {
          read: true,
          write: true,
          type: 'string',
          name: 'Status aller IoT Sensoren/Aktoren als HTML',
          desc: 'Status aller IoT Sensoren/Aktoren als HTML'
      });
      createState(StatusHTMLlinkeddevices, false, {
          read: true,
          write: true,
          type: 'string',
          name: 'Status aller IoT Sensoren/Aktoren als HTML',
          desc: 'Status aller IoT Sensoren/Aktoren als HTML'
      });
      function checkIoT(){
          /////////////////////ZWAVE
          // Get a list of all nodes under the Z-Wave2 root
          var nodes = $('zwave2.0.*.ready');
      
          // Initialize the HTML string
          let itemListHTML = '<h1>Z-Wave2 Node Status</h1>';
      
          nodes.each(function (id, i) {
              const nodeReady = getState(id);
              // Determine the circle color based on the "ready" state
              const circleClass = nodeReady.val ? 'green' : 'red';
      
              // Add the item to the HTML list
              itemListHTML += `
                  <div class="item">
                      <div class="circle ${circleClass}"></div>
                      <span>${id}: ${nodeReady.val ? 'Ready' : 'Not Ready'}</span>
                  </div>
              `;
          });
      
          // Create or update an HTML state in ioBroker to display the list
          setState(StatusHTMLzwave, itemListHTML, true);
          /////////////////////SONOFF
          // Get a list of all nodes under the Z-Wave2 root
          nodes = $('sonoff.0.*.alive');
      
          // Initialize the HTML string
          itemListHTML = '<h1>SONOFF Node Status</h1>';
      
          nodes.each(function (id, i) {
              const nodeReady = getState(id);
              // Determine the circle color based on the "ready" state
              const circleClass = nodeReady.val ? 'green' : 'red';
      
              // Add the item to the HTML list
              itemListHTML += `
                  <div class="item">
                      <div class="circle ${circleClass}"></div>
                      <span>${id}: ${nodeReady.val ? 'Ready' : 'Not Ready'}</span>
                  </div>
              `;
          });
      
          // Create or update an HTML state in ioBroker to display the list
          setState(StatusHTMLsonoff, itemListHTML, true);
          /////////////////////SHELLY
          // Get a list of all nodes under the Z-Wave2 root
          nodes = $('shelly.0.*.online');
      
          // Initialize the HTML string
          itemListHTML = '<h1>SHELLY Node Status</h1>';
      
          nodes.each(function (id, i) {
              const nodeReady = getState(id);
              // Determine the circle color based on the "ready" state
              const circleClass = nodeReady.val ? 'green' : 'red';
              // Add the item to the HTML list
              itemListHTML += `
                  <div class="item">
                      <div class="circle ${circleClass}"></div>
                      <span>${id}: ${nodeReady.val ? 'Ready' : 'Not Ready'}</span>
                  </div>
              `;
          });
          // Create or update an HTML state in ioBroker to display the list
          setState(StatusHTMLshelly, itemListHTML, true);
          /////////////////////LINKED DEVICES
          nodes = $('linkeddevices.0.*');
          // Initialize the HTML string
          itemListHTML = '';
      
          nodes.each(function (id, i) {
              var dPoint = getObject(id,"true");
              if (dPoint && dPoint.common) {
                  var settings = dPoint.common.custom;
                  //check if it is a linkeddevice
                  var dpCustom = false;
                  if(settings)
                      if(settings['linkeddevices.0'])
                          if(settings['linkeddevices.0'].enabled)
                              dpCustom = settings['linkeddevices.0'].enabled;
                 
                  if(dpCustom) {
                      //explode the parentid
                      var parentid = settings['linkeddevices.0'].parentId ? settings['linkeddevices.0'].parentId : "";
                      if(parentid == "")
                          return;
                      const parts = parentid.split('.');
                      if (parts.length >= 3) {
                          //extract the parentState
                          const parentState = parts.slice(0, 3).join('.');
                          if(parts[0] == 'zwave2')
                          {
                              const nodeReady = getState(parentState + '.ready');
                              // Determine the circle color based on the "ready" state
                              const circleClass = nodeReady.val ? 'green' : 'red';
                              // Add the item to the HTML list
                              itemListHTML += `
                                  <div class="item">
                                      <div class="circle ${circleClass}"></div>
                                      <span>${id}: ${nodeReady.val ? 'Ready' : 'Not Ready'}</span>
                                  </div>
                              `;
                          }
                      } 
                  }
              }
          });
          // Create or update an HTML state in ioBroker to display the list
          setState(StatusHTMLlinkeddevices, itemListHTML, true);
          
      }
      checkIoT();
      schedule('* * * * *',checkIoT);
      
      
      
      
      
      
      arteckA Offline
      arteckA Offline
      arteck
      Developer Most Active
      schrieb am zuletzt editiert von
      #2

      @roland-ambrosch ich will dir keinen dÀmpfer verpassen aber.. es gibt einen adapter der das auch mach..

      device-watcher

      zigbee hab ich, zwave auch, nuc's genauso und HA auch

      R 1 Antwort Letzte Antwort
      0
      • arteckA arteck

        @roland-ambrosch ich will dir keinen dÀmpfer verpassen aber.. es gibt einen adapter der das auch mach..

        device-watcher

        R Offline
        R Offline
        Roland Ambrosch
        schrieb am zuletzt editiert von
        #3

        @arteck ah! Sehe ich mir an 😀

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


        Support us

        ioBroker
        Community Adapters
        Donate

        237

        Online

        32.4k

        Benutzer

        81.4k

        Themen

        1.3m

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

        • Du hast noch kein Konto? Registrieren

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