SinricPro Library
AirQualityEventSource.h
1 #ifndef _AIRQUALITYEVENTSOURCE_H_
2 #define _AIRQUALITYEVENTSOURCE_H_
3 
8 template <typename T>
10  public:
11  bool sendAirQualityEvent(int pm1 = 0, int pm2_5 = 0, int pm10 = 0, String cause = "PERIODIC_POLL");
12 };
13 
25 template <typename T>
26 bool AirQualityEventSource<T>::sendAirQualityEvent(int pm1, int pm2_5, int pm10, String cause) {
27  T& device = static_cast<T&>(*this);
28 
29  DynamicJsonDocument eventMessage = device.prepareEvent("airQuality", cause.c_str());
30  JsonObject event_value = eventMessage["payload"]["value"];
31 
32  event_value["pm1"] = pm1;
33  event_value["pm2_5"] = pm2_5;
34  event_value["pm10"] = pm10;
35 
36  return device.sendEvent(eventMessage);
37 }
38 
39 #endif
AirQualityEventSource.
Definition: AirQualityEventSource.h:9
bool sendAirQualityEvent(int pm1=0, int pm2_5=0, int pm10=0, String cause="PERIODIC_POLL")
Sending air quality to SinricPro server.
Definition: AirQualityEventSource.h:26