Skip to content
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • 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

  • Default (No Skin)
  • No Skin
Collapse
Logo
  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.1k

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

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

JS / connection-status der linkeddevices anzeigen

Scheduled Pinned Locked Moved Skripten / Logik
3 Posts 2 Posters 193 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Roland Ambrosch
    wrote on last edited by 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 Reply Last reply
    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
      wrote on last edited by
      #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 Reply Last reply
      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
        wrote on last edited by
        #3

        @arteck ah! Sehe ich mir an 😀

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        Support us

        ioBroker
        Community Adapters
        Donate

        614

        Online

        32.4k

        Users

        81.4k

        Topics

        1.3m

        Posts
        Community
        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
        ioBroker Community 2014-2025
        logo
        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Recent
        • Tags
        • Unread 0
        • Categories
        • Unreplied
        • Popular
        • GitHub
        • Docu
        • Hilfe