NEWS
JS / connection-status der linkeddevices anzeigen
-
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:

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); -
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:

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);@roland-ambrosch ich will dir keinen dÀmpfer verpassen aber.. es gibt einen adapter der das auch mach..
device-watcher
-
@roland-ambrosch ich will dir keinen dÀmpfer verpassen aber.. es gibt einen adapter der das auch mach..
device-watcher
@arteck ah! Sehe ich mir an đ