Add carrier_frequency option to remote_transmitter.transmit_aeha (#6792)

This commit is contained in:
svxa 2024-06-05 09:35:19 +02:00 committed by GitHub
parent 594856899a
commit f36a96c8e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 17 additions and 2 deletions

View File

@ -1769,7 +1769,17 @@ def aeha_dumper(var, config):
pass
@register_action("aeha", AEHAAction, AEHA_SCHEMA)
@register_action(
"aeha",
AEHAAction,
AEHA_SCHEMA.extend(
{
cv.Optional(CONF_CARRIER_FREQUENCY, default="38000Hz"): cv.All(
cv.frequency, cv.int_
),
}
),
)
async def aeha_action(var, config, args):
template_ = await cg.templatable(config[CONF_ADDRESS], args, cg.uint16)
cg.add(var.set_address(template_))
@ -1777,6 +1787,8 @@ async def aeha_action(var, config, args):
config[CONF_DATA], args, cg.std_vector.template(cg.uint8)
)
cg.add(var.set_data(template_))
templ = await cg.templatable(config[CONF_CARRIER_FREQUENCY], args, cg.uint32)
cg.add(var.set_carrier_frequency(templ))
# Haier

View File

@ -16,7 +16,6 @@ static const uint16_t BIT_ZERO_LOW_US = BITWISE;
static const uint16_t TRAILER = BITWISE;
void AEHAProtocol::encode(RemoteTransmitData *dst, const AEHAData &data) {
dst->set_carrier_frequency(38000);
dst->reserve(2 + 32 + (data.data.size() * 2) + 1);
dst->item(HEADER_HIGH_US, HEADER_LOW_US);

View File

@ -30,12 +30,14 @@ template<typename... Ts> class AEHAAction : public RemoteTransmitterActionBase<T
public:
TEMPLATABLE_VALUE(uint16_t, address)
TEMPLATABLE_VALUE(std::vector<uint8_t>, data)
TEMPLATABLE_VALUE(uint32_t, carrier_frequency);
void set_data(const std::vector<uint8_t> &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);
}
};

View File

@ -118,6 +118,7 @@ button:
on_press:
remote_transmitter.transmit_aeha:
address: 0x8008
carrier_frequency: 36700Hz
data:
[
0x00,

View File

@ -2906,6 +2906,7 @@ switch:
turn_on_action:
remote_transmitter.transmit_aeha:
address: 0x8008
carrier_frequency: 36700Hz
data:
[
0x00,