ESPHome
2026.11.0b6
Loading...
Searching...
No Matches
esphome
components
ld2420
binary_sensor
ld2420_binary_sensor.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
../ld2420.h
"
4
#include "
esphome/components/binary_sensor/binary_sensor.h
"
5
6
namespace
esphome::ld2420
{
7
8
class
LD2420BinarySensor
final :
public
LD2420Listener
,
public
Component
,
public
binary_sensor::BinarySensor
{
9
public
:
10
void
dump_config
()
override
;
11
SUB_BINARY_SENSOR
(presence)
12
void
on_presence
(
bool
presence)
override
{
13
if
(this->presence_binary_sensor_ !=
nullptr
) {
14
if
(this->presence_binary_sensor_->state != presence)
15
this->presence_binary_sensor_->publish_state(presence);
16
}
17
}
18
};
19
20
}
// namespace esphome::ld2420
binary_sensor.h
esphome::Component
Definition
component.h:147
esphome::binary_sensor::BinarySensor
Base class for all binary_sensor-type classes.
Definition
binary_sensor.h:33
esphome::ld2420::LD2420BinarySensor
Definition
ld2420_binary_sensor.h:8
esphome::ld2420::LD2420BinarySensor::dump_config
void dump_config() override
Definition
ld2420_binary_sensor.cpp:9
esphome::ld2420::LD2420BinarySensor::SUB_BINARY_SENSOR
SUB_BINARY_SENSOR(presence) void on_presence(bool presence) override
Definition
ld2420_binary_sensor.h:11
esphome::ld2420::LD2420Listener
Definition
ld2420.h:40
esphome::ld2420::LD2420Listener::on_presence
virtual void on_presence(bool presence)
Definition
ld2420.h:42
ld2420.h
esphome::ld2420
Definition
ld2420_binary_sensor.cpp:5
Generated by
1.12.0