rmt_base additional minor changes (#5245)

This commit is contained in:
Sergey Dudanov 2023-08-14 23:21:22 +04:00 committed by GitHub
parent e963eedb64
commit b9e9223fdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 17 deletions

View File

@ -1488,10 +1488,7 @@ MideaData, MideaBinarySensor, MideaTrigger, MideaAction, MideaDumper = declare_p
MideaAction = ns.class_("MideaAction", RemoteTransmitterActionBase)
MIDEA_SCHEMA = cv.Schema(
{
cv.Required(CONF_CODE): cv.All(
[cv.Any(cv.hex_uint8_t, cv.uint8_t)],
cv.Length(min=5, max=5),
),
cv.Required(CONF_CODE): cv.All([cv.hex_uint8_t], cv.Length(min=5, max=5)),
}
)
@ -1511,15 +1508,10 @@ def midea_dumper(var, config):
pass
@register_action(
"midea",
MideaAction,
MIDEA_SCHEMA,
)
@register_action("midea", MideaAction, MIDEA_SCHEMA)
async def midea_action(var, config, args):
template_ = await cg.templatable(
config[CONF_CODE], args, cg.std_vector.template(cg.uint8)
)
vec_ = cg.std_vector.template(cg.uint8)
template_ = await cg.templatable(config[CONF_CODE], args, vec_, vec_)
cg.add(var.set_code(template_))
@ -1530,10 +1522,7 @@ AEHAData, AEHABinarySensor, AEHATrigger, AEHAAction, AEHADumper = declare_protoc
AEHA_SCHEMA = cv.Schema(
{
cv.Required(CONF_ADDRESS): cv.hex_uint16_t,
cv.Required(CONF_DATA): cv.All(
[cv.Any(cv.hex_uint8_t, cv.uint8_t)],
cv.Length(min=2, max=35),
),
cv.Required(CONF_DATA): cv.All([cv.hex_uint8_t], cv.Length(min=2, max=35)),
}
)

View File

@ -84,7 +84,6 @@ using MideaDumper = RemoteReceiverDumper<MideaProtocol, MideaData>;
template<typename... Ts> class MideaAction : public RemoteTransmitterActionBase<Ts...> {
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 {
MideaData data(this->code_.value(x...));