ESPHome
2026.11.0-dev
Loading...
Searching...
No Matches
esphome
components
duco
text_sensor
serial.cpp
Go to the documentation of this file.
1
#include "
serial.h
"
2
3
#include <cstring>
4
5
namespace
esphome::duco
{
6
7
void
DucoSerial::update
() { this->
parent_
->send(
this
, FUNCTION_NODE_DATA, {0x01, 0x01, 0x00, 0x1a, 0x10}); }
8
9
void
DucoSerial::receive_response
(
const
DucoMessage
&
message
) {
10
if
(
message
.size > 2) {
11
// The serial number starts at byte 2 and is padded with zeros
12
const
char
*serial =
reinterpret_cast<
const
char
*
>
(
message
.data + 2);
13
this->
publish_state
(serial, strnlen(serial,
message
.size - 2));
14
}
15
}
16
17
}
// namespace esphome::duco
esphome::Parented< Duco >::parent_
Duco * parent_
Definition
helpers.h:2084
esphome::duco::DucoSerial::update
void update() override
Definition
serial.cpp:7
esphome::duco::DucoSerial::receive_response
void receive_response(const DucoMessage &message) override
Definition
serial.cpp:9
esphome::text_sensor::TextSensor::publish_state
void publish_state(const std::string &state)
Definition
text_sensor.h:42
message
const LogString * message
Definition
component.cpp:35
esphome::duco
Definition
duco.cpp:6
serial.h
esphome::duco::DucoMessage
A received message; data points into the receive buffer and is valid only during the callback.
Definition
duco.h:22
Generated by
1.12.0