diff --git a/esphome/components/hx711/hx711_automations.h b/esphome/components/hx711/hx711_automations.h index 5b3fb00951..ac4785c8a9 100644 --- a/esphome/components/hx711/hx711_automations.h +++ b/esphome/components/hx711/hx711_automations.h @@ -16,12 +16,20 @@ template class HX711SensorActionBase : public Action { template class PowerUpAction : public HX711SensorActionBase { public: - void play(Ts... x) override { this->parent_->power_up(); } + void play(Ts... x) override { + if (!this->parent_->is_ready()) + return; + this->parent_->power_up(); + } }; template class PowerDownAction : public HX711SensorActionBase { public: - void play(Ts... x) override { this->parent_->power_down(); } + void play(Ts... x) override { + if (!this->parent_->is_ready()) + return; + this->parent_->power_down(); + } }; } // namespace hx711