ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
motion_event.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::motion {
8
9class MotionEvent : public Component, public event::Event {
10 public:
11 explicit MotionEvent(MotionComponent *parent);
12
13 void setup() override;
14 void dump_config() override;
15
16 void set_threshold(float threshold) { this->threshold_ = threshold; }
17 void set_cooldown(uint32_t cooldown) { this->cooldown_ = cooldown; }
18
19 protected:
20 void process_motion_data_(const MotionData &data);
21
23 float threshold_{0.5f};
25
26 // State tracking for shake detection
28 float last_accel_[3]{NAN, NAN, NAN};
29};
30
31} // namespace esphome::motion
void process_motion_data_(const MotionData &data)
void set_threshold(float threshold)
void set_cooldown(uint32_t cooldown)
MotionEvent(MotionComponent *parent)
MotionComponent * parent_
static void uint32_t