diff --git a/components/samsung_ac/__init__.py b/components/samsung_ac/__init__.py index 094a06b..29f70a9 100644 --- a/components/samsung_ac/__init__.py +++ b/components/samsung_ac/__init__.py @@ -228,9 +228,8 @@ def humidity_sensor_schema(message: int): CONF_NON_NASA_KEEPALIVE = "non_nasa_keepalive" -CONF_LOG_UNDEFINED_MESSAGES = "log_undefined_messages" +CONF_DEBUG_LOG_UNDEFINED_MESSAGES = "debug_log_undefined_messages" -CONF_LOG_MESSAGES = "log_messages" CONFIG_SCHEMA = ( cv.Schema( @@ -244,8 +243,7 @@ def humidity_sensor_schema(message: int): cv.Optional(CONF_DEBUG_LOG_MESSAGES, default=False): cv.boolean, cv.Optional(CONF_DEBUG_LOG_MESSAGES_RAW, default=False): cv.boolean, cv.Optional(CONF_NON_NASA_KEEPALIVE, default=False): cv.boolean, - cv.Optional(CONF_LOG_UNDEFINED_MESSAGES, default=False): cv.boolean, - cv.Optional(CONF_LOG_MESSAGES, default=False): cv.boolean, + cv.Optional(CONF_DEBUG_LOG_UNDEFINED_MESSAGES, default=False): cv.boolean, cv.Optional(CONF_CAPABILITIES): CAPABILITIES_SCHEMA, cv.Required(CONF_DEVICES): cv.ensure_list(DEVICE_SCHEMA), } @@ -425,11 +423,8 @@ async def to_code(config): if (CONF_NON_NASA_KEEPALIVE in config): cg.add(var.set_non_nasa_keepalive(config[CONF_NON_NASA_KEEPALIVE])) - if (CONF_LOG_UNDEFINED_MESSAGES in config): - cg.add(var.set_log_undefined_messages(config[CONF_LOG_UNDEFINED_MESSAGES])) - - if (CONF_LOG_MESSAGES in config): - cg.add(var.set_log_messages(config[CONF_LOG_MESSAGES])) + if (CONF_DEBUG_LOG_UNDEFINED_MESSAGES in config): + cg.add(var.set_debug_log_undefined_messages(config[CONF_DEBUG_LOG_UNDEFINED_MESSAGES])) await cg.register_component(var, config) await uart.register_uart_device(var, config) diff --git a/components/samsung_ac/conversions.cpp b/components/samsung_ac/conversions.cpp index ba6ee24..518cfe8 100644 --- a/components/samsung_ac/conversions.cpp +++ b/components/samsung_ac/conversions.cpp @@ -152,7 +152,7 @@ namespace esphome } } - optional altmodename_to_preset(const AltModeName& name) + optional altmodename_to_preset(const AltModeName &name) { if (str_equals_case_insensitive(name, "ECO")) return optional(climate::CLIMATE_PRESET_ECO); diff --git a/components/samsung_ac/conversions.h b/components/samsung_ac/conversions.h index 8bfb621..050cc88 100644 --- a/components/samsung_ac/conversions.h +++ b/components/samsung_ac/conversions.h @@ -20,7 +20,7 @@ namespace esphome FanMode customfanmode_to_fanmode(const std::string &value); AltModeName preset_to_altmodename(climate::ClimatePreset preset); - optional altmodename_to_preset(const AltModeName& name); + optional altmodename_to_preset(const AltModeName &name); climate::ClimateSwingMode swingmode_to_climateswingmode(SwingMode swingMode); SwingMode climateswingmode_to_swingmode(climate::ClimateSwingMode swingMode); diff --git a/components/samsung_ac/protocol.cpp b/components/samsung_ac/protocol.cpp index da58630..4e53f41 100644 --- a/components/samsung_ac/protocol.cpp +++ b/components/samsung_ac/protocol.cpp @@ -11,8 +11,7 @@ namespace esphome bool debug_log_packets = false; bool debug_log_raw_bytes = false; bool non_nasa_keepalive = false; - bool log_undefined_messages = false; - bool log_messages = false; + bool debug_log_undefined_messages = false; ProtocolProcessing protocol_processing = ProtocolProcessing::Auto; // This functions is designed to run after a new value was added diff --git a/components/samsung_ac/protocol.h b/components/samsung_ac/protocol.h index fbd2e25..5157c40 100644 --- a/components/samsung_ac/protocol.h +++ b/components/samsung_ac/protocol.h @@ -11,8 +11,7 @@ namespace esphome extern bool debug_log_packets; extern bool debug_log_raw_bytes; extern bool non_nasa_keepalive; - extern bool log_undefined_messages; - extern bool log_messages; + extern bool debug_log_undefined_messages; enum class DecodeResult { diff --git a/components/samsung_ac/protocol_nasa.cpp b/components/samsung_ac/protocol_nasa.cpp index c962a22..5da5e95 100644 --- a/components/samsung_ac/protocol_nasa.cpp +++ b/components/samsung_ac/protocol_nasa.cpp @@ -386,8 +386,8 @@ namespace esphome power.value = request.power.value() ? 1 : 0; packet.messages.push_back(power); } - - if (request.automatic_cleaning) + + if (request.automatic_cleaning) { MessageSet automatic_cleaning(MessageNumber::ENUM_in_operation_automatic_cleaning); automatic_cleaning.value = request.automatic_cleaning.value() ? 1 : 0; @@ -407,14 +407,14 @@ namespace esphome targettemp.value = request.target_temp.value() * 10.0; packet.messages.push_back(targettemp); } - + if (request.water_outlet_target) { MessageSet wateroutlettarget(MessageNumber::VAR_in_temp_water_outlet_target_f); wateroutlettarget.value = request.water_outlet_target.value() * 10.0; packet.messages.push_back(wateroutlettarget); } - + if (request.target_water_temp) { MessageSet targetwatertemp(MessageNumber::VAR_in_temp_water_heater_target_f); @@ -509,125 +509,190 @@ namespace esphome } } -void process_messageset(std::string source, std::string dest, MessageSet &message, optional> &custom, MessageTarget *target) { - if (debug_mqtt_connected()) { - std::string topic_prefix = "samsung_ac/nasa/"; - std::string topic_suffix = long_to_hex((uint16_t)message.messageNumber); - std::string payload = std::to_string(message.value); + void process_messageset(std::string source, std::string dest, MessageSet &message, optional> &custom, MessageTarget *target) + { + if (debug_mqtt_connected()) + { + std::string topic_prefix = "samsung_ac/nasa/"; + std::string topic_suffix = long_to_hex((uint16_t)message.messageNumber); + std::string payload = std::to_string(message.value); + + switch (message.type) + { + case MessageSetType::Enum: + debug_mqtt_publish(topic_prefix + "enum/" + topic_suffix, payload); + break; + case MessageSetType::Variable: + debug_mqtt_publish(topic_prefix + "var/" + topic_suffix, payload); + break; + case MessageSetType::LongVariable: + debug_mqtt_publish(topic_prefix + "var_long/" + topic_suffix, payload); + break; + default: + break; + } + } + + if (custom && custom.value().find((uint16_t)message.messageNumber) != custom.value().end()) + { + target->set_custom_sensor(source, (uint16_t)message.messageNumber, (float)message.value); + } - switch (message.type) { - case MessageSetType::Enum: - debug_mqtt_publish(topic_prefix + "enum/" + topic_suffix, payload); + switch (message.messageNumber) + { + case MessageNumber::VAR_in_temp_room_f: + { + double temp = message.value / 10.0; + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s VAR_in_temp_room_f %f", source.c_str(), dest.c_str(), temp); + } + target->set_room_temperature(source, temp); break; - case MessageSetType::Variable: - debug_mqtt_publish(topic_prefix + "var/" + topic_suffix, payload); + } + case MessageNumber::VAR_in_temp_target_f: + { + double temp = message.value / 10.0; + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s VAR_in_temp_target_f %f", source.c_str(), dest.c_str(), temp); + } + target->set_target_temperature(source, temp); break; - case MessageSetType::LongVariable: - debug_mqtt_publish(topic_prefix + "var_long/" + topic_suffix, payload); + } + case MessageNumber::VAR_in_temp_water_outlet_target_f: + { + double temp = message.value / 10.0; + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s VAR_in_temp_water_outlet_target_f %f", source.c_str(), dest.c_str(), temp); + } + target->set_water_outlet_target(source, temp); break; - default: + } + case MessageNumber::VAR_in_temp_water_heater_target_f: + { + double temp = message.value / 10.0; + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s VAR_in_temp_water_heater_target_f %f", source.c_str(), dest.c_str(), temp); + } + target->set_target_water_temperature(source, temp); break; - } - } - - if (custom && custom.value().find((uint16_t)message.messageNumber) != custom.value().end()) { - target->set_custom_sensor(source, (uint16_t)message.messageNumber, (float)message.value); - } - - switch (message.messageNumber) { - case MessageNumber::VAR_in_temp_room_f: { - double temp = message.value / 10.0; - if(log_messages){ESP_LOGW(TAG, "s:%s d:%s VAR_in_temp_room_f %f", source.c_str(), dest.c_str(), temp);} - target->set_room_temperature(source, temp); - break; - } - case MessageNumber::VAR_in_temp_target_f: { - double temp = message.value / 10.0; - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s VAR_in_temp_target_f %f", source.c_str(), dest.c_str(), temp);} - target->set_target_temperature(source, temp); - break; - } - case MessageNumber::VAR_in_temp_water_outlet_target_f: { - double temp = message.value / 10.0; - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s VAR_in_temp_water_outlet_target_f %f", source.c_str(), dest.c_str(), temp);} - target->set_water_outlet_target(source, temp); - break; - } - case MessageNumber::VAR_in_temp_water_heater_target_f: { - double temp = message.value / 10.0; - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s VAR_in_temp_water_heater_target_f %f", source.c_str(), dest.c_str(), temp);} - target->set_target_water_temperature(source, temp); - break; - } - case MessageNumber::ENUM_in_state_humidity_percent: - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s ENUM_in_state_humidity_percent %li", source.c_str(), dest.c_str(), message.value);} - break; - case MessageNumber::ENUM_in_operation_power: - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s ENUM_in_operation_power %s", source.c_str(), dest.c_str(), message.value == 0 ? "off" : "on");} - target->set_power(source, message.value != 0); - break; - case MessageNumber::ENUM_in_operation_automatic_cleaning: - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s ENUM_in_operation_automatic_cleaning %s", source.c_str(), dest.c_str(), message.value == 0 ? "off" : "on");} - target->set_automatic_cleaning(source, message.value != 0); - break; - case MessageNumber::ENUM_in_water_heater_power: - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s ENUM_in_water_heater_power %s", source.c_str(), dest.c_str(), message.value == 0 ? "off" : "on");} - target->set_water_heater_power(source, message.value != 0); - break; - case MessageNumber::ENUM_in_operation_mode: - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s ENUM_in_operation_mode %li", source.c_str(), dest.c_str(), message.value);} - target->set_mode(source, operation_mode_to_mode(message.value)); - break; - case MessageNumber::ENUM_in_fan_mode: - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s ENUM_in_fan_mode %li", source.c_str(), dest.c_str(), message.value);} - target->set_fanmode(source, fan_mode_real_to_fanmode(message.value)); - break; - case MessageNumber::ENUM_in_fan_mode_real: - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s ENUM_in_fan_mode_real %li", source.c_str(), dest.c_str(), message.value);} - break; - case MessageNumber::ENUM_in_alt_mode: - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s ENUM_in_alt_mode %li", source.c_str(), dest.c_str(), message.value);} - target->set_altmode(source, message.value); - break; - case MessageNumber::ENUM_in_louver_hl_swing: - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s ENUM_in_louver_hl_swing %li", source.c_str(), dest.c_str(), message.value);} - target->set_swing_vertical(source, message.value == 1); - break; - case MessageNumber::ENUM_in_louver_lr_swing: - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s ENUM_in_louver_lr_swing %li", source.c_str(), dest.c_str(), message.value);} - target->set_swing_horizontal(source, message.value == 1); - break; - case MessageNumber::VAR_in_temp_water_tank_f: - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s VAR_in_temp_water_tank_f %li", source.c_str(), dest.c_str(), message.value);} - break; - case MessageNumber::VAR_out_sensor_airout: { - double temp = ((int16_t)message.value) / 10.0; - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s VAR_out_sensor_airout %li", source.c_str(), dest.c_str(), message.value);} - target->set_outdoor_temperature(source, temp); - break; - } - case MessageNumber::VAR_IN_TEMP_EVA_IN_F: { - double temp = ((int16_t)message.value) / 10.0; - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s VAR_IN_TEMP_EVA_IN_F %li", source.c_str(), dest.c_str(), message.value);} - target->set_indoor_eva_in_temperature(source, temp); - break; - } - case MessageNumber::VAR_IN_TEMP_EVA_OUT_F: { - double temp = ((int16_t)message.value) / 10.0; - if(log_messages){ ESP_LOGW(TAG, "s:%s d:%s VAR_IN_TEMP_EVA_OUT_F %li", source.c_str(), dest.c_str(), message.value);} - target->set_indoor_eva_out_temperature(source, temp); - break; - } - default: - if (log_undefined_messages) + } + case MessageNumber::ENUM_in_state_humidity_percent: + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s ENUM_in_state_humidity_percent %li", source.c_str(), dest.c_str(), message.value); + } + break; + case MessageNumber::ENUM_in_operation_power: + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s ENUM_in_operation_power %s", source.c_str(), dest.c_str(), message.value == 0 ? "off" : "on"); + } + target->set_power(source, message.value != 0); + break; + case MessageNumber::ENUM_in_operation_automatic_cleaning: + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s ENUM_in_operation_automatic_cleaning %s", source.c_str(), dest.c_str(), message.value == 0 ? "off" : "on"); + } + target->set_automatic_cleaning(source, message.value != 0); + break; + case MessageNumber::ENUM_in_water_heater_power: + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s ENUM_in_water_heater_power %s", source.c_str(), dest.c_str(), message.value == 0 ? "off" : "on"); + } + target->set_water_heater_power(source, message.value != 0); + break; + case MessageNumber::ENUM_in_operation_mode: + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s ENUM_in_operation_mode %li", source.c_str(), dest.c_str(), message.value); + } + target->set_mode(source, operation_mode_to_mode(message.value)); + break; + case MessageNumber::ENUM_in_fan_mode: + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s ENUM_in_fan_mode %li", source.c_str(), dest.c_str(), message.value); + } + target->set_fanmode(source, fan_mode_real_to_fanmode(message.value)); + break; + case MessageNumber::ENUM_in_fan_mode_real: + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s ENUM_in_fan_mode_real %li", source.c_str(), dest.c_str(), message.value); + } + break; + case MessageNumber::ENUM_in_alt_mode: + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s ENUM_in_alt_mode %li", source.c_str(), dest.c_str(), message.value); + } + target->set_altmode(source, message.value); + break; + case MessageNumber::ENUM_in_louver_hl_swing: + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s ENUM_in_louver_hl_swing %li", source.c_str(), dest.c_str(), message.value); + } + target->set_swing_vertical(source, message.value == 1); + break; + case MessageNumber::ENUM_in_louver_lr_swing: + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s ENUM_in_louver_lr_swing %li", source.c_str(), dest.c_str(), message.value); + } + target->set_swing_horizontal(source, message.value == 1); + break; + case MessageNumber::VAR_in_temp_water_tank_f: + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s VAR_in_temp_water_tank_f %li", source.c_str(), dest.c_str(), message.value); + } + break; + case MessageNumber::VAR_out_sensor_airout: + { + double temp = ((int16_t)message.value) / 10.0; + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s VAR_out_sensor_airout %li", source.c_str(), dest.c_str(), message.value); + } + target->set_outdoor_temperature(source, temp); + break; + } + case MessageNumber::VAR_IN_TEMP_EVA_IN_F: + { + double temp = ((int16_t)message.value) / 10.0; + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s VAR_IN_TEMP_EVA_IN_F %li", source.c_str(), dest.c_str(), message.value); + } + target->set_indoor_eva_in_temperature(source, temp); + break; + } + case MessageNumber::VAR_IN_TEMP_EVA_OUT_F: + { + double temp = ((int16_t)message.value) / 10.0; + if (debug_log_messages) + { + ESP_LOGW(TAG, "s:%s d:%s VAR_IN_TEMP_EVA_OUT_F %li", source.c_str(), dest.c_str(), message.value); + } + target->set_indoor_eva_out_temperature(source, temp); + break; + } + default: + if (debug_undefined_messages) { ESP_LOGW(TAG, "Undefined s:%s d:%s %s", source.c_str(), dest.c_str(), message.to_string().c_str()); } - - break; - } -} + break; + } + } DecodeResult try_decode_nasa_packet(std::vector data) { @@ -1074,21 +1139,21 @@ void process_messageset(std::string source, std::string dest, MessageSet &messag case 0x602: // STR_ad_option_install_2 case 0x600: // STR_ad_option_basic case 0x202: // VAR_ad_error_code1 - + case 0x42d1: // VAR_IN_DUST_SENSOR_PM10_0_VALUE - { - ESP_LOGW(TAG, "s:%s d:%s VAR_IN_DUST_SENSOR_PM10_0_VALUE %s %li", source.c_str(), dest.c_str(), long_to_hex((int)message.messageNumber).c_str(), message.value); - return; // Ingore cause not important + { + ESP_LOGW(TAG, "s:%s d:%s VAR_IN_DUST_SENSOR_PM10_0_VALUE %s %li", source.c_str(), dest.c_str(), long_to_hex((int)message.messageNumber).c_str(), message.value); + return; // Ingore cause not important } case 0x42d2: // VAR_IN_DUST_SENSOR_PM2_5_VALUE - { - ESP_LOGW(TAG, "s:%s d:%s VAR_IN_DUST_SENSOR_PM2_5_VALUE %s %li", source.c_str(), dest.c_str(), long_to_hex((int)message.messageNumber).c_str(), message.value); - return; // Ingore cause not important + { + ESP_LOGW(TAG, "s:%s d:%s VAR_IN_DUST_SENSOR_PM2_5_VALUE %s %li", source.c_str(), dest.c_str(), long_to_hex((int)message.messageNumber).c_str(), message.value); + return; // Ingore cause not important } case 0x42d3: // VAR_IN_DUST_SENSOR_PM1_0_VALUE { - ESP_LOGW(TAG, "s:%s d:%s VAR_IN_DUST_SENSOR_PM1_0_VALUE %s %li", source.c_str(), dest.c_str(), long_to_hex((int)message.messageNumber).c_str(), message.value); - return; // Ingore cause not important + ESP_LOGW(TAG, "s:%s d:%s VAR_IN_DUST_SENSOR_PM1_0_VALUE %s %li", source.c_str(), dest.c_str(), long_to_hex((int)message.messageNumber).c_str(), message.value); + return; // Ingore cause not important } case 0x23: diff --git a/components/samsung_ac/protocol_non_nasa.cpp b/components/samsung_ac/protocol_non_nasa.cpp index 392edc8..24965fa 100644 --- a/components/samsung_ac/protocol_non_nasa.cpp +++ b/components/samsung_ac/protocol_non_nasa.cpp @@ -554,39 +554,39 @@ namespace esphome item.request.fanspeed == nonpacket_.command20.fanspeed && item.request.mode == nonpacket_.command20.mode && item.request.power == nonpacket_.command20.power; }); - + // If a state update comes through after a control message has been sent, but before it // has been acknowledged, it should be ignored. This prevents the UI status bouncing // between states after a command has been issued. bool pending_control_message = false; - for (auto& item : nonnasa_requests) + for (auto &item : nonnasa_requests) { - if (item.time_sent > 0 && nonpacket_.src == item.request.dst) - { - pending_control_message = true; - break; - } + if (item.time_sent > 0 && nonpacket_.src == item.request.dst) + { + pending_control_message = true; + break; + } } if (!pending_control_message) { - last_command20s_[nonpacket_.src] = nonpacket_.command20; - target->set_target_temperature(nonpacket_.src, nonpacket_.command20.target_temp); - // TODO - target->set_water_outlet_target(nonpacket_.src, false); - // TODO - target->set_target_water_temperature(nonpacket_.src, false); - target->set_room_temperature(nonpacket_.src, nonpacket_.command20.room_temp); - target->set_power(nonpacket_.src, nonpacket_.command20.power); - // TODO - target->set_water_heater_power(nonpacket_.src, false); - target->set_mode(nonpacket_.src, nonnasa_mode_to_mode(nonpacket_.command20.mode)); - target->set_fanmode(nonpacket_.src, nonnasa_fanspeed_to_fanmode(nonpacket_.command20.fanspeed)); - // TODO - target->set_altmode(nonpacket_.src, 0); - // TODO - target->set_swing_horizontal(nonpacket_.src, false); - target->set_swing_vertical(nonpacket_.src, false); + last_command20s_[nonpacket_.src] = nonpacket_.command20; + target->set_target_temperature(nonpacket_.src, nonpacket_.command20.target_temp); + // TODO + target->set_water_outlet_target(nonpacket_.src, false); + // TODO + target->set_target_water_temperature(nonpacket_.src, false); + target->set_room_temperature(nonpacket_.src, nonpacket_.command20.room_temp); + target->set_power(nonpacket_.src, nonpacket_.command20.power); + // TODO + target->set_water_heater_power(nonpacket_.src, false); + target->set_mode(nonpacket_.src, nonnasa_mode_to_mode(nonpacket_.command20.mode)); + target->set_fanmode(nonpacket_.src, nonnasa_fanspeed_to_fanmode(nonpacket_.command20.fanspeed)); + // TODO + target->set_altmode(nonpacket_.src, 0); + // TODO + target->set_swing_horizontal(nonpacket_.src, false); + target->set_swing_vertical(nonpacket_.src, false); } } else if (nonpacket_.cmd == NonNasaCommand::CmdC6) diff --git a/components/samsung_ac/samsung_ac.h b/components/samsung_ac/samsung_ac.h index 867659b..19a0650 100644 --- a/components/samsung_ac/samsung_ac.h +++ b/components/samsung_ac/samsung_ac.h @@ -51,13 +51,9 @@ namespace esphome { non_nasa_keepalive = value; } -void set_log_undefined_messages (bool value) + void set_debug_log_undefined_messages(bool value) { - log_undefined_messages = value; - } - void set_log_messages (bool value) - { - log_messages = value; + debug_log_undefined_messages = value; } void register_device(Samsung_AC_Device *device); @@ -107,7 +103,7 @@ void set_log_undefined_messages (bool value) if (dev != nullptr) dev->update_target_temperature(value); } - + void /*MessageTarget::*/ set_water_outlet_target(const std::string address, float value) override { Samsung_AC_Device *dev = find_device(address); diff --git a/components/samsung_ac/samsung_ac_device.h b/components/samsung_ac/samsung_ac_device.h index c1a892a..409d490 100644 --- a/components/samsung_ac/samsung_ac_device.h +++ b/components/samsung_ac/samsung_ac_device.h @@ -89,8 +89,8 @@ namespace esphome std::string address; sensor::Sensor *room_temperature{nullptr}; sensor::Sensor *outdoor_temperature{nullptr}; - sensor::Sensor *indoor_eva_in_temperature{nullptr}; - sensor::Sensor *indoor_eva_out_temperature{nullptr}; + sensor::Sensor *indoor_eva_in_temperature{nullptr}; + sensor::Sensor *indoor_eva_out_temperature{nullptr}; Samsung_AC_Number *target_temperature{nullptr}; Samsung_AC_Number *water_outlet_target{nullptr}; Samsung_AC_Number *target_water_temperature{nullptr}; @@ -109,12 +109,12 @@ namespace esphome void set_outdoor_temperature_sensor(sensor::Sensor *sensor) { - outdoor_temperature = sensor; + outdoor_temperature = sensor; } void set_indoor_eva_in_temperature_sensor(sensor::Sensor *sensor) { - indoor_eva_in_temperature = sensor; + indoor_eva_in_temperature = sensor; } void set_indoor_eva_out_temperature_sensor(sensor::Sensor *sensor) @@ -148,8 +148,8 @@ namespace esphome publish_request(request); }; } - -void set_automatic_cleaning_switch(Samsung_AC_Switch *switch_) + + void set_automatic_cleaning_switch(Samsung_AC_Switch *switch_) { automatic_cleaning = switch_; automatic_cleaning->write_state_ = [this](bool value) @@ -192,7 +192,7 @@ void set_automatic_cleaning_switch(Samsung_AC_Switch *switch_) publish_request(request); }; }; - + void set_water_outlet_target_number(Samsung_AC_Number *number) { water_outlet_target = number; @@ -231,7 +231,7 @@ void set_automatic_cleaning_switch(Samsung_AC_Switch *switch_) climate->publish_state(); } } - + void update_water_outlet_target(float value) { if (water_outlet_target != nullptr) @@ -257,8 +257,8 @@ void set_automatic_cleaning_switch(Samsung_AC_Switch *switch_) if (climate != nullptr) calc_and_publish_mode(); } - -void update_automatic_cleaning(bool value) + + void update_automatic_cleaning(bool value) { _cur_automatic_cleaning = value; if (automatic_cleaning != nullptr) diff --git a/example.yaml b/example.yaml index 206b238..decfc30 100644 --- a/example.yaml +++ b/example.yaml @@ -47,7 +47,7 @@ uart: # Import custom component from GitHub external_components: - - source: github://omerfaruk-aran/esphome_samsung_ac@new_test # use @main if you want the latest development (possibly unstable?) + - source: github://omerfaruk-aran/esphome_samsung_ac@main # use @main if you want the latest development (possibly unstable?) components: [samsung_ac] # Configuration of AC component @@ -58,10 +58,10 @@ samsung_ac: non_nasa_keepalive: true #When enabled (set to true), this option will log the messages associated with undefined codes on the device. This is useful for debugging and identifying any unexpected or unknown codes that the device may receive during operation. - log_undefined_messages: false + debug_log_undefined_messages: false #When enabled (set to true), this option logs messages associated with defined codes on the device. This helps in monitoring the behavior of the device by recording the activity related to known, expected codes. - log_messages: false + debug_log_messages: false # Capabilities configure the features alle devices of your AC system have (all parts of this section are optional). # All capabilities are off by default, you need to enable only those your devices have.