ESPHome 2025.5.0
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 {
9namespace remote_base {
10
11struct DooyaData {
12 uint32_t id;
13 uint8_t channel;
14 uint8_t button;
15 uint8_t check;
16
17 bool operator==(const DooyaData &rhs) const {
18 return id == rhs.id && channel == rhs.channel && button == rhs.button && check == rhs.check;
19 }
20};
21
22class DooyaProtocol : public RemoteProtocol<DooyaData> {
23 public:
24 void encode(RemoteTransmitData *dst, const DooyaData &data) override;
26 void dump(const DooyaData &data) override;
27};
28
29DECLARE_REMOTE_PROTOCOL(Dooya)
30
31template<typename... Ts> class DooyaAction : public RemoteTransmitterActionBase<Ts...> {
32 public:
33 TEMPLATABLE_VALUE(uint32_t, id)
34 TEMPLATABLE_VALUE(uint8_t, channel)
35 TEMPLATABLE_VALUE(uint8_t, button)
36 TEMPLATABLE_VALUE(uint8_t, check)
37
38 void encode(RemoteTransmitData *dst, Ts... x) override {
39 DooyaData data{};
40 data.id = this->id_.value(x...);
41 data.channel = this->channel_.value(x...);
42 data.button = this->button_.value(x...);
43 data.check = this->check_.value(x...);
44 DooyaProtocol().encode(dst, data);
45 }
46};
47
48} // namespace remote_base
49} // namespace esphome
void encode(RemoteTransmitData *dst, const DooyaData &data) override
optional< DooyaData > decode(RemoteReceiveData src) override
void dump(const DooyaData &data) override
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
bool operator==(const DooyaData &rhs) const
uint16_t x
Definition tt21100.cpp:5