Loading...
Searching...
No Matches
hueplusplus::Condition Class Reference

Condition for a Rule. More...

`#include <hueplusplus/Condition.h>`

## Public Types

enum class | Operator { eq , gt , lt , dx , ddx , stable , notStable , in , notIn }
| Specifies which operation is used to check the condition. More...

## Public Member Functions

| Condition (const std::string &address, Operator op, const std::string &value)
| Create a condition from any address on the bridge.
std::string | getAddress () const
| Get address on the bridge.
Operator | getOperator () const
| Get used operator.
std::string | getValue () const
| Get value the attribute is checked against.
nlohmann::json | toJson () const
| Create the json form of the condition.

## Static Public Member Functions

static Condition | parse (const nlohmann::json &json)
| Parse condition from json value.

## Detailed Description

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.

## Member Enumeration Documentation

## Operator

enum class hueplusplus::Condition::Operator

strong

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).

## Constructor & Destructor Documentation

## 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.

## Member Function Documentation

## getAddress()

std::string hueplusplus::Condition::getAddress | ( |  | ) | const

Get address on the bridge.

## getOperator()

Condition::Operator hueplusplus::Condition::getOperator | ( |  | ) | const

Get used operator.

## 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

  HueException | when the operator is unknown.

## 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:

- include/hueplusplus/Condition.h
- src/Rule.cpp