10static const char *
const TAG =
"water_heater";
65 this->
state_ &= ~WATER_HEATER_STATE_AWAY;
74 this->
state_ &= ~WATER_HEATER_STATE_ON;
95 ESP_LOGD(TAG,
" Away: YES");
98 ESP_LOGD(TAG,
" On: YES");
106 if (!traits.supports_mode(*this->mode_)) {
112 if (traits.get_supports_two_point_target_temperature()) {
113 ESP_LOGW(TAG,
"'%s' - Cannot set target temperature for device with two-point target temperature",
117 this->target_temperature_ > traits.get_max_temperature()) {
118 ESP_LOGW(TAG,
"'%s' - Target temperature %.1f is out of range [%.1f - %.1f]", this->
parent_->
get_name().
c_str(),
119 this->target_temperature_, traits.get_min_temperature(), traits.get_max_temperature());
121 std::max(traits.get_min_temperature(), std::min(this->target_temperature_, traits.get_max_temperature()));
125 if (!traits.get_supports_two_point_target_temperature()) {
126 ESP_LOGW(TAG,
"'%s' - Cannot set low/high target temperature", this->
parent_->
get_name().
c_str());
133 ESP_LOGW(TAG,
"'%s' - Target temperature low %.2f must be less than high %.2f", this->
parent_->
get_name().
c_str(),
134 this->target_temperature_low_, this->target_temperature_high_);
141 this->
state_ &= ~WATER_HEATER_STATE_AWAY;
145 this->
state_ &= ~WATER_HEATER_STATE_ON;
155 ESP_LOGD(TAG,
"'%s' - Sending state:", this->
name_.
c_str());
167 ESP_LOGD(TAG,
" Away: YES");
173#if defined(USE_WATER_HEATER) && defined(USE_CONTROLLER_REGISTRY)
185 saved.state = this->
state_;
196 call.set_mode(recovered.mode);
198 call.set_target_temperature_low(recovered.target_temperature_low);
199 call.set_target_temperature_high(recovered.target_temperature_high);
201 call.set_target_temperature(recovered.target_temperature);
210#ifdef USE_WATER_HEATER_VISUAL_OVERRIDES
224#ifdef USE_WATER_HEATER_VISUAL_OVERRIDES
239 return LOG_STR(
"OFF");
241 return LOG_STR(
"ECO");
243 return LOG_STR(
"ELECTRIC");
245 return LOG_STR(
"PERFORMANCE");
247 return LOG_STR(
"HIGH_DEMAND");
249 return LOG_STR(
"HEAT_PUMP");
251 return LOG_STR(
"GAS");
253 return LOG_STR(
"UNKNOWN");
260 " Min Temperature: %.1f°C\n"
261 " Max Temperature: %.1f°C\n"
262 " Temperature Step: %.1f",
265 ESP_LOGCONFIG(tag,
" Supports Two-Point Target Temperature: YES");
268 ESP_LOGCONFIG(tag,
" Supports Away Mode: YES");
271 ESP_LOGCONFIG(tag,
" Supports On/Off: YES");
274 ESP_LOGCONFIG(tag,
" Supported Modes:");
BedjetMode mode
BedJet operating mode.
static void notify_water_heater_update(water_heater::WaterHeater *obj)
virtual ESPPreferenceObject make_preference(size_t length, uint32_t type, bool in_flash)=0
const StringRef & get_name() const
uint32_t get_preference_hash()
Get a unique hash for storing preferences/settings for this entity.
constexpr bool empty() const
Check if the set is empty.
constexpr const char * c_str() const
WaterHeaterCall & set_away(bool away)
WaterHeaterCall & set_target_temperature_high(float temperature)
WaterHeaterCall & set_mode(WaterHeaterMode mode)
WaterHeaterCall & set_target_temperature_low(float temperature)
WaterHeaterCall & set_on(bool on)
float target_temperature_low_
float target_temperature_high_
float target_temperature_
optional< WaterHeaterMode > mode_
WaterHeaterCall & set_target_temperature(float temperature)
float visual_target_temperature_step_override_
ESPPreferenceObject pref_
void set_visual_min_temperature_override(float min_temperature_override)
virtual void publish_state()
virtual void control(const WaterHeaterCall &call)=0
float visual_max_temperature_override_
void set_visual_target_temperature_step_override(float visual_target_temperature_step_override)
float target_temperature_low_
float visual_min_temperature_override_
void set_visual_max_temperature_override(float max_temperature_override)
virtual WaterHeaterCallInternal make_call()=0
float target_temperature_
float current_temperature_
void dump_traits_(const char *tag)
Log the traits of this water heater for dump_config().
virtual WaterHeaterTraits get_traits()
float target_temperature_high_
virtual WaterHeaterTraits traits()=0
optional< WaterHeaterCall > restore_state()
bool get_supports_two_point_target_temperature() const
float get_target_temperature_step() const
const WaterHeaterModeMask & get_supported_modes() const
float get_min_temperature() const
void set_min_temperature(float min_temperature)
bool get_supports_away_mode() const
bool has_feature_flags(uint32_t flags) const
void set_target_temperature_step(float target_temperature_step)
float get_max_temperature() const
void set_max_temperature(float max_temperature)
void log_water_heater(const char *tag, const char *prefix, const char *type, WaterHeater *obj)
@ WATER_HEATER_MODE_ELECTRIC
@ WATER_HEATER_MODE_HIGH_DEMAND
@ WATER_HEATER_MODE_HEAT_PUMP
@ WATER_HEATER_MODE_PERFORMANCE
@ WATER_HEATER_STATE_ON
Water heater is on (not in standby)
@ WATER_HEATER_STATE_AWAY
Away/vacation mode is currently active.
@ WATER_HEATER_SUPPORTS_ON_OFF
The water heater can be turned on/off.
const LogString * water_heater_mode_to_string(WaterHeaterMode mode)
Convert the given WaterHeaterMode to a human-readable string for logging.
ESPPreferences * global_preferences
bool str_equals_case_insensitive(const std::string &a, const std::string &b)
Compare strings for equality in case-insensitive manner.