mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-03 19:38:30 +02:00
Break the Tuya set_datapoint_value method into separate methods per datapoint type (#2059)
Co-authored-by: Chris Nussbaum <chris.nussbaum@protolabs.com> Co-authored-by: Trevor North <trevor@freedisc.co.uk>
This commit is contained in:
@@ -54,14 +54,14 @@ void TuyaClimate::control(const climate::ClimateCall &call) {
|
||||
if (call.get_mode().has_value()) {
|
||||
const bool switch_state = *call.get_mode() != climate::CLIMATE_MODE_OFF;
|
||||
ESP_LOGV(TAG, "Setting switch: %s", ONOFF(switch_state));
|
||||
this->parent_->set_datapoint_value(*this->switch_id_, switch_state);
|
||||
this->parent_->set_boolean_datapoint_value(*this->switch_id_, switch_state);
|
||||
}
|
||||
|
||||
if (call.get_target_temperature().has_value()) {
|
||||
const float target_temperature = *call.get_target_temperature();
|
||||
ESP_LOGV(TAG, "Setting target temperature: %.1f", target_temperature);
|
||||
this->parent_->set_datapoint_value(*this->target_temperature_id_,
|
||||
(int) (target_temperature / this->target_temperature_multiplier_));
|
||||
this->parent_->set_integer_datapoint_value(*this->target_temperature_id_,
|
||||
(int) (target_temperature / this->target_temperature_multiplier_));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user