Ah so ist's richtig
var cacheSelector = $('state[id=parser.0.*]');
var cacheSelector = $('[id=parser.0.*]');
schedule( "*/03 * * * * *", function () {
var sortArr=[];
var htmlString ="<table><tr><td>Bahn </td><td>Wartezeit </td><td> </td></tr>";
//console.log(cacheSelector);
var counter =0;
cacheSelector.each(function(id, i) {
counter = counter+1
var devicename = getObject(id).common.name;
var ip = id.replace(/_/g, ".");
var ip = ip.replace(/parser.0./g, "");
// log(id + " : " + devicename + " : " + ip );
var devicenameName=devicename;
devicename="Park.Wartezeit"+counter.toString()+".BahnName";
createState(devicename, 'empty', { name: 'Name der Bahn', desc: '', type: 'string', role: '',read: true, write: true });
setStateDelayed(devicename, devicenameName, 800);
devicename="Park.Wartezeit"+counter.toString()+".Bahn";
setStateDelayed(devicename, ip, 800);
createState('empty', { name: 'Bahn', desc: '', type: 'string', role: '',read: true, write: true });
var wert2 = getState(id).val;
var wert1 = getState(id).val;
if (wert2) wert2 = "✅";
if (!wert2) wert2= "❌";
let help = [ip,wert1,wert2];
sortArr.push(help);
//log(sortArr[0]);
});
function numSort(a, b) {
return parseInt(b[1]) - parseInt(a[1]);
}
sortArr.sort(numSort);
for (var i=0; i<sortArr.length;i++) {
htmlString=htmlString+"<tr><td>" + sortArr[i][0] + " </td><td>" + sortArr[i][1] + " </td><td>" + sortArr[i][2] + "</td></tr>";
}
//htmlString=htmlString.concat("<tr><td>" + devicenameName + " </td><td>" + ip + " </td><td>" + wert1 + "</td></tr>");
//log(counter);
createState('Park.StringHTML', 0, {name: 'StringHTML', desc: '', type: 'string', role: '',read: true, write: true });
createState('Park.Anzahl', 0, { name: 'Anzahl', desc: 'Anzahl der Geräte', type: 'number', unit: '', min: '0', max: '255', role: '',read: true, write: true });
setStateDelayed('Park.Anzahl', counter, 800);
setStateDelayed('Park.StringHTML', htmlString.concat("</table>"), 800);
});