so now i wrote something to check the state of an element at startup for me at the moment it works without failure. I hope it will do so for the other.
Just on code block to check and set the state of alle switches in the gui
socket.on('devices', function(devices){
console.log(devices);
var devlength = devices.length;
for (var i = 0; i < devlength; i++){
if (devices[i]["attributes"][0].value == true){
$("#"+devices[i].id).addClass('active');
}else{
$("#"+devices[i].id).removeClass('active');}
}
so you don’t have to look through the output of the emitted array. Just set some divs with ids specified in pimatic an look what happens