Table of Contents | ||
---|---|---|
|
...
Represents a Thermostat on the network.
As a sub-class of Device ZigbeeDevice, it inherits everything from that interfaceclass and its parent Device class, as well as providing convenience methods for interacting with Thermostats.
API
...
changeSystemMode(SystemMode systemMode)
Usage
Sends a command over the network to change the System Mode of a Thermostat.
Returns a PropertyCommandData object containing the future result of the Property modified by the command.
This is a non-blocking call.
Parameters
Name | Type | Description |
---|---|---|
systemMode | SystemMode | A enumeration with the following values: off, auto, cool, heat, emergency heating, pre cooling, fan only, dry, sleep |
Returns
Return Type | Description |
---|---|
PropertyCommandData | Contains a CompletableFuture<Property> of the property being modified by the command. Contains the last known (cached) value of the property being modified by the command. |
Examples
Code Block | ||
---|---|---|
| ||
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"), ... Collection<Device> thermostats = gateway.getDevices( d -> d. |
...
getDeviceType().equals(ThermostatDevice.DEVICE_TYPE) );
for (Device device : thermostats) {
ThermostatDevice thermostat = (ThermostatDevice) device;
thermostat.changeSystemMode(SystemMode.OFF);
} |
readSystemMode()
Usage
Sends a command over the network to read the Mode of a ThermostatDevice (i.e. SystemMode)
Returns a CompletableFuture of the 'systemMode' Property.
This is a non-blocking call.
Parameters
None.
Returns
Return Type | Description |
---|---|
CompletableFuture<Property> | A CompletableFuture of the 'systemMode' Property. |
Examples
Code Block | ||
---|---|---|
| ||
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"), ... Collection<Device> thermostats = gateway.getDevices( d -> d.getDeviceType().equals(ThermostatDevice.DEVICE_TYPE) ); for (Device device : thermostats) { ThermostatDevice thermostat = (ThermostatDevice) device; CompletableFuture<Property> futureMode = thermostat.readMode(); // you can block on the future, or handle it asynchronously // blocking example Property systemMode = futureMode.get(); // async example futureMode.thenAccept( systemModeProperty -> System.out.println("systemMode: " + systemModeProperty) ); } |
changeFanMode(FanMode fanMode)
Usage
Sends a command over the network to change the Fane Mode of a Thermostat.
Returns a PropertyCommandData object containing the future result of the Property modified by the command.
This is a non-blocking call.
Parameters
Name | Type | Description |
---|---|---|
fanMode | FanMode | An enumeration with the following values: off, low, medium, high, on, auto, smart |
Returns
Return Type | Description |
---|---|
PropertyCommandData | Contains a CompletableFuture<Property> of the property being modified by the command. Contains the last known (cached) value of the property being modified by the command. |
Examples
Code Block | ||
---|---|---|
| ||
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"), ... Collection<Device> thermostats = gateway.getDevices( d -> d.getDeviceType().equals(ThermostatDevice.DEVICE_TYPE) ); for (Device device : thermostats) { ThermostatDevice thermostat = (ThermostatDevice) device; thermostat.changeFanMode(FanMode.LOW); } |
readFanMode()
Usage
Sends a command over the network to read the Fan Mode of a ThermostatDevice.
Returns a CompletableFuture of the 'fanMode' Property.
This is a non-blocking call.
Parameters
None.
Returns
Return Type | Description |
---|---|
CompletableFuture<Property> | A CompletableFuture of the 'fanMode' Property. |
Examples
Code Block | ||
---|---|---|
| ||
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"), ... Collection<Device> thermostats = gateway.getDevices( d -> d.getDeviceType().equals(ThermostatDevice.DEVICE_TYPE) ); for (Device device : thermostats) { ThermostatDevice thermostat = (ThermostatDevice) device; CompletableFuture<Property> futureMode = thermostat.readFanMode(); // you can block on the future, or handle it asynchronously // blocking example Property fanMode = futureMode.get(); // async example futureMode. |
...
thenAccept( fanProperty -> System.out.println("fanMode: " + fanProperty) );
} |
adjustOccupiedSetpoint(Setpoint setpoint,
...
double amount)
Usage
Sends a command over the network to adjust the cooling or heating Setpoint up or down by a specified amount.
Returns a CompletableFuture<String> object containing the future result of the command.
This is a non-blocking call.
Parameters
Name | Type | Description |
---|---|---|
setpoint | Setpoint | An enumeration with the following values: heat, cool |
amount |
double | The amount to adjust the setpoint up or down. For example, 2.5 degrees. |
Returns
Return Type | Description |
---|---|
CompletableFuture<String> | A CompletableFuture<String> containing the result. |
Examples
Code Block | ||
---|---|---|
| ||
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"), ... Collection<Device> thermostats = gateway.getDevices( d -> d.getDeviceType().. |
readSetpointLimit(Setpoint setpoint)
Usage
...
Parameters
...
equals(ThermostatDevice.DEVICE_TYPE) );
for (Device device : thermostats) {
ThermostatDevice thermostat = (ThermostatDevice) device;
// adjust cooling setpoint up by 1 degree
thermostat.adjustOccupiedSetpoint(Setpoint.COOL, 1.0)
.thenAccept( result -> System.out.println("adjust cooling setpoint result: " + result) );
// adjust heating setpoint down by 1 degree
thermostat.adjustOccupiedSetpoint(Setpoint.HEAT, -1.0)
.thenAccept( result -> System.out.println("adjust heating setpoint result: " + result) );
} |
readOccupiedCoolingSetpoint() / readOccupiedHeatingSetpoint()
Usage
Sends a command over the network to read the Occupied Cooling or Heating Setpoint of a ThermostatDevice.
Returns a CompletableFuture of the Property.
This is a non-blocking call.
Parameters
None.
Returns
Return Type | Description |
---|---|
CompletableFuture<Property> | A CompletableFuture of the Property. |
Examples
Code Block | ||
---|---|---|
| ||
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"), ... Collection<Device> thermostats = gateway.getDevices( d -> d.getDeviceType().equals(ThermostatDevice.DEVICE_TYPE) ); for (Device device : thermostats) { ThermostatDevice thermostat = (ThermostatDevice) device; CompletableFuture<Property> future = thermostat.readOccupiedCoolingSetpoint(); // you can block on the future, or handle it asynchronously // blocking example Property setpoint = future.get(); // async example future.thenAccept( setpoint -> System.out. |
...
println("setpoint: " + setpoint) );
} |
setOccupiedCoolingSetpoint(double temperature) / setOccupiedHeatingSetpoint(double temperature)
Usage
Sends a command over the network to set the cooling or heating Setpoint to a specified amount.
Returns a PropertyCommandData object containing the future result of the command.
This is a non-blocking call.
Parameters
Name | Type | Description |
---|
temperature |
double | The amount to set to setpoint to. For example 24.5 degrees, etc. |
Returns
Return Type | Description |
---|---|
PropertyCommandData | Contains a CompletableFuture<Property> of the property being modified by the command. Contains the last known (cached) value of the property being modified by the command. |
Examples
Code Block | ||
---|---|---|
| ||
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"), ... Collection<Device> thermostats = gateway.getDevices( d -> d.getDeviceType().equals(ThermostatDevice.DEVICE_TYPE) ); for (Device device : thermostats) { ThermostatDevice thermostat = (ThermostatDevice) device; thermostat.setOccupiedHeatingSetpoint(23.5); // set the heating setpoint to 23.5 degrees } |
readRunningMode()
Usage
Sends a command over the network to read the Running Mode of a ThermostatDevice.
Returns a CompletableFuture of the 'runningMode' Property.
This is a non-blocking call.
Parameters
None.
Returns
Return Type | Description |
---|---|
CompletableFuture<Property> | A CompletableFuture of the 'runningMode' Property. |
Examples
Code Block | ||
---|---|---|
| ||
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"), ... Collection<Device> thermostats = gateway.getDevices( d -> d.getDeviceType().equals(ThermostatDevice.DEVICE_TYPE) ); for (Device device : thermostats) { ThermostatDevice thermostat = (ThermostatDevice) device; CompletableFuture<Property> futureMode = thermostat.readRunningMode(); // you can block on the future, or handle it asynchronously // blocking example Property runningMode = futureMode.get(); // async example futureMode.thenAccept( runningModeProperty -> System.out.println("runningMode: " + runningModeProperty) ); } |
getDeviceType()
Usage
Returns the DeviceType that the Device belongs to. DeviceType contains a type and category. For a ThermostatDevice, this would be:
- Category: HVAC
- Type: Thermostat
The value returned from this method can be used to search the network for Devices of the same type.
Parameters
None.
Returns
Return Type | Description |
---|---|
DeviceType | The DeviceType object categorizing and identifying the ThermostatDevice. |
Examples
Code Block | ||
---|---|---|
| ||
...
Collection<Device> thermostats = gw.getDevices( d -> d.getDeviceType().equals(ThermostatDevice.DEVICE_TYPE));
...
System.out.println("ThermostatDevice type: " + gw.getDevice(idStr).getDeviceType().getType() );
... |