Schedule stored in the bridge.
More...
#include <hueplusplus/Schedule.h>
Schedule stored in the bridge.
A schedule can be created by the user to trigger actions at specific times.
◆ Schedule() [1/2]
hueplusplus::Schedule::Schedule |
( |
int |
id, |
|
|
const std::shared_ptr< APICache > & |
baseCache |
|
) |
| |
Creates schedule with shared cache.
- Parameters
-
id | Schedule id in the bridge |
baseCache | Cache of the schedule list. |
◆ Schedule() [2/2]
hueplusplus::Schedule::Schedule |
( |
int |
id, |
|
|
const HueCommandAPI & |
commands, |
|
|
std::chrono::steady_clock::duration |
refreshDuration, |
|
|
const nlohmann::json & |
currentState |
|
) |
| |
Construct Schedule that exists in the bridge.
- Parameters
-
id | Schedule ID |
commands | HueCommandAPI for requests |
refreshDuration | Time between refreshing the cached state |
currentState | The current state, may be null. |
◆ getAutodelete()
bool hueplusplus::Schedule::getAutodelete |
( |
| ) |
const |
Get autodelete.
When autodelete is set to true, the schedule is removed after it expires. Only for non-recurring schedules.
◆ getCommand()
Action hueplusplus::Schedule::getCommand |
( |
| ) |
const |
◆ getCreated()
Get created time.
- Returns
- AbsoluteTime without variation
◆ getDescription()
std::string hueplusplus::Schedule::getDescription |
( |
| ) |
const |
Get schedule description.
◆ getId()
int hueplusplus::Schedule::getId |
( |
| ) |
const |
◆ getName()
std::string hueplusplus::Schedule::getName |
( |
| ) |
const |
Get schedule name.
The schedule name is always unique for the bridge.
◆ getStartTime()
Get start time for timers.
- Returns
- AbsoluteTime without variation when the timer was started.
- Exceptions
-
nlohmann::json::out_of_range | when the schedule does not have a start time |
◆ getTime()
Get time when the event(s) will occur.
- Returns
- TimePattern in local timezone
◆ isEnabled()
bool hueplusplus::Schedule::isEnabled |
( |
| ) |
const |
Check whether schedule is enabled or disabled.
◆ refresh()
void hueplusplus::Schedule::refresh |
( |
| ) |
|
Refreshes internal cached state.
- Exceptions
-
std::system_error | when system or socket operations fail |
HueException | when response contained no body |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
◆ setAutodelete()
void hueplusplus::Schedule::setAutodelete |
( |
bool |
autodelete | ) |
|
Set autodelete.
- Parameters
-
autodelete | Whether to delete the schedule after it expires |
- Exceptions
-
std::system_error | when system or socket operations fail |
HueException | when response contained no body |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
◆ setCommand()
void hueplusplus::Schedule::setCommand |
( |
const Action & |
command | ) |
|
Set schedule command.
- Parameters
-
command | New action that is executed when the time event occurs. |
- Exceptions
-
std::system_error | when system or socket operations fail |
HueException | when response contained no body |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
◆ setDescription()
void hueplusplus::Schedule::setDescription |
( |
const std::string & |
description | ) |
|
Set schedule description.
- Parameters
-
description | New description, may be empty. Max size is 64. |
- Exceptions
-
std::system_error | when system or socket operations fail |
HueException | when response contained no body |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
◆ setEnabled()
void hueplusplus::Schedule::setEnabled |
( |
bool |
enabled | ) |
|
Enable or disable schedule.
- Parameters
-
enabled | true to enable, false to disable. |
Can be used to reset a timer by setting to disabled and enabled again.
- Exceptions
-
std::system_error | when system or socket operations fail |
HueException | when response contained no body |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
◆ setName()
void hueplusplus::Schedule::setName |
( |
const std::string & |
name | ) |
|
Set schedule name.
- Parameters
-
name | New name for the schedule. Max size is 32. Must be unique for all schedules, otherwise a number is added. |
- Exceptions
-
std::system_error | when system or socket operations fail |
HueException | when response contained no body |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
◆ setRefreshDuration()
void hueplusplus::Schedule::setRefreshDuration |
( |
std::chrono::steady_clock::duration |
refreshDuration | ) |
|
Sets custom refresh interval for this schedule.
- Parameters
-
refreshDuration | The new minimum duration between refreshes. May be 0 or c_refreshNever. |
◆ setTime()
Set new time when the event will occur.
- Parameters
-
timePattern | Any possible value of TimePattern |
- Exceptions
-
std::system_error | when system or socket operations fail |
HueException | when response contained no body |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
The documentation for this class was generated from the following files: