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 DeviceId &deviceId);
20  String getProductType() { return SinricProDevice::getProductType() + String("DOORBELL"); }
21  // event
22  bool sendDoorbellEvent(String cause = "PHYSICAL_INTERACTION");
23  private:
24 };
25 
26 SinricProDoorbell::SinricProDoorbell(const DeviceId &deviceId) : SinricProDevice(deviceId) {}
27 
37  DynamicJsonDocument eventMessage = prepareEvent(deviceId, "DoorbellPress", cause.c_str());
38  JsonObject event_value = eventMessage["payload"]["value"];
39  event_value["state"] = "pressed";
40  return sendEvent(eventMessage);
41 }
42 
43 #endif
44 
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:36
SinricProDevice
Base class for all device types.
Definition: SinricProDevice.h:24