mirror of
https://github.com/esphome/esphome.git
synced 2024-11-21 22:48:10 +01:00
Add carrier_frequency option to remote_transmitter.transmit_aeha (#6792)
This commit is contained in:
parent
594856899a
commit
f36a96c8e2
5 changed files with 17 additions and 2 deletions
|
@ -1769,7 +1769,17 @@ def aeha_dumper(var, config):
|
||||||
pass
|
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):
|
async def aeha_action(var, config, args):
|
||||||
template_ = await cg.templatable(config[CONF_ADDRESS], args, cg.uint16)
|
template_ = await cg.templatable(config[CONF_ADDRESS], args, cg.uint16)
|
||||||
cg.add(var.set_address(template_))
|
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)
|
config[CONF_DATA], args, cg.std_vector.template(cg.uint8)
|
||||||
)
|
)
|
||||||
cg.add(var.set_data(template_))
|
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
|
# Haier
|
||||||
|
|
|
@ -16,7 +16,6 @@ static const uint16_t BIT_ZERO_LOW_US = BITWISE;
|
||||||
static const uint16_t TRAILER = BITWISE;
|
static const uint16_t TRAILER = BITWISE;
|
||||||
|
|
||||||
void AEHAProtocol::encode(RemoteTransmitData *dst, const AEHAData &data) {
|
void AEHAProtocol::encode(RemoteTransmitData *dst, const AEHAData &data) {
|
||||||
dst->set_carrier_frequency(38000);
|
|
||||||
dst->reserve(2 + 32 + (data.data.size() * 2) + 1);
|
dst->reserve(2 + 32 + (data.data.size() * 2) + 1);
|
||||||
|
|
||||||
dst->item(HEADER_HIGH_US, HEADER_LOW_US);
|
dst->item(HEADER_HIGH_US, HEADER_LOW_US);
|
||||||
|
|
|
@ -30,12 +30,14 @@ template<typename... Ts> class AEHAAction : public RemoteTransmitterActionBase<T
|
||||||
public:
|
public:
|
||||||
TEMPLATABLE_VALUE(uint16_t, address)
|
TEMPLATABLE_VALUE(uint16_t, address)
|
||||||
TEMPLATABLE_VALUE(std::vector<uint8_t>, data)
|
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 set_data(const std::vector<uint8_t> &data) { data_ = data; }
|
||||||
void encode(RemoteTransmitData *dst, Ts... x) override {
|
void encode(RemoteTransmitData *dst, Ts... x) override {
|
||||||
AEHAData data{};
|
AEHAData data{};
|
||||||
data.address = this->address_.value(x...);
|
data.address = this->address_.value(x...);
|
||||||
data.data = this->data_.value(x...);
|
data.data = this->data_.value(x...);
|
||||||
|
dst->set_carrier_frequency(this->carrier_frequency_.value(x...));
|
||||||
AEHAProtocol().encode(dst, data);
|
AEHAProtocol().encode(dst, data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -118,6 +118,7 @@ button:
|
||||||
on_press:
|
on_press:
|
||||||
remote_transmitter.transmit_aeha:
|
remote_transmitter.transmit_aeha:
|
||||||
address: 0x8008
|
address: 0x8008
|
||||||
|
carrier_frequency: 36700Hz
|
||||||
data:
|
data:
|
||||||
[
|
[
|
||||||
0x00,
|
0x00,
|
||||||
|
|
|
@ -2906,6 +2906,7 @@ switch:
|
||||||
turn_on_action:
|
turn_on_action:
|
||||||
remote_transmitter.transmit_aeha:
|
remote_transmitter.transmit_aeha:
|
||||||
address: 0x8008
|
address: 0x8008
|
||||||
|
carrier_frequency: 36700Hz
|
||||||
data:
|
data:
|
||||||
[
|
[
|
||||||
0x00,
|
0x00,
|
||||||
|
|
Loading…
Reference in a new issue