ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
ira211_protocol.h
Go to the documentation of this file.
1#pragma once
2
3#include "remote_base.h"
5
6#include <cmath>
7
8namespace esphome::remote_base {
9
10/* Siemens IRA211 thermostat remote: 38 kHz carrier, NRZ runs of 800 us bits after a fixed preamble.
11 A frame is 4, 5 or 7 ten-bit packets (start bit 1, 8 data bits, end bit 0): device ID, command,
12 the command's fields, then a checksum. Field bytes go over the wire as reverse_bits(~value). */
13
22
23enum class IRA211Mode : uint8_t {
27};
28
29enum class IRA211Fan : uint8_t {
31 IRA211_FAN_LOW = 12,
33 IRA211_FAN_HIGH = 192,
34};
35
36static constexpr float IRA211_MIN_TEMPERATURE = 5.0f;
37static constexpr float IRA211_MAX_TEMPERATURE = 35.0f;
38
39struct IRA211Data {
41 uint8_t half_degrees{40}; // target temperature in 0.5 C steps
44
45 float get_temperature() const { return this->half_degrees * 0.5f; }
48 this->half_degrees =
49 static_cast<uint8_t>(lroundf(clamp(temperature, IRA211_MIN_TEMPERATURE, IRA211_MAX_TEMPERATURE) * 2.0f));
50 }
51
53 bool operator==(const IRA211Data &rhs) const;
54};
55
56class IRA211Protocol : public RemoteProtocol<IRA211Data> {
57 public:
58 void encode(RemoteTransmitData *dst, const IRA211Data &data);
59 optional<IRA211Data> decode(RemoteReceiveData src);
60 void dump(const IRA211Data &data);
61};
62
63DECLARE_REMOTE_PROTOCOL(IRA211)
64
65} // namespace esphome::remote_base
optional< IRA211Data > decode(RemoteReceiveData src)
void encode(RemoteTransmitData *dst, const IRA211Data &data)
void dump(const IRA211Data &data)
const void * src
Definition hal.h:68
void set_temperature(float temperature)
Rounds to the nearest half degree and clamps to the 5 to 35 C range the thermostat accepts.
bool operator==(const IRA211Data &rhs) const
Compares the command and only the fields that command carries.
uint16_t temperature
Definition sun_gtil2.cpp:12