Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NASA] Add Automatic Cleaning mode for Samsung AC - Deprecated due to issues #159

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
be6fc7e
Test version: process_messageset optimized
omerfaruk-aran Aug 12, 2024
cba5cdb
Test version: process_messageset optimized
omerfaruk-aran Aug 12, 2024
2e57d77
Test version: log_undefined_messages parameter add.
omerfaruk-aran Aug 12, 2024
4dc6a03
Test version: log_undefined_messages parameter add.
omerfaruk-aran Aug 12, 2024
2d2b30d
Test version: log_undefined_messages parameter add.
omerfaruk-aran Aug 12, 2024
d274213
Değişiklikler yapıldı
omerfaruk-aran Aug 13, 2024
5018383
Değişiklikler yapıldı.
omerfaruk-aran Aug 13, 2024
bc57a3b
INDOOR EVA IN/OUT TEMP ADD.
omerfaruk-aran Aug 13, 2024
3aa4c20
INDOOR EVA IN/OUT TEMP ADD.
omerfaruk-aran Aug 13, 2024
349ddeb
INDOOR EVA IN/OUT TEMP ADD.
omerfaruk-aran Aug 13, 2024
8629eb3
INDOOR EVA IN/OUT TEMP ADD.
omerfaruk-aran Aug 13, 2024
6d81e39
INDOOR EVA IN/OUT TEMP ADD.
omerfaruk-aran Aug 13, 2024
c3d14b9
INDOOR EVA IN/OUT TEMP ADD.
omerfaruk-aran Aug 13, 2024
e434eaf
INDOOR EVA IN/OUT TEMP ADD.
omerfaruk-aran Aug 13, 2024
db435e5
INDOOR EVA IN/OUT TEMP ADD.
omerfaruk-aran Aug 13, 2024
751ba92
INDOOR EVA IN/OUT TEMP ADD.
omerfaruk-aran Aug 13, 2024
8b21db2
ADD Automatic Cleaning Mode. After the cooling process is completed, …
omerfaruk-aran Aug 13, 2024
c86eb0d
Initial commit with all changes
omerfaruk-aran Aug 13, 2024
988eeba
Add automatic_cleaning mode for Samsung AC
omerfaruk-aran Aug 13, 2024
74fb700
Resolved conflicts, fixed indentation, renamed log parameters, implem…
omerfaruk-aran Aug 14, 2024
3733db4
The debug_log_packets variable has been optimized.
omerfaruk-aran Aug 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions components/samsung_ac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@
CONF_DEVICE_TARGET_TEMPERATURE = "target_temperature"
CONF_DEVICE_WATER_OUTLET_TARGET = "water_outlet_target"
CONF_DEVICE_OUTDOOR_TEMPERATURE = "outdoor_temperature"
CONF_DEVICE_INDOOR_EVA_IN_TEMPERATURE = "indoor_eva_in_temperature"
CONF_DEVICE_INDOOR_EVA_OUT_TEMPERATURE = "indoor_eva_out_temperature"
CONF_DEVICE_WATER_TEMPERATURE = "water_temperature"
CONF_DEVICE_WATER_TARGET_TEMPERATURE = "water_target_temperature"
CONF_DEVICE_POWER = "power"
CONF_DEVICE_AUTOMATIC_CLEANING = "automatic_cleaning"
CONF_DEVICE_WATER_HEATER_POWER = "water_heater_power"
CONF_DEVICE_MODE = "mode"
CONF_DEVICE_CLIMATE = "climate"
Expand Down Expand Up @@ -178,11 +181,24 @@ def humidity_sensor_schema(message: int):
accuracy_decimals=1,
device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT,
),
cv.Optional(CONF_DEVICE_INDOOR_EVA_IN_TEMPERATURE): sensor.sensor_schema(
unit_of_measurement=UNIT_CELSIUS,
accuracy_decimals=1,
device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT,
),
cv.Optional(CONF_DEVICE_INDOOR_EVA_OUT_TEMPERATURE): sensor.sensor_schema(
unit_of_measurement=UNIT_CELSIUS,
accuracy_decimals=1,
device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT,
),
cv.Optional(CONF_DEVICE_TARGET_TEMPERATURE): NUMBER_SCHEMA,
cv.Optional(CONF_DEVICE_WATER_OUTLET_TARGET): NUMBER_SCHEMA,
cv.Optional(CONF_DEVICE_WATER_TARGET_TEMPERATURE): NUMBER_SCHEMA,
cv.Optional(CONF_DEVICE_POWER): switch.switch_schema(Samsung_AC_Switch),
cv.Optional(CONF_DEVICE_AUTOMATIC_CLEANING): switch.switch_schema(Samsung_AC_Switch),
cv.Optional(CONF_DEVICE_WATER_HEATER_POWER): switch.switch_schema(Samsung_AC_Switch),
cv.Optional(CONF_DEVICE_MODE): SELECT_MODE_SCHEMA,
cv.Optional(CONF_DEVICE_CLIMATE): CLIMATE_SCHEMA,
Expand Down Expand Up @@ -212,6 +228,9 @@ def humidity_sensor_schema(message: int):

CONF_NON_NASA_KEEPALIVE = "non_nasa_keepalive"

CONF_DEBUG_LOG_UNDEFINED_MESSAGES = "debug_log_undefined_messages"


CONFIG_SCHEMA = (
cv.Schema(
{
Expand All @@ -224,6 +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_DEBUG_LOG_UNDEFINED_MESSAGES, default=False): cv.boolean,
cv.Optional(CONF_CAPABILITIES): CAPABILITIES_SCHEMA,
cv.Required(CONF_DEVICES): cv.ensure_list(DEVICE_SCHEMA),
}
Expand Down Expand Up @@ -295,6 +315,11 @@ async def to_code(config):
sens = await switch.new_switch(conf)
cg.add(var_dev.set_power_switch(sens))

if CONF_DEVICE_AUTOMATIC_CLEANING in device:
conf = device[CONF_DEVICE_AUTOMATIC_CLEANING]
sens = await switch.new_switch(conf)
cg.add(var_dev.set_automatic_cleaning_switch(sens))

if CONF_DEVICE_WATER_HEATER_POWER in device:
conf = device[CONF_DEVICE_WATER_HEATER_POWER]
sens = await switch.new_switch(conf)
Expand All @@ -313,6 +338,16 @@ async def to_code(config):
conf = device[CONF_DEVICE_OUTDOOR_TEMPERATURE]
sens = await sensor.new_sensor(conf)
cg.add(var_dev.set_outdoor_temperature_sensor(sens))

if CONF_DEVICE_INDOOR_EVA_IN_TEMPERATURE in device:
conf = device[CONF_DEVICE_INDOOR_EVA_IN_TEMPERATURE]
sens = await sensor.new_sensor(conf)
cg.add(var_dev.set_indoor_eva_in_temperature_sensor(sens))

if CONF_DEVICE_INDOOR_EVA_OUT_TEMPERATURE in device:
conf = device[CONF_DEVICE_INDOOR_EVA_OUT_TEMPERATURE]
sens = await sensor.new_sensor(conf)
cg.add(var_dev.set_indoor_eva_out_temperature_sensor(sens))

if CONF_DEVICE_WATER_TARGET_TEMPERATURE in device:
conf = device[CONF_DEVICE_WATER_TARGET_TEMPERATURE]
Expand Down Expand Up @@ -387,6 +422,9 @@ 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_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)
2 changes: 1 addition & 1 deletion components/samsung_ac/conversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ namespace esphome
}
}

optional<climate::ClimatePreset> altmodename_to_preset(const AltModeName& name)
optional<climate::ClimatePreset> altmodename_to_preset(const AltModeName &name)
{
if (str_equals_case_insensitive(name, "ECO"))
return optional<climate::ClimatePreset>(climate::CLIMATE_PRESET_ECO);
Expand Down
2 changes: 1 addition & 1 deletion components/samsung_ac/conversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace esphome
FanMode customfanmode_to_fanmode(const std::string &value);

AltModeName preset_to_altmodename(climate::ClimatePreset preset);
optional<climate::ClimatePreset> altmodename_to_preset(const AltModeName& name);
optional<climate::ClimatePreset> altmodename_to_preset(const AltModeName &name);

climate::ClimateSwingMode swingmode_to_climateswingmode(SwingMode swingMode);
SwingMode climateswingmode_to_swingmode(climate::ClimateSwingMode swingMode);
Expand Down
4 changes: 3 additions & 1 deletion components/samsung_ac/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ namespace esphome
{
namespace samsung_ac
{
bool debug_log_packets = false;
//bool debug_log_packets = false;
bool debug_log_raw_bytes = false;
bool non_nasa_keepalive = false;
bool debug_log_undefined_messages = false;
bool debug_log_messages = false;
ProtocolProcessing protocol_processing = ProtocolProcessing::Auto;

// This functions is designed to run after a new value was added
Expand Down
8 changes: 7 additions & 1 deletion components/samsung_ac/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ namespace esphome
{
namespace samsung_ac
{
extern bool debug_log_packets;
//extern bool debug_log_packets;
extern bool debug_log_raw_bytes;
extern bool non_nasa_keepalive;
extern bool debug_log_undefined_messages;
extern bool debug_log_messages;

enum class DecodeResult
{
Expand Down Expand Up @@ -67,11 +69,14 @@ namespace esphome
virtual void publish_data(std::vector<uint8_t> &data) = 0;
virtual void register_address(const std::string address) = 0;
virtual void set_power(const std::string address, bool value) = 0;
virtual void set_automatic_cleaning(const std::string address, bool value) = 0;
virtual void set_water_heater_power(const std::string address, bool value) = 0;
virtual void set_room_temperature(const std::string address, float value) = 0;
virtual void set_target_temperature(const std::string address, float value) = 0;
virtual void set_water_outlet_target(const std::string address, float value) = 0;
virtual void set_outdoor_temperature(const std::string address, float value) = 0;
virtual void set_indoor_eva_in_temperature(const std::string address, float value) = 0;
virtual void set_indoor_eva_out_temperature(const std::string address, float value) = 0;
virtual void set_target_water_temperature(const std::string address, float value) = 0;
virtual void set_mode(const std::string address, Mode mode) = 0;
virtual void set_fanmode(const std::string address, FanMode fanmode) = 0;
Expand All @@ -86,6 +91,7 @@ namespace esphome
{
public:
optional<bool> power;
optional<bool> automatic_cleaning;
optional<bool> water_heater_power;
optional<Mode> mode;
optional<float> target_temp;
Expand Down
Loading