#pragma once #include "remote_base.h" #include namespace esphome { namespace remote_base { struct AEHAData { uint16_t address; std::vector data; bool operator==(const AEHAData &rhs) const { return address == rhs.address && data == rhs.data; } }; class AEHAProtocol : public RemoteProtocol { public: void encode(RemoteTransmitData *dst, const AEHAData &data) override; optional decode(RemoteReceiveData src) override; void dump(const AEHAData &data) override; private: std::string format_data_(const std::vector &data); }; DECLARE_REMOTE_PROTOCOL(AEHA) template class AEHAAction : public RemoteTransmitterActionBase { public: TEMPLATABLE_VALUE(uint16_t, address) TEMPLATABLE_VALUE(std::vector, data) TEMPLATABLE_VALUE(uint32_t, carrier_frequency); void set_data(const std::vector &data) { data_ = data; } void encode(RemoteTransmitData *dst, Ts... x) override { AEHAData data{}; data.address = this->address_.value(x...); data.data = this->data_.value(x...); dst->set_carrier_frequency(this->carrier_frequency_.value(x...)); AEHAProtocol().encode(dst, data); } }; } // namespace remote_base } // namespace esphome