ESPHome  2024.5.5
coolix_protocol.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/helpers.h"
5 #include "remote_base.h"
6 
7 #include <cinttypes>
8 
9 namespace esphome {
10 namespace remote_base {
11 
12 struct CoolixData {
14  CoolixData(uint32_t a) : first(a), second(a) {}
15  CoolixData(uint32_t a, uint32_t b) : first(a), second(b) {}
16  bool operator==(const CoolixData &other) const;
17  bool is_strict() const { return this->first == this->second; }
18  bool has_second() const { return this->second != 0; }
19  uint32_t first;
20  uint32_t second;
21 };
22 
23 class CoolixProtocol : public RemoteProtocol<CoolixData> {
24  public:
25  void encode(RemoteTransmitData *dst, const CoolixData &data) override;
26  optional<CoolixData> decode(RemoteReceiveData data) override;
27  void dump(const CoolixData &data) override;
28 };
29 
31 
32 template<typename... Ts> class CoolixAction : public RemoteTransmitterActionBase<Ts...> {
33  TEMPLATABLE_VALUE(uint32_t, first)
34  TEMPLATABLE_VALUE(uint32_t, second)
35  void encode(RemoteTransmitData *dst, Ts... x) override {
36  CoolixProtocol().encode(dst, {this->first_.value(x...), this->second_.value(x...)});
37  }
38 };
39 
40 } // namespace remote_base
41 } // namespace esphome
DECLARE_REMOTE_PROTOCOL(AEHA) template< typename... Ts > class AEHAAction
Definition: aeha_protocol.h:27
uint16_t x
Definition: tt21100.cpp:17
bool operator==(const CoolixData &other) const
CoolixData(uint32_t a, uint32_t b)
void encode(RemoteTransmitData *dst, const CoolixData &data) override
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7