Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Gateway API will return a specific type of class for certain devices. Specific device classes, such as ThermostatDevice, will have their own convenience methods that allow you to skip using the getProperty/updateProperty API's.

For example, for a ThermostatDevice, you could interact with it as follows:

Code Block
final Device d = gw.getDevice(id);
if (d instanceof ThermostatDevice) {
	final ThermostatDevice device = (ThermostatDevice) d;
	device.readMode();
	device.changeMode(SystemMode.AUTO);
} else {
	System.out.println("device is not a thermostat");
}

...