SinricPro Library
MotionController.h
1 #ifndef _MOTIONCONTROLLER_H_
2 #define _MOTIONCONTROLLER_H_
3 
4 #include "./../SinricProDeviceInterface.h"
5 
11  public:
12  MotionController(SinricProDeviceInterface* device);
13 
14  bool sendMotionEvent(bool detected, String cause = "PHYSICAL_INTERACTION");
15 
16  private:
17  SinricProDeviceInterface *device;
18 };
19 
20 MotionController::MotionController(SinricProDeviceInterface *device) : device(device) {}
21 
31 bool MotionController::sendMotionEvent(bool state, String cause) {
32  DynamicJsonDocument eventMessage = device->prepareEvent("motion", cause.c_str());
33  JsonObject event_value = eventMessage["payload"]["value"];
34  event_value["state"] = state ? "detected" : "notDetected";
35  return device->sendEvent(eventMessage);
36 }
37 
38 #endif
MotionController
MotionController.
Definition: MotionController.h:10
MotionController::sendMotionEvent
bool sendMotionEvent(bool detected, String cause="PHYSICAL_INTERACTION")
Sending motion detection state to SinricPro server.
Definition: MotionController.h:31