![]() |
FauxmoESP v2.0.0
|
This class represents the state of a light.
Definition at line 16 of file LightState.h.
#include <LightState.h>
Public Member Functions | |
LightState () | |
Creates a new light state with default values. | |
LightState (bool state, uint8_t brightness=254, uint16_t hue=41462, uint8_t saturation=77, const XYPoint &xy=XYPoint(), uint16_t colorTemperature=155, AlertEffect alertEffect=ALERT_EFFECT_NONE, LightEffect dynamicLightEffect=LIGHT_EFFECT_NONE, ColorMode colorMode=COLOR_MODE_CT, bool isLightReachable=true) | |
Creates a new light state with the given values. | |
String | toJson () const |
Returns the current state of the light as a JSON string. | |
String | getColorModeString () const |
Return the current color mode as a string. | |
String | getDynamicLightEffectString () const |
Return the current dynamic light effect as a string. | |
String | getAlertEffectString () const |
Return the current alert effect as a string. | |
bool | operator== (const LightState &other) const |
bool | operator!= (const LightState &other) const |
Public Attributes | |
bool | isOn |
On/Off state of the light. | |
uint8_t | brightness |
Brightness of the light. | |
uint16_t | hue |
Hue of the light. | |
uint8_t | saturation |
Saturation of the light. | |
XYPoint | xy |
The x and y coordinates of a color in CIE color space. | |
uint16_t | colorTemperature |
The Mired Color temperature of the light. | |
AlertEffect | alertEffect |
The alert effect, which is a temporary change to the bulb's state. | |
LightEffect | dynamicLightEffect |
The dynamic effect of the light, can either be "none" or "colorloop". | |
ColorMode | colorMode |
Indicates the color mode in which the light is working, this is the last command type it received. | |
bool | isLightReachable |
Indicates if a light can be reached by the bridge. | |
String | mode = "homeautomation" |
LightState::LightState | ( | ) |
Creates a new light state with default values.
Definition at line 10 of file LightState.cpp.
|
explicit |
Creates a new light state with the given values.
state | The on/off state of the light. |
brightness | The current brightness of the light. |
hue | The current hue of the light. |
saturation | The current saturation of the light. |
xy | The current xy color of the light. |
colorTemperature | The current color temperature of the light. |
alertEffect | The current alert effect of the light. |
dynamicLightEffect | The current dynamic light effect of the light. |
colorMode | The current color mode of the light. |
isLightReachable | The current reachability of the light. |
Definition at line 15 of file LightState.cpp.
String LightState::getAlertEffectString | ( | ) | const |
Return the current alert effect as a string.
Definition at line 72 of file LightState.cpp.
String LightState::getColorModeString | ( | ) | const |
Return the current color mode as a string.
Definition at line 62 of file LightState.cpp.
String LightState::getDynamicLightEffectString | ( | ) | const |
Return the current dynamic light effect as a string.
Definition at line 67 of file LightState.cpp.
bool LightState::operator!= | ( | const LightState & | other | ) | const |
Definition at line 85 of file LightState.cpp.
bool LightState::operator== | ( | const LightState & | other | ) | const |
Definition at line 77 of file LightState.cpp.
String LightState::toJson | ( | ) | const |
Returns the current state of the light as a JSON string.
Definition at line 28 of file LightState.cpp.
AlertEffect LightState::alertEffect |
The alert effect, which is a temporary change to the bulb's state.
This can take one of the following values: "none" – The light is not performing an alert effect. "select" – The light is performing one breathe cycle. "lselect" – The light is performing breathe cycles for 15 seconds or until an "alert": "none" command is received.
Note that this contains the last alert sent to the light and not its current state. i.e. After the breathe cycle has finished the bridge does not reset the alert to “none“.
json key: alert
Definition at line 111 of file LightState.h.
uint8_t LightState::brightness |
Brightness of the light.
This is a scale from the minimum brightness the light is capable of, 1, to the maximum capable brightness, 254.
json key: bri
Definition at line 59 of file LightState.h.
ColorMode LightState::colorMode |
Indicates the color mode in which the light is working, this is the last command type it received.
Values are
json key: colormode
Definition at line 132 of file LightState.h.
uint16_t LightState::colorTemperature |
The Mired Color temperature of the light.
2012 connected lights are capable of 153 (6500K) to 500 (2000K).
json key: ct
Definition at line 98 of file LightState.h.
LightEffect LightState::dynamicLightEffect |
The dynamic effect of the light, can either be "none" or "colorloop".
If set to colorloop, the light will cycle through all hues using the current brightness and saturation settings.
json key: effect
Definition at line 119 of file LightState.h.
uint16_t LightState::hue |
Hue of the light.
This is a wrapping value between 0 and 65535. Note, that hue/sat values are hardware dependent which means that programming two devices with the same value does not garantuee that they will be the same color. Programming 0 and 65535 would mean that the light will resemble the color red, 21845 for green and 43690 for blue.
json key: hue
Definition at line 71 of file LightState.h.
bool LightState::isLightReachable |
Indicates if a light can be reached by the bridge.
json key: reachable
Definition at line 139 of file LightState.h.
bool LightState::isOn |
On/Off state of the light.
On=true, Off=false
json key: on
Definition at line 50 of file LightState.h.
String LightState::mode = "homeautomation" |
Definition at line 141 of file LightState.h.
uint8_t LightState::saturation |
Saturation of the light.
254 is the most saturated (colored) and 0 is the least saturated (white).
json key: sat
Definition at line 79 of file LightState.h.
XYPoint LightState::xy |
The x and y coordinates of a color in CIE color space.
The first entry is the x coordinate and the second entry is the y coordinate. Both x and y are between 0 and 1. Using CIE xy, the colors can be the same on all lamps if the coordinates are within every lamps gamuts (example: “xy”:[0.409,0.5179] is the same color on all lamps). If not, the lamp will calculate it’s closest color and use that. The CIE xy color is absolute, independent from the hardware.
json key: xy
Definition at line 90 of file LightState.h.