Device value onChangeRequest

Hi,
I have created a custom Pluging to manage temperature zone. I have created 9 zones all with same Attributes
image

these are the attributes defined for each zone:
image

In the interface I have binded HeatingSetpoint and so I can change each HeatingSetpoint for each zone.

I expected that in the “onChangeRequest” function in the “device” variable I received the reference to the correct device like “cucina” or “sala” but i see only value “gj”

To be more clear:
function onChangeRequest(device, attribute, value) {

console.log(attribute + "=" + value + ", device=" + device);

switch (attribute) {
    case "Attivo":
        device.Attivo = value;
        break;
    case "ScenarioAttivo":
        if (device.ScenarioAttivo != value) {
            CaricaTemperatureScenario;
        };
        break;
    case "HeatingSetpoint":
         device.HeatingSetpoint = value;             
         break;
    case "Mode":
        device.Mode = value;
        break;
    case "Luce":
        device.Luce = value;
        break;
    case "TemperaturaReale":
        device.TemperaturaReale = value;
        break;
    default:
        break;
}

}

in the log i see:
HeatingSetpoint=23.5, device=gj

The code work fine but i would like better undestand.

what kind of object is device?

Thanks, Paolo

“device” is the actual device object. The code you have will not add anything to the log. You need to specify which property/attribute you’d like to log.

For example, if you want to add device information to the log, you can do something like this:

console.log("device.Id=" + device.Id);
console.log("device.Name=" + device.Name);
console.log("device.DisplayName=" + device.DisplayName);
console.log("device.HeatingSetpoint=" + device.HeatingSetpoint); //For your devices that have the HeatingSetpoint attribute.