ESPHome 2026.11.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
26 protected:
27 void process_motion_data_(const MotionData &data);
28
32 static bool is_stationary(const MotionData &data);
33
35 float threshold_{0.0f};
37
38 // Tracking states
41
42 // For derivative/variance tracking
43 float last_accel_[3]{NAN, NAN, NAN};
44 float last_gyro_[3]{NAN, NAN, NAN};
45
48};
49
50} // 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(MotionComponent *parent, MotionBinarySensorType type)
void process_motion_data_(const MotionData &data)
uint8_t type
uint8_t duration
Definition msa3xx.h:0
static void uint32_t