ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
dooya_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
10struct DooyaData {
12 uint8_t channel;
13 uint8_t button;
14 uint8_t check;
15
16 bool operator==(const DooyaData &rhs) const {
17 return id == rhs.id && channel == rhs.channel && button == rhs.button && check == rhs.check;
18 }
19};
20
21class DooyaProtocol : public RemoteProtocol<DooyaData> {
22 public:
23 void encode(RemoteTransmitData *dst, const DooyaData &data) override;
24 optional<DooyaData> decode(RemoteReceiveData src) override;
25 void dump(const DooyaData &data) override;
26};
27
28DECLARE_REMOTE_PROTOCOL(Dooya)
29
30template<typename... Ts> class DooyaAction : public RemoteTransmitterActionBase<Ts...> {
31 public:
32 TEMPLATABLE_VALUE(uint32_t, id)
33 TEMPLATABLE_VALUE(uint8_t, channel)
34 TEMPLATABLE_VALUE(uint8_t, button)
35 TEMPLATABLE_VALUE(uint8_t, check)
36
37 void encode(RemoteTransmitData *dst, Ts... x) override {
38 DooyaData data{};
39 data.id = this->id_.value(x...);
40 data.channel = this->channel_.value(x...);
41 data.button = this->button_.value(x...);
42 data.check = this->check_.value(x...);
43 DooyaProtocol().encode(dst, data);
44 }
45};
46
47} // namespace esphome::remote_base
void encode(RemoteTransmitData *dst, const DooyaData &data) override
optional< DooyaData > decode(RemoteReceiveData src) override
void dump(const DooyaData &data) override
const void * src
Definition hal.h:64
static void uint32_t
bool operator==(const DooyaData &rhs) const
uint16_t x
Definition tt21100.cpp:5