3 #include "../EventLimiter.h"
4 #include "../SinricProStrings.h"
6 #include "../SinricProNamespace.h"
7 namespace SINRICPRO_NAMESPACE {
11 FSTR(MOTION, detected);
12 FSTR(MOTION, notDetected);
22 bool sendMotionEvent(
bool detected, String cause = FSTR_SINRICPRO_PHYSICAL_INTERACTION);
24 EventLimiter event_limiter;
29 : event_limiter(EVENT_LIMIT_SENSOR_STATE) {}
42 if (event_limiter)
return false;
43 T* device =
static_cast<T*
>(
this);
45 JsonDocument eventMessage = device->prepareEvent(FSTR_MOTION_motion, cause.c_str());
46 JsonObject event_value = eventMessage[FSTR_SINRICPRO_payload][FSTR_SINRICPRO_value];
47 event_value[FSTR_MOTION_state] = detected ? FSTR_MOTION_detected : FSTR_MOTION_notDetected;
48 return device->sendEvent(eventMessage);
54 using MotionSensor = SINRICPRO_NAMESPACE::MotionSensor<T>;
MotionSensor.
Definition: MotionSensor.h:19
bool sendMotionEvent(bool detected, String cause=FSTR_SINRICPRO_PHYSICAL_INTERACTION)
Sending motion detection state to SinricPro server.
Definition: MotionSensor.h:41