6static const char *
const TAG =
"template.water_heater";
15 if (restore.has_value()) {
20 !this->mode_f_.has_value() && !this->away_f_.has_value() && !this->is_on_f_.has_value())
48 if (curr_temp.has_value()) {
56 if (target_temp.has_value()) {
64 if (new_mode.has_value()) {
65 if (*new_mode != this->
mode_) {
66 this->
mode_ = *new_mode;
72 if (away.has_value()) {
80 if (
is_on.has_value()) {
93 LOG_WATER_HEATER(
"",
"Template Water Heater",
this);
94 ESP_LOGCONFIG(TAG,
" Optimistic: %s", YESNO(this->
optimistic_));
104 if (
call.get_mode().has_value()) {
109 if (!std::isnan(
call.get_target_temperature())) {
115 if (
call.get_away().has_value()) {
120 if (
call.get_on().has_value()) {
void disable_loop()
Disable this component's loop.
constexpr bool empty() const
Check if the set is empty.
optional< T > call(Args &&...args)
Alias for operator() for compatibility.
bool has_value() const
Check if a lambda is set.
void trigger(const Ts &...x)
Inform the parent automation that the event has triggered.
TemplateWaterHeaterRestoreMode restore_mode_
void control(const water_heater::WaterHeaterCall &call) override
water_heater::WaterHeaterCallInternal make_call() override
TemplateLambda< float > target_temperature_f_
water_heater::WaterHeaterTraits traits() override
TemplateLambda< bool > away_f_
float get_setup_priority() const override
TemplateLambda< bool > is_on_f_
void dump_config() override
TemplateLambda< float > current_temperature_f_
TemplateLambda< water_heater::WaterHeaterMode > mode_f_
water_heater::WaterHeaterModeMask supported_modes_
optional< bool > get_away() const
optional< bool > get_on() const
const optional< WaterHeaterMode > & get_mode() const
float get_target_temperature() const
virtual void publish_state()
void set_state_flag_(uint32_t flag, bool value)
Set or clear a state flag. Should only be called from control().
optional< WaterHeaterCall > restore_state_()
Restore the state of the water heater, call this from your setup() method.
bool is_on() const
Check if the water heater is on.
bool is_away() const
Check if away mode is currently active.
float target_temperature_
float current_temperature_
void set_supported_modes(WaterHeaterModeMask modes)
void add_feature_flags(uint32_t flags)
Get/set feature flags (see WaterHeaterFeature enum)
void set_supports_current_temperature(bool supports)
void set_supports_away_mode(bool supports)
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
@ WATER_HEATER_RESTORE_AND_CALL
@ WATER_HEATER_STATE_ON
Water heater is on (not in standby)
@ WATER_HEATER_STATE_AWAY
Away/vacation mode is currently active.
@ WATER_HEATER_SUPPORTS_TARGET_TEMPERATURE
The water heater supports a target temperature.
@ WATER_HEATER_SUPPORTS_ON_OFF
The water heater can be turned on/off.