22#ifndef INCLUDE_HUEPLUSPLUS_SENSOR_LIST_H
23#define INCLUDE_HUEPLUSPLUS_SENSOR_LIST_H
49 return get(
id).asSensorType<T>();
61 nlohmann::json state = this->
stateCache->getValue();
62 std::vector<T> result;
63 for (
auto it = state.begin(); it != state.end(); ++it)
66 if (it->value(
"type",
"") == T::typeStr)
68 result.push_back(
get(
maybeStoi(it.key())).asSensorType<T>());
Handles a ResourceList where Resources can be added by the user.
Definition ResourceList.h:286
CreateableResourceList(CreateableResourceList &&)=default
Protected defaulted move constructor.
Resource get(const IdType &id)
Get resource specified by id.
Definition ResourceList.h:126
static IdType maybeStoi(const std::string &key)
Calls std::stoi if IdType is int.
Definition ResourceList.h:173
std::shared_ptr< APICache > stateCache
Definition ResourceList.h:230
Handles a list of Sensors with type specific getters.
Definition SensorList.h:34
SensorList & operator=(SensorList &&)=default
Protected defaulted move assignment.
std::vector< T > getAllByType()
Get all sensors of type T.
Definition SensorList.h:59
T getAsType(int id)
Get sensor specified by id, convert to T.
Definition SensorList.h:47
SensorList(SensorList &&)=default
Protected defaulted move constructor.
Namespace for the hueplusplus library.
Definition Action.h:28