7 static const char *
const TAG =
"tuya.climate";
12 ESP_LOGV(TAG,
"MCU reported switch is: %s", ONOFF(datapoint.
value_bool));
29 ESP_LOGV(TAG,
"MCU reported active state is: %u", datapoint.
value_enum);
51 ESP_LOGV(TAG,
"MCU reported manual target temperature is: %.1f", this->
manual_temperature_);
72 ESP_LOGV(TAG,
"MCU reported eco is: %s", ONOFF(this->
eco_));
84 bool state_changed =
false;
88 ESP_LOGV(TAG,
"Heating state pin changed to: %s", ONOFF(heating_state));
96 ESP_LOGV(TAG,
"Cooling state pin changed to: %s", ONOFF(cooling_state));
111 ESP_LOGV(TAG,
"Setting switch: %s", ONOFF(switch_state));
118 target_temperature = (target_temperature * 9 / 5) + 32;
120 ESP_LOGV(TAG,
"Setting target temperature: %.1f", target_temperature);
129 ESP_LOGV(TAG,
"Setting eco: %s", ONOFF(eco));
151 LOG_CLIMATE(
"",
"Tuya Climate",
this);
153 ESP_LOGCONFIG(TAG,
" Switch has datapoint ID %u", *this->
switch_id_);
156 ESP_LOGCONFIG(TAG,
" Active state has datapoint ID %u", *this->
active_state_id_);
167 ESP_LOGCONFIG(TAG,
" Eco has datapoint ID %u", *this->
eco_id_);
This class is used to encode all control actions on a climate device.
The climate device is off (inactive or no power)
GPIOPin * heating_state_pin_
ClimatePreset
Enum for all preset modes.
float target_temperature
The target temperature of the climate device.
void switch_to_action_(climate::ClimateAction action)
Switch the climate device to the given climate mode.
const optional< ClimateMode > & get_mode() const
This class contains all static data for climate devices.
The climate device is set to heat to reach the target temperature.
GPIOPin * cooling_state_pin_
ClimateMode mode
The active mode of the climate device.
float current_temperature_multiplier_
float current_temperature
The current temperature of the climate device, as reported from the integration.
optional< uint8_t > active_state_cooling_value_
float manual_temperature_
void register_listener(uint8_t datapoint_id, const std::function< void(TuyaDatapoint)> &func)
optional< uint8_t > switch_id_
void add_supported_preset(ClimatePreset preset)
void compute_target_temperature_()
Re-compute the target temperature of this climate controller.
The climate device is set to cool to reach the target temperature.
void dump_config() override
const optional< ClimatePreset > & get_preset() const
void control(const climate::ClimateCall &call) override
Override control to change settings of the climate device.
optional< ClimatePreset > preset
The active preset of the climate device.
optional< uint8_t > active_state_id_
optional< uint8_t > eco_id_
ClimateAction
Enum for the current action of the climate device. Values match those of ClimateMode.
optional< float > eco_temperature_
The climate device is set to heat/cool to reach the target temperature.
The climate device is actively heating.
const optional< float > & get_target_temperature() const
optional< uint8_t > active_state_heating_value_
void publish_state()
Publish the state of the climate device, to be called from integrations.
virtual bool digital_read()=0
The climate device is off.
void set_supports_action(bool supports_action)
climate::ClimateTraits traits() override
Return the traits of this controller.
void set_boolean_datapoint_value(uint8_t datapoint_id, bool value)
void set_integer_datapoint_value(uint8_t datapoint_id, uint32_t value)
Implementation of SPI Controller mode.
The climate device is idle (monitoring climate but no action needed)
Device is running an energy-saving preset.
void set_supports_current_temperature(bool supports_current_temperature)
void compute_state_()
Re-compute the state of this climate controller.
optional< uint8_t > target_temperature_id_
The climate device is actively cooling.
void add_supported_mode(ClimateMode mode)
float target_temperature_multiplier_
void compute_preset_()
Re-compute the active preset of this climate controller.
optional< uint8_t > current_temperature_id_
ClimateAction action
The active state of the climate device.