6static const char *
const TAG =
"tuya.water_heater";
11 ESP_LOGV(TAG,
"MCU reported switch is: %s", ONOFF(datapoint.
value_bool));
28 ESP_LOGV(TAG,
"MCU reported mode value is: %u", datapoint.
value_enum);
46 ESP_LOGV(TAG,
"MCU reported target temperature is: %.1f", value);
55 ESP_LOGV(TAG,
"MCU reported current temperature is: %.1f", value);
67 auto mode_val =
call.get_mode();
68 auto on_val =
call.get_on();
72 optional<bool> want_on = on_val;
73 if (mode_val.has_value() && !want_on.has_value()) {
77 if (want_on.has_value() && this->switch_id_.has_value()) {
78 ESP_LOGV(TAG,
"Setting switch: %s", ONOFF(*want_on));
85 ESP_LOGV(TAG,
"Setting mode value: %u", value);
88 ESP_LOGW(TAG,
"No mode value configured for requested mode");
92 auto target_temp =
call.get_target_temperature();
94 ESP_LOGV(TAG,
"Setting target temperature: %.1f", target_temp);
137 optional<uint8_t> mapped;
160 if (mapped.has_value()) {
179 LOG_WATER_HEATER(
"",
"Tuya Water Heater",
this);
181 ESP_LOGCONFIG(TAG,
" Switch has datapoint ID %u", *this->
switch_id_);
184 ESP_LOGCONFIG(TAG,
" Mode has datapoint ID %u", *this->
mode_id_);
BedjetMode mode
BedJet operating mode.
constexpr bool empty() const
Check if the set is empty.
void set_boolean_datapoint_value(uint8_t datapoint_id, bool value)
void set_enum_datapoint_value(uint8_t datapoint_id, uint8_t value)
void register_listener(uint8_t datapoint_id, const std::function< void(TuyaDatapoint)> &func)
void set_integer_datapoint_value(uint8_t datapoint_id, uint32_t value)
water_heater::WaterHeaterTraits traits() override
optional< uint8_t > target_temperature_id_
optional< uint8_t > electric_value_
float target_temperature_multiplier_
optional< uint8_t > performance_value_
optional< water_heater::WaterHeaterMode > last_reported_mode_
Last non-OFF mode reported by the mode datapoint, applied when the heater turns on.
float current_temperature_multiplier_
void control(const water_heater::WaterHeaterCall &call) override
optional< uint8_t > mode_id_
optional< uint8_t > high_demand_value_
water_heater::WaterHeaterModeMask supported_modes_
optional< uint8_t > switch_id_
void dump_config() override
bool value_from_mode_(water_heater::WaterHeaterMode mode, uint8_t &value) const
Map a WaterHeaterMode to its configured Tuya enum value. Returns true when a mapping exists.
optional< uint8_t > eco_value_
water_heater::WaterHeaterMode default_on_mode_() const
The mode to show when the heater is on but no mode datapoint value is known yet: the last reported mo...
optional< uint8_t > gas_value_
water_heater::WaterHeaterCallInternal make_call() override
bool mode_from_value_(uint8_t value, water_heater::WaterHeaterMode &mode) const
Map a Tuya mode datapoint enum value to a WaterHeaterMode.
optional< uint8_t > heat_pump_value_
optional< uint8_t > current_temperature_id_
void set_mode_(WaterHeaterMode mode)
Set the mode of the water heater. Should only be called from control().
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().
void set_target_temperature_(float target_temperature)
Set the target temperature of the water heater. Should only be called from control().
void set_current_temperature(float current_temperature)
void set_supported_modes(WaterHeaterModeMask modes)
void add_feature_flags(uint32_t flags)
Get/set feature flags (see WaterHeaterFeature enum)
@ 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_SUPPORTS_TARGET_TEMPERATURE
The water heater supports a target temperature.
@ WATER_HEATER_SUPPORTS_OPERATION_MODE
The water heater supports operation mode selection.
@ WATER_HEATER_SUPPORTS_ON_OFF
The water heater can be turned on/off.
@ WATER_HEATER_SUPPORTS_CURRENT_TEMPERATURE
The water heater supports reporting the current temperature.