mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
rmt_base additional minor changes (#5245)
This commit is contained in:
parent
e963eedb64
commit
b9e9223fdd
2 changed files with 5 additions and 17 deletions
|
@ -1488,10 +1488,7 @@ MideaData, MideaBinarySensor, MideaTrigger, MideaAction, MideaDumper = declare_p
|
||||||
MideaAction = ns.class_("MideaAction", RemoteTransmitterActionBase)
|
MideaAction = ns.class_("MideaAction", RemoteTransmitterActionBase)
|
||||||
MIDEA_SCHEMA = cv.Schema(
|
MIDEA_SCHEMA = cv.Schema(
|
||||||
{
|
{
|
||||||
cv.Required(CONF_CODE): cv.All(
|
cv.Required(CONF_CODE): cv.All([cv.hex_uint8_t], cv.Length(min=5, max=5)),
|
||||||
[cv.Any(cv.hex_uint8_t, cv.uint8_t)],
|
|
||||||
cv.Length(min=5, max=5),
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1511,15 +1508,10 @@ def midea_dumper(var, config):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@register_action(
|
@register_action("midea", MideaAction, MIDEA_SCHEMA)
|
||||||
"midea",
|
|
||||||
MideaAction,
|
|
||||||
MIDEA_SCHEMA,
|
|
||||||
)
|
|
||||||
async def midea_action(var, config, args):
|
async def midea_action(var, config, args):
|
||||||
template_ = await cg.templatable(
|
vec_ = cg.std_vector.template(cg.uint8)
|
||||||
config[CONF_CODE], args, cg.std_vector.template(cg.uint8)
|
template_ = await cg.templatable(config[CONF_CODE], args, vec_, vec_)
|
||||||
)
|
|
||||||
cg.add(var.set_code(template_))
|
cg.add(var.set_code(template_))
|
||||||
|
|
||||||
|
|
||||||
|
@ -1530,10 +1522,7 @@ AEHAData, AEHABinarySensor, AEHATrigger, AEHAAction, AEHADumper = declare_protoc
|
||||||
AEHA_SCHEMA = cv.Schema(
|
AEHA_SCHEMA = cv.Schema(
|
||||||
{
|
{
|
||||||
cv.Required(CONF_ADDRESS): cv.hex_uint16_t,
|
cv.Required(CONF_ADDRESS): cv.hex_uint16_t,
|
||||||
cv.Required(CONF_DATA): cv.All(
|
cv.Required(CONF_DATA): cv.All([cv.hex_uint8_t], cv.Length(min=2, max=35)),
|
||||||
[cv.Any(cv.hex_uint8_t, cv.uint8_t)],
|
|
||||||
cv.Length(min=2, max=35),
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,6 @@ using MideaDumper = RemoteReceiverDumper<MideaProtocol, MideaData>;
|
||||||
|
|
||||||
template<typename... Ts> class MideaAction : public RemoteTransmitterActionBase<Ts...> {
|
template<typename... Ts> class MideaAction : public RemoteTransmitterActionBase<Ts...> {
|
||||||
TEMPLATABLE_VALUE(std::vector<uint8_t>, code)
|
TEMPLATABLE_VALUE(std::vector<uint8_t>, code)
|
||||||
void set_code(std::initializer_list<uint8_t> code) { this->code_ = code; }
|
|
||||||
|
|
||||||
void encode(RemoteTransmitData *dst, Ts... x) override {
|
void encode(RemoteTransmitData *dst, Ts... x) override {
|
||||||
MideaData data(this->code_.value(x...));
|
MideaData data(this->code_.value(x...));
|
||||||
|
|
Loading…
Reference in a new issue