From 5f86c77cde62f72a8f9f66ec7ba4c0adac7b26f2 Mon Sep 17 00:00:00 2001 From: Steve Wagner Date: Thu, 8 Feb 2024 16:42:41 +0100 Subject: [PATCH] Change naming. Update makes it more clear that the values goes in not out. --- components/samsung_ac/samsung_ac.h | 18 +++++++------- components/samsung_ac/samsung_ac_device.h | 30 +++++++++++------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/components/samsung_ac/samsung_ac.h b/components/samsung_ac/samsung_ac.h index d6edb745..c7bcbdd5 100644 --- a/components/samsung_ac/samsung_ac.h +++ b/components/samsung_ac/samsung_ac.h @@ -65,63 +65,63 @@ namespace esphome { Samsung_AC_Device *dev = find_device(address); if (dev != nullptr) - dev->publish_room_temperature(value); + dev->update_room_temperature(value); } void /*MessageTarget::*/ set_room_humidity(const std::string address, float value) override { Samsung_AC_Device *dev = find_device(address); if (dev != nullptr) - dev->publish_room_humidity(value); + dev->update_room_humidity(value); } void /*MessageTarget::*/ set_target_temperature(const std::string address, float value) override { Samsung_AC_Device *dev = find_device(address); if (dev != nullptr) - dev->publish_target_temperature(value); + dev->update_target_temperature(value); } void /*MessageTarget::*/ set_power(const std::string address, bool value) override { Samsung_AC_Device *dev = find_device(address); if (dev != nullptr) - dev->publish_power(value); + dev->update_power(value); } void /*MessageTarget::*/ set_mode(const std::string address, Mode mode) override { Samsung_AC_Device *dev = find_device(address); if (dev != nullptr) - dev->publish_mode(mode); + dev->update_mode(mode); } void /*MessageTarget::*/ set_fanmode(const std::string address, FanMode fanmode) override { Samsung_AC_Device *dev = find_device(address); if (dev != nullptr) - dev->publish_fanmode(fanmode); + dev->update_fanmode(fanmode); } void /*MessageTarget::*/ set_altmode(const std::string address, AltMode altmode) override { Samsung_AC_Device *dev = find_device(address); if (dev != nullptr) - dev->publish_altmode(altmode); + dev->update_altmode(altmode); } void /*MessageTarget::*/ set_swing_vertical(const std::string address, bool vertical) override { Samsung_AC_Device *dev = find_device(address); if (dev != nullptr) - dev->publish_swing_vertical(vertical); + dev->update_swing_vertical(vertical); } void /*MessageTarget::*/ set_swing_horizontal(const std::string address, bool horizontal) override { Samsung_AC_Device *dev = find_device(address); if (dev != nullptr) - dev->publish_swing_horizontal(horizontal); + dev->update_swing_horizontal(horizontal); } protected: diff --git a/components/samsung_ac/samsung_ac_device.h b/components/samsung_ac/samsung_ac_device.h index f1d69cba..eac3a178 100644 --- a/components/samsung_ac/samsung_ac_device.h +++ b/components/samsung_ac/samsung_ac_device.h @@ -132,7 +132,7 @@ namespace esphome climate->device = this; } - void publish_target_temperature(float value) + void update_target_temperature(float value) { if (target_temperature != nullptr) target_temperature->publish_state(value); @@ -146,7 +146,7 @@ namespace esphome optional _cur_power; optional _cur_mode; - void publish_power(bool value) + void update_power(bool value) { _cur_power = value; if (power != nullptr) @@ -155,7 +155,7 @@ namespace esphome calc_and_publish_mode(); } - void publish_mode(Mode value) + void update_mode(Mode value) { _cur_mode = value; if (mode != nullptr) @@ -164,7 +164,7 @@ namespace esphome calc_and_publish_mode(); } - void publish_fanmode(FanMode value) + void update_fanmode(FanMode value) { if (climate != nullptr) { @@ -185,7 +185,7 @@ namespace esphome } } - void publish_altmode(AltMode value) + void update_altmode(AltMode value) { if (climate != nullptr) { @@ -204,7 +204,7 @@ namespace esphome } } - void publish_swing_vertical(bool value) + void update_swing_vertical(bool value) { if (climate != nullptr) { @@ -213,7 +213,7 @@ namespace esphome } } - void publish_swing_horizontal(bool value) + void update_swing_horizontal(bool value) { if (climate != nullptr) { @@ -222,13 +222,7 @@ namespace esphome } } - climate::ClimateSwingMode combine(climate::ClimateSwingMode climateSwingMode, uint8_t mask, bool value) - { - uint8_t swingMode = static_cast(climateswingmode_to_swingmode(climateSwingMode)); - return swingmode_to_climateswingmode(static_cast(value ? (swingMode | mask) : (swingMode & ~mask))); - } - - void publish_room_temperature(float value) + void update_room_temperature(float value) { if (room_temperature != nullptr) room_temperature->publish_state(value); @@ -239,7 +233,7 @@ namespace esphome } } - void publish_room_humidity(float value) + void update_room_humidity(float value) { if (room_humidity != nullptr) room_humidity->publish_state(value); @@ -254,6 +248,12 @@ namespace esphome Protocol *protocol{nullptr}; MessageTarget *target{nullptr}; + climate::ClimateSwingMode combine(climate::ClimateSwingMode climateSwingMode, uint8_t mask, bool value) + { + uint8_t swingMode = static_cast(climateswingmode_to_swingmode(climateSwingMode)); + return swingmode_to_climateswingmode(static_cast(value ? (swingMode | mask) : (swingMode & ~mask))); + } + void calc_and_publish_mode() { if (!_cur_power.has_value())