@Donny That’s a bit weird. There shouldn’t be nearly any delay. I am hosting it on my Raspberry too, and using an iPad wallmounted as the device …
I wonder what could cause that… Are you running both Apache and Pimatic on port 80 or something? My Pimatic is running on port 5002, Apache on 80
You could try opening chrome developer tools and taking a look if there are any errors shown?
And there is one more place where you need to put your lamp on! Here are all for a button from the example:
This one checks button status from Pimatic API on page LOAD
//EXAMPLE FOR A BUTTON TOGGLE (SWITCH):
//(This uses pimatic-homeduino switch)
//
//TOGGLE THE CLASS 'ACTIVE' WHEN BUTTON IS PRESSED
//SCRIPT CHECKS THAT THE DEVICE IS NAMED LIKE YOU WANTED
//SO NO CHANGES ON YOUR CONFIGURATION CAUSE HAZARDOUS THINGS..
//(This is checked when you connect, there's the active checking below)
socket.on('devices', function(devices){
console.log(devices);
if (devices[0].id == "switch-1"){
if (devices[0]["attributes"][0].value == true){
$("#button-1").addClass('active');
}else{
$("#button-1").removeClass('active');}
}
This one checks button status from Pimatic API on socket messages (when the page is active), and changes the visual of the button depending on the state
//switch-1
if (attrEvent.deviceId == "switch-1"){
if (attrEvent.value == true){
$("#switch-1").addClass('active');
}else{
$("#switch-1").removeClass('active');}
}
This one calls for the button press
//TOGGLE EXAMPLE
//(This uses pimatic-homeduino devices)
//
//
function swi1(){
socket.emit('call', {
id: 'executeAction-1',
action: 'executeAction',
params: {
actionString: 'toggle switch-1'
}
});
}
Also you should take all the items that you are not using out of the js file or comment them out (//).
I can help you out if you need help setting it up!