...
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. |
...
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) );
} |
...
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. |
...
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 an Optional<CommandData> a CompletableFuture<String> object containing the future result of the command.
...
Name | Type | Description |
---|
setpoint | Setpoint | An enumeration with the following values: heat, cool |
amount | intdouble | The amount to adjust the setpoint up or down, in tenths of a degree (i.e. 10 = 1 degree, 1 = 0.1 degree). For example, 2.5 degrees. |
Returns
Return Type | Description |
---|
Optional<CommandData> | An Optional CommandData class which contains a CompletableFuture<String> of the command result, as well as a String of the last known value of the Property this command effectsCompletableFuture<String> | A CompletableFuture<String> containing the result. |
Examples
Code Block |
---|
|
GatewayClient gateway = new GatewayClient(new ConnectionInfo(ConnectionType.ZIGBEE_UART, "/dev/ttyUSB0"),
...
Optional<CommandData> command;
Collection<Device> thermostats = gateway.getDevices( d -> d.getDeviceType().equals(ThermostatDevice.DEVICE_TYPE) );
for (Device device : thermostats) {
ThermostatDevice thermostat = (ThermostatDevice) device;
// adjust cooling setpoint up by 1 degree
command = thermostat.adjustOccupiedSetpoint(Setpoint.COOL, 10); // adjust cooling setpoint up by 1 degree1.0)
command.get().getCommandResult().thenAccept( result -> System.out.println("adjust cooling setpoint result: " + result) );
// adjust heating setpoint down by 1 degree
command = thermostat.adjustOccupiedSetpoint(Setpoint.HEAT, -10); // adjust heating setpoint down by 1 degree1.0)
command.get().getCommandResult().thenAccept( result -> System.out.println("adjust heating setpoint result: " + result) );
} |
...
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) );
} |
...
Sends a command over the network to set the cooling or heating Setpoint to a specified amount.
Returns an Optional<CommandData> a PropertyCommandData object containing the future result of the command.
...
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) );
} |
...
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() );
... |
...