ESPHome 2026.12.0-dev
Loading...
Searching...
No Matches
motion_binary_sensor.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::motion {
8
15
17 public:
19
20 void setup() override;
21 void dump_config() override;
22
23 void set_threshold(float threshold) { this->threshold_ = threshold; }
25 void process_motion_data(const MotionData &data);
26
27 protected:
31 static bool is_stationary(const MotionData &data);
32
33 float threshold_{0.0f};
35
36 // Tracking states
39
40 // For derivative/variance tracking
41 float last_accel_[3]{NAN, NAN, NAN};
42 float last_gyro_[3]{NAN, NAN, NAN};
43
46};
47
48} // namespace esphome::motion
Base class for all binary_sensor-type classes.
static bool is_stationary(const MotionData &data)
True when the device is at rest: total acceleration is close to 1g and (if a gyroscope is present) th...
MotionBinarySensor(MotionBinarySensorType type)
void process_motion_data(const MotionData &data)
uint8_t type
uint8_t duration
Definition msa3xx.h:0
static void uint32_t