ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
drayton_protocol.h
Go to the documentation of this file.
1#pragma once
2
4#include "remote_base.h"
5
6#include <cinttypes>
7
8namespace esphome::remote_base {
9
11 uint16_t address;
12 uint8_t channel;
13 uint8_t command;
14
15 bool operator==(const DraytonData &rhs) const {
16 return address == rhs.address && channel == rhs.channel && command == rhs.command;
17 }
18};
19
20class DraytonProtocol : public RemoteProtocol<DraytonData> {
21 public:
22 void encode(RemoteTransmitData *dst, const DraytonData &data) override;
23 optional<DraytonData> decode(RemoteReceiveData src) override;
24 void dump(const DraytonData &data) override;
25};
26
27DECLARE_REMOTE_PROTOCOL(Drayton)
28
29template<typename... Ts> class DraytonAction : public RemoteTransmitterActionBase<Ts...> {
30 public:
31 TEMPLATABLE_VALUE(uint16_t, address)
32 TEMPLATABLE_VALUE(uint8_t, channel)
33 TEMPLATABLE_VALUE(uint8_t, command)
34
35 void encode(RemoteTransmitData *dst, Ts... x) override {
36 DraytonData data{};
37 data.address = this->address_.value(x...);
38 data.channel = this->channel_.value(x...);
39 data.command = this->command_.value(x...);
40 DraytonProtocol().encode(dst, data);
41 }
42};
43
44} // namespace esphome::remote_base
uint8_t address
Definition bl0906.h:4
optional< DraytonData > decode(RemoteReceiveData src) override
void encode(RemoteTransmitData *dst, const DraytonData &data) override
void dump(const DraytonData &data) override
const void * src
Definition hal.h:64
bool operator==(const DraytonData &rhs) const
uint16_t x
Definition tt21100.cpp:5