SinricPro Library
Doorbell.h
1 #ifndef _DOORBELL_H_
2 #define _DOORBELL_H_
3 
8 template <typename T>
9 class Doorbell {
10  public:
11  bool sendDoorbellEvent(String cause = "PHYSICAL_INTERACTION");
12 };
13 
22 template <typename T>
23 bool Doorbell<T>::sendDoorbellEvent(String cause) {
24  T& device = static_cast<T&>(*this);
25 
26  DynamicJsonDocument eventMessage = device.prepareEvent("DoorbellPress", cause.c_str());
27  JsonObject event_value = eventMessage["payload"]["value"];
28  event_value["state"] = "pressed";
29  return device.sendEvent(eventMessage);
30 }
31 
32 #endif
Dorbell.
Definition: Doorbell.h:9
bool sendDoorbellEvent(String cause="PHYSICAL_INTERACTION")
Send Doorbell event to SinricPro Server indicating someone pressed the doorbell button.
Definition: Doorbell.h:23