Daikin precision and preset enhancements

This commit is contained in:
James Nimmo 2022-06-27 20:50:40 +12:00
parent e25dd3298c
commit 90e4b1f6a0
2 changed files with 12 additions and 13 deletions

View File

@ -139,7 +139,7 @@ uint8_t DaikinClimate::temperature_() {
case climate::CLIMATE_MODE_DRY:
return 0xc0;
default:
uint8_t temperature = (clamp<float>(this->target_temperature, DAIKIN_TEMP_MIN, DAIKIN_TEMP_MAX))*2;
uint8_t temperature = (clamp<float>(this->target_temperature, DAIKIN_TEMP_MIN, DAIKIN_TEMP_MAX)) * 2;
return temperature;
}
}
@ -149,8 +149,7 @@ uint8_t DaikinClimate::powerful_quiet_preset_() {
if (this->preset.has_value()) {
if (this->preset == climate::CLIMATE_PRESET_BOOST) {
powerful_quiet_preset = DAIKIN_PRESET_POWERFUL_ON;
}
else if (this->preset == climate::CLIMATE_PRESET_SLEEP) {
} else if (this->preset == climate::CLIMATE_PRESET_SLEEP) {
powerful_quiet_preset = DAIKIN_PRESET_QUIET_ON;
}
}
@ -202,7 +201,7 @@ bool DaikinClimate::parse_state_frame_(const uint8_t frame[]) {
}
uint8_t temperature = frame[6];
if (!(temperature & 0xC0)) {
this->target_temperature = (float)temperature / 2.0f;
this->target_temperature = (float) temperature / 2.0f;
}
uint8_t fan_mode = frame[8];
uint8_t swing_mode = frame[9];

View File

@ -52,14 +52,14 @@ const uint8_t DAIKIN_STATE_FRAME_SIZE = 19;
class DaikinClimate : public climate_ir::ClimateIR {
public:
DaikinClimate()
: climate_ir::ClimateIR(DAIKIN_TEMP_MIN, DAIKIN_TEMP_MAX, 0.5f, true, true,
{climate::CLIMATE_FAN_AUTO, climate::CLIMATE_FAN_LOW, climate::CLIMATE_FAN_MEDIUM,
climate::CLIMATE_FAN_HIGH},
{climate::CLIMATE_SWING_OFF, climate::CLIMATE_SWING_VERTICAL,
climate::CLIMATE_SWING_HORIZONTAL, climate::CLIMATE_SWING_BOTH},
{climate::CLIMATE_PRESET_ECO, climate::CLIMATE_PRESET_BOOST,
climate::CLIMATE_PRESET_COMFORT, climate::CLIMATE_PRESET_SLEEP,
climate::CLIMATE_PRESET_ACTIVITY, climate::CLIMATE_PRESET_NONE}) {}
: climate_ir::ClimateIR(
DAIKIN_TEMP_MIN, DAIKIN_TEMP_MAX, 0.5f, true, true,
{climate::CLIMATE_FAN_AUTO, climate::CLIMATE_FAN_LOW, climate::CLIMATE_FAN_MEDIUM,
climate::CLIMATE_FAN_HIGH},
{climate::CLIMATE_SWING_OFF, climate::CLIMATE_SWING_VERTICAL, climate::CLIMATE_SWING_HORIZONTAL,
climate::CLIMATE_SWING_BOTH},
{climate::CLIMATE_PRESET_ECO, climate::CLIMATE_PRESET_BOOST, climate::CLIMATE_PRESET_COMFORT,
climate::CLIMATE_PRESET_SLEEP, climate::CLIMATE_PRESET_ACTIVITY, climate::CLIMATE_PRESET_NONE}) {}
protected:
// Transmit via IR the state of this climate controller.
@ -75,4 +75,4 @@ class DaikinClimate : public climate_ir::ClimateIR {
};
} // namespace daikin
} // namespace esphome
} // namespace esphome