@David0Conner:
then I get the errors:
Domotica.ino:1382:21: error: ‘device’ was not declared in this scope
Domotica.ino:1383:21: error: ‘status’ was not declared in this scope
@HugoPT : I'm allready using arrays to upload temperature and thermostat data, but for single lightswitches, there is no need for an array, because you use only 1 lightswitch at a time, it wouldn't make sense to update 15 lightswitches statuses if you only switch 1 on or off