ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
number.cpp
Go to the documentation of this file.
1#include "number.h"
2
3#include <cmath>
4
5namespace esphome::duco {
6
7static constexpr uint8_t PARAMETER_COMFORT_TEMPERATURE = 0x12;
8static constexpr uint8_t GROUP_COMFORT_TEMPERATURE = 0x0a;
9
11 this->parent_->send(this, FUNCTION_PARAMETER, {0x00, PARAMETER_COMFORT_TEMPERATURE, GROUP_COMFORT_TEMPERATURE});
12}
13
15 // Reads and writes get the same answer: one byte in tenths of a degree, below 10.0 is invalid
16 if (message.size >= 4 && message.data[3] >= 100)
17 this->publish_state(message.data[3] / 10.0f);
18}
19
21 const auto tenths = static_cast<uint8_t>(lroundf(value * 10.0f));
22 this->parent_->send(this, FUNCTION_PARAMETER,
23 {0x01, PARAMETER_COMFORT_TEMPERATURE, GROUP_COMFORT_TEMPERATURE, tenths, 0x00, 0x00, 0x00});
24}
25
26} // namespace esphome::duco
void receive_response(const DucoMessage &message) override
Definition number.cpp:14
void control(float value) override
Definition number.cpp:20
void publish_state(float state)
Definition number.cpp:20
const LogString * message
Definition component.cpp:35
A received message; data points into the receive buffer and is valid only during the callback.
Definition duco.h:22
const uint8_t * data
Definition duco.h:24