mirror of
https://github.com/esphome/esphome.git
synced 2026-09-17 18:18:43 +00:00
[template] Use a user provided default constructor for TemplateTextSensor (#19126)
This commit is contained in:
@@ -9,6 +9,8 @@ namespace esphome::template_ {
|
||||
|
||||
class TemplateTextSensor final : public text_sensor::TextSensor, public PollingComponent {
|
||||
public:
|
||||
// User provided, not "= default": `new(p) TemplateTextSensor()` would zero-fill .bss that is already zero.
|
||||
TemplateTextSensor() {}
|
||||
template<typename F> void set_template(F &&f) { this->f_.set(std::forward<F>(f)); }
|
||||
|
||||
void update() override;
|
||||
|
||||
Reference in New Issue
Block a user