ColorLightpublic abstract class Light extends Device
| Constructor | Description |
|---|---|
Light(java.net.InetAddress ip,
Token token,
java.lang.String[] acceptableModels,
int timeout,
int retries) |
| Modifier and Type | Method | Description |
|---|---|---|
int |
getBrightness() |
|
int |
getColorTemperature() |
|
int |
getDeviceMode() |
|
int |
getHue() |
|
int |
getIntProp(Prop.Names prop) |
Get a single property value and try to convert it to an int.
|
java.lang.String |
getName() |
|
java.util.Map<Prop.Names,java.lang.String> |
getProps(Prop.Names[] props) |
Get several property values at once from the device.
|
int |
getRGB() |
|
int |
getSaturation() |
|
java.lang.String |
getSingleProp(Prop.Names prop) |
Get a single property value from the device.
|
int |
getTimeUntilPowerOff() |
|
boolean |
isOn() |
|
boolean |
powerOffAfterTime(int minutes) |
Power the device off after some time.
|
boolean |
setAsDefault() |
Set the current settings as the default value that will be restored after a power loss.
|
boolean |
setBrightness(int brightness,
boolean smoothChange,
int duration) |
|
boolean |
setColorTemperature(int temperature,
boolean smoothChange,
int duration) |
|
boolean |
setHSV(int hue,
int saturation,
boolean smoothChange,
int duration) |
|
boolean |
setName(java.lang.String name) |
|
boolean |
setPower(boolean on,
boolean smoothChange,
int duration) |
|
boolean |
setRGB(int c,
boolean smoothChange,
int duration) |
|
boolean |
stopPowerOffAfterTime() |
Prevent the device from powering off after some time.
|
boolean |
togglePower() |
configureRouter, configureRouter, discover, firmware, getAcceptableModels, getIp, getRetries, getTimeout, getToken, info, model, send, send, sendOk, sendOk, sendToArray, sendToArray, sendToObject, sendToObject, update, updateProgress, updateStatuspublic Light(java.net.InetAddress ip,
Token token,
java.lang.String[] acceptableModels,
int timeout,
int retries)
ip - The IP address of the light to connect to. If the address is null the first light that was found will be chosen.token - The token for that device. If the token is null the token will be extracted from unprovisioned devices.acceptableModels - An array of acceptable devices to connect to.timeout - The timeout for the communicationretries - The number of retries after a failed communicationpublic java.util.Map<Prop.Names,java.lang.String> getProps(Prop.Names[] props) throws CommandExecutionException
props - The properties to get.CommandExecutionException - When there has been a error during the communication or the response was invalid.public java.lang.String getSingleProp(Prop.Names prop) throws CommandExecutionException
prop - The property to get.CommandExecutionException - When there has been a error during the communication or the response was invalid.public int getIntProp(Prop.Names prop) throws CommandExecutionException
prop - The property to get.CommandExecutionException - When there has been a error during the communication or the response was invalid.public int getDeviceMode()
throws CommandExecutionException
CommandExecutionException - When there has been a error during the communication or the response was invalid.public boolean setColorTemperature(int temperature,
boolean smoothChange,
int duration)
throws CommandExecutionException
temperature - Color temperature to set. 1700 to 6500(k) inclusivesmoothChange - Whether to change instantly or smoothly.duration - The duration of the smooth change.CommandExecutionException - When there has been a error during the communication or the response was invalid.public int getColorTemperature()
throws CommandExecutionException
CommandExecutionException - When there has been a error during the communication or the response was invalid.public boolean setRGB(int c,
boolean smoothChange,
int duration)
throws CommandExecutionException
c - The color to change to.smoothChange - Whether to change instantly or smoothly.duration - The duration of the smooth change.CommandExecutionException - When there has been a error during the communication or the response was invalid.public int getRGB()
throws CommandExecutionException
CommandExecutionException - When there has been a error during the communication or the response was invalid.public boolean setHSV(int hue,
int saturation,
boolean smoothChange,
int duration)
throws CommandExecutionException
hue - The hue to change to.saturation - The saturation to change to.smoothChange - Whether to change instantly or smoothly.duration - The duration of the smooth change.CommandExecutionException - When there has been a error during the communication or the response was invalid.public int getHue()
throws CommandExecutionException
CommandExecutionException - When there has been a error during the communication or the response was invalid.public int getSaturation()
throws CommandExecutionException
CommandExecutionException - When there has been a error during the communication or the response was invalid.public boolean setBrightness(int brightness,
boolean smoothChange,
int duration)
throws CommandExecutionException
brightness - The brightness to change to.smoothChange - Whether to change instantly or smoothly.duration - The duration of the smooth change.CommandExecutionException - When there has been a error during the communication or the response was invalid.public int getBrightness()
throws CommandExecutionException
CommandExecutionException - When there has been a error during the communication or the response was invalid.public boolean setPower(boolean on,
boolean smoothChange,
int duration)
throws CommandExecutionException
on - True: turn the device on; False: turn the device off.smoothChange - Whether to change instantly or smoothly.duration - The duration of the smooth change.CommandExecutionException - When there has been a error during the communication or the response was invalid.public boolean togglePower()
throws CommandExecutionException
CommandExecutionException - When there has been a error during the communication or the response was invalid.public boolean isOn()
throws CommandExecutionException
CommandExecutionException - When there has been a error during the communication or the response was invalid.public boolean setAsDefault()
throws CommandExecutionException
CommandExecutionException - When there has been a error during the communication or the response was invalid.public boolean powerOffAfterTime(int minutes)
throws CommandExecutionException
minutes - The time until the device is turned off in minutes.CommandExecutionException - When there has been a error during the communication or the response was invalid.public boolean stopPowerOffAfterTime()
throws CommandExecutionException
CommandExecutionException - When there has been a error during the communication or the response was invalid.public int getTimeUntilPowerOff()
throws CommandExecutionException
CommandExecutionException - When there has been a error during the communication or the response was invalid.public boolean setName(java.lang.String name)
throws CommandExecutionException
name - The name to set the device to.CommandExecutionException - When there has been a error during the communication or the response was invalid.public java.lang.String getName()
throws CommandExecutionException
CommandExecutionException - When there has been a error during the communication or the response was invalid.Copyright © 2018. All rights reserved.