ESPHome
2026.8.0b4
Loading...
Searching...
No Matches
esphome
components
hoermann_hcp
binary_sensor
hoermann_hcp_binary_sensor.cpp
Go to the documentation of this file.
1
#include "
hoermann_hcp_binary_sensor.h
"
2
3
#include "
esphome/core/log.h
"
4
5
namespace
esphome::hoermann_hcp
{
6
7
static
const
char
*
const
TAG =
"hoermann_hcp.binary_sensor"
;
8
9
void
HoermannHcpConnectedBinarySensor::setup
() {
10
// Publishing unconditionally is deliberate: the base class dedupes, and filters need every input to drive
11
// their timers.
12
this->
parent_
->
add_on_state_callback
([
this
]() { this->
publish_state
(this->
parent_
->
is_valid
()); });
13
this->
publish_initial_state
(this->
parent_
->
is_valid
());
14
}
15
16
void
HoermannHcpConnectedBinarySensor::dump_config
() { LOG_BINARY_SENSOR(
""
,
"Hoermann HCP Connected"
,
this
); }
17
18
}
// namespace esphome::hoermann_hcp
esphome::binary_sensor::BinarySensor::publish_state
void publish_state(bool new_state)
Publish a new state to the front-end.
Definition
binary_sensor.cpp:20
esphome::binary_sensor::BinarySensor::publish_initial_state
void publish_initial_state(bool new_state)
Publish the initial state, this will not make the callback manager send callbacks and is meant only f...
Definition
binary_sensor.cpp:31
esphome::hoermann_hcp::HoermannHcpConnectedBinarySensor::dump_config
void dump_config() override
Definition
hoermann_hcp_binary_sensor.cpp:16
esphome::hoermann_hcp::HoermannHcpConnectedBinarySensor::parent_
HoermannHcp *const parent_
Definition
hoermann_hcp_binary_sensor.h:17
esphome::hoermann_hcp::HoermannHcpConnectedBinarySensor::setup
void setup() override
Definition
hoermann_hcp_binary_sensor.cpp:9
esphome::hoermann_hcp::HoermannHcp::is_valid
bool is_valid() const
Definition
hoermann_hcp.h:63
esphome::hoermann_hcp::HoermannHcp::add_on_state_callback
void add_on_state_callback(F &&callback)
Definition
hoermann_hcp.h:42
hoermann_hcp_binary_sensor.h
log.h
esphome::hoermann_hcp
Definition
hoermann_hcp_binary_sensor.cpp:5
Generated by
1.12.0