Condition for a Rule.
More...
#include <hueplusplus/Condition.h>
Condition for a Rule.
The condition checks whether a resource attribute (usually a Sensor value) matches the specified Operator.
Conditions from sensors can be created more easily using the makeCondition() helper functions.
◆ Operator
Specifies which operation is used to check the condition.
Enumerator |
---|
eq | Attribute is equal to specified value (for bool and int)
|
gt | Attribute is greater than specified value (for int)
|
lt | Attribute is less than specified value (for int)
|
dx | Attribute has changed (no value given)
|
ddx | Delayed attribute has changed (no value given)
|
stable | Stable for a given time. Does not trigger a rule change.
|
notStable | Not stable for a given time. Does not trigger a rule change.
|
in | Time is in the given interval (triggered on start time, local time)
|
notIn | Time is not in the interval (triggered on end time, local time)
|
◆ Condition()
hueplusplus::Condition::Condition |
( |
const std::string & |
address, |
|
|
Operator |
op, |
|
|
const std::string & |
value |
|
) |
| |
Create a condition from any address on the bridge.
- Parameters
-
address | Path to an attribute of the bridge |
op | Operator used for comparison. |
value | String representation of the value to check against. Empty for some operators. |
◆ getAddress()
std::string hueplusplus::Condition::getAddress |
( |
| ) |
const |
Get address on the bridge.
◆ getOperator()
◆ getValue()
std::string hueplusplus::Condition::getValue |
( |
| ) |
const |
Get value the attribute is checked against.
◆ parse()
Condition hueplusplus::Condition::parse |
( |
const nlohmann::json & |
json | ) |
|
|
static |
Parse condition from json value.
- Parameters
-
json | Json object with address, operator and value |
- Returns
- The parsed condition with the same values
- Exceptions
-
◆ toJson()
nlohmann::json hueplusplus::Condition::toJson |
( |
| ) |
const |
Create the json form of the condition.
- Returns
- A json object with address, operator and value
The documentation for this class was generated from the following files: