mirror of
https://github.com/GrKoR/esphome_aux_ac_component.git
synced 2025-12-10 13:36:58 +03:00
вернул action для инженеров
This commit is contained in:
@@ -17,7 +17,7 @@ namespace aux_ac {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
AirCon *ac_;
|
AirCon *ac_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename... Ts>
|
template <typename... Ts>
|
||||||
class AirConDisplayOnAction : public Action<Ts...>
|
class AirConDisplayOnAction : public Action<Ts...>
|
||||||
@@ -29,7 +29,37 @@ namespace aux_ac {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
AirCon *ac_;
|
AirCon *ac_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename... Ts>
|
||||||
|
class AirConSendTestPacketAction : public Action<Ts...>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit AirConSendTestPacketAction(AirCon *ac) : ac_(ac) {}
|
||||||
|
void set_data_template(std::function<std::vector<uint8_t>(Ts...)> func) {
|
||||||
|
this->data_func_ = func;
|
||||||
|
this->static_ = false;
|
||||||
|
}
|
||||||
|
void set_data_static(const std::vector<uint8_t> &data) {
|
||||||
|
this->data_static_ = data;
|
||||||
|
this->static_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void play(Ts... x) override {
|
||||||
|
if (this->static_) {
|
||||||
|
this->ac_->sendTestPacket(this->data_static_);
|
||||||
|
} else {
|
||||||
|
auto val = this->data_func_(x...);
|
||||||
|
this->ac_->sendTestPacket(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
AirCon *ac_;
|
||||||
|
bool static_{false};
|
||||||
|
std::function<std::vector<uint8_t>(Ts...)> data_func_{};
|
||||||
|
std::vector<uint8_t> data_static_{};
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace aux_ac
|
} // namespace aux_ac
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
Reference in New Issue
Block a user