ESPHome 2026.5.0b1
Loading...
Searching...
No Matches
nexa_protocol.h
Go to the documentation of this file.
1#pragma once
2
3#include "remote_base.h"
4
5#include <cinttypes>
6
7namespace esphome::remote_base {
8
9struct NexaData {
11 uint8_t group;
12 uint8_t state;
13 uint8_t channel;
14 uint8_t level;
15 bool operator==(const NexaData &rhs) const {
16 return device == rhs.device && group == rhs.group && state == rhs.state && channel == rhs.channel &&
17 level == rhs.level;
18 }
19};
20
21class NexaProtocol : public RemoteProtocol<NexaData> {
22 public:
23 void one(RemoteTransmitData *dst) const;
24 void zero(RemoteTransmitData *dst) const;
25 void sync(RemoteTransmitData *dst) const;
26
27 void encode(RemoteTransmitData *dst, const NexaData &data) override;
28 optional<NexaData> decode(RemoteReceiveData src) override;
29 void dump(const NexaData &data) override;
30};
31
32DECLARE_REMOTE_PROTOCOL(Nexa)
33
34template<typename... Ts> class NexaAction : public RemoteTransmitterActionBase<Ts...> {
35 public:
36 TEMPLATABLE_VALUE(uint32_t, device)
37 TEMPLATABLE_VALUE(uint8_t, group)
38 TEMPLATABLE_VALUE(uint8_t, state)
39 TEMPLATABLE_VALUE(uint8_t, channel)
40 TEMPLATABLE_VALUE(uint8_t, level)
41 void encode(RemoteTransmitData *dst, Ts... x) override {
42 NexaData data{};
43 data.device = this->device_.value(x...);
44 data.group = this->group_.value(x...);
45 data.state = this->state_.value(x...);
46 data.channel = this->channel_.value(x...);
47 data.level = this->level_.value(x...);
48 NexaProtocol().encode(dst, data);
49 }
50};
51
52} // namespace esphome::remote_base
void dump(const NexaData &data) override
void zero(RemoteTransmitData *dst) const
void encode(RemoteTransmitData *dst, const NexaData &data) override
void one(RemoteTransmitData *dst) const
optional< NexaData > decode(RemoteReceiveData src) override
bool state
Definition fan.h:2
static void uint32_t
bool operator==(const NexaData &rhs) const
uint16_t sync
Definition sun_gtil2.cpp:0
uint16_t x
Definition tt21100.cpp:5