Help with plugin

Hi Bill

Can you please check this out and tell me why is “device.mode_mode” and “pluginDevice.mode_mode” returning null, while “zone.properties.mode” returns the value?
They should ne holding all the same value.

function onSynchronizeDevices() {

	var r = http.get(baseURL + "/panels/climate/"+plugin.Settings["ZoneID" ], { auth: credentials });
	var zone = r.data;
	var device = new Device();
	device.Id = zone.id;
	device.DisplayName = zone.name;
	device.DeviceType = "Zone";
	device.mode_mode = zone.properties.mode
	device.Attributes = ["id","name","active","mode","mode_mode"];
	plugin.Devices[device.Id] = device; 
	var pluginDevice = plugin.Devices[device.Id];
console.log("Plugin device mode_mode:" + pluginDevice.mode_mode ); //returns nill
console.log("device mode_mode:" + device.mode_mode ); //returns nill
console.log("zone mode_mode:" + zone.properties.mode ); // returns the value

}

Thanks for the help

In onSynchornizeDevices you are only supposed to create the objects, not update their states. You need to update states like mode_mode in either onConnect or onPoll.

Ahh, ok thanks. I didn’t find this info in documentation.