schedule( "10 * * * *", function () {
var sortArr=[];
var wert1;
var ip;
var devicenameName;
var devicename;
//var htmlString ="
NAME | IP | |
";
var htmlString ="";//NAME | IP | | | NAME | IP | |
";//
var counter =0;
$('ping.0.Medion*Test*.*').each(function (id, i){
counter = counter+1;
//log(counter.toString());
devicename = getObject(id).common.name;
//log(devicename);
ip = id.replace(/_/g, ".");
ip = ip.replace(/ping.0.Medion\(Test\)./g, "");
// log(id + " : " + devicename + " : " + ip );
devicenameName=devicename;
devicename="Netzwerk.Gerät"+counter.toString()+".NameGerät";
createState(devicename, 'empty', { name: 'Name des Geräts', desc: '', type: 'string', role: '',read: true, write: true });
setStateDelayed(devicename, devicenameName, 800);
devicename="Netzwerk.Gerät"+counter.toString()+".IPAdresse";
setStateDelayed(devicename, ip, 800);
createState(devicename, 'empty', { name: 'IP des Geräts', desc: '', type: 'string', role: '',read: true, write: true });
wert1 = getState(id).val;
if (wert1) wert1 = "✅";
if (!wert1) wert1= "❌";
let help = [devicenameName,ip,wert1];
sortArr.push(help);
});
/*function numSort(a, b) {
{1}
if (a[1].toUpperCase().trim() > b[1].toUpperCase().trim())
return -1;
if (b[1].toUpperCase().trim() > a[1].toUpperCase().trim())
return 1;
return 0;
}
sortArr.sort(numSort);*/
sortArr.sort(function (alpha, beta) {
if (alpha[0].toUpperCase() > beta[0].toUpperCase())
return 1;
if (beta[0].toUpperCase() > alpha[0].toUpperCase())
return -11;
return 0;
});
for (var i=0; i" + sortArr[i][0] + " | " + sortArr[i][1] + " | " +sortArr[i][2]+" | " ;}
else { htmlString=htmlString+ "" + sortArr[i][0] + " | " + sortArr[i][1] + " | " +sortArr[i][2]+" "+" | "}}
//htmlString=htmlString.concat("" + devicenameName + " | " + ip + " | " + wert1 + " |
");
//log(counter);
createState('Netzwerk.StringHTML', "0", {name: 'StringHTML', desc: '', type: 'string', role: '',read: true, write: true });
createState('Netzwerk.Anzahl', { name: 'Anzahl', desc: 'Anzahl der Geräte', type: 'number', unit: '', min: '0', max: '255', role: '',read: true, write: true });
setStateDelayed('Netzwerk.Anzahl', counter, 800);
setStateDelayed('Netzwerk.StringHTML', htmlString.concat("
"), 800);
});