SinricPro Library
SinricProDoorbell.h
1 /*
2  * Copyright (c) 2019 Sinric. All rights reserved.
3  * Licensed under Creative Commons Attribution-Share Alike (CC BY-SA)
4  *
5  * This file is part of the Sinric Pro (https://github.com/sinricpro/)
6  */
7 
8 #ifndef _SINRICDOORBELL_H_
9 #define _SINRICDOORBELL_H_
10 
11 #include "SinricProDevice.h"
12 
18  public:
19  SinricProDoorbell(const char* deviceId, unsigned long eventWaitTime=100);
20  // event
21  bool sendDoorbellEvent(String cause = "PHYSICAL_INTERACTION");
22  private:
23 };
24 
25 SinricProDoorbell::SinricProDoorbell(const char* deviceId, unsigned long eventWaitTime) : SinricProDevice(deviceId, eventWaitTime) {}
26 
36  DynamicJsonDocument eventMessage = prepareEvent(deviceId, "DoorbellPress", cause.c_str());
37  JsonObject event_value = eventMessage["payload"]["value"];
38  event_value["state"] = "pressed";
39  return sendEvent(eventMessage);
40 }
41 
42 #endif
43 
SinricProDoorbell
Device to report doorbell events.
Definition: SinricProDoorbell.h:17
SinricProDoorbell::sendDoorbellEvent
bool sendDoorbellEvent(String cause="PHYSICAL_INTERACTION")
Send Doorbell event to SinricPro Server indicating someone pressed the doorbell button.
Definition: SinricProDoorbell.h:35
SinricProDevice
Base class for all device types.
Definition: SinricProDevice.h:23