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

Samsung AC - send "clean" only on power off #78

Closed
bogd opened this issue Jun 5, 2022 · 16 comments
Closed

Samsung AC - send "clean" only on power off #78

bogd opened this issue Jun 5, 2022 · 16 comments

Comments

@bogd
Copy link

bogd commented Jun 5, 2022

I have an issue that is somewhat specific to my unit (a Samsung AC) . On this device, the "clean" function seems to be a unit-level toggle - which means that every single time I send an IR code with "clean": "on", the unit will toggle between "on" and "off" for this function.

This means that if I set "clean: on" when turning on the unit, there will be one toggle to "on" when powering on, and another one, to "off", when turning off the unit. And since the whole point of the feature is to be active on shutdown, this does not work.

Looking through the custom component's code, I was able to identify a "default_clean_mode", and there is also a "clean" attribute for the HA entity. However, I do not know what I could do to set the attribute to "on" only when powering off. Setting to "on" immediately after turning the AC on also does not work - because all future IR codes (including the ones for changing the temperature, for example) will also toggle the "clean" function, making the end result unpredictable.

Is there a way to do this (send "clean": "on" only on power off) with the current component? If so, can anyone advise on how it could be accomplished?

Thank you!

@nao-pon
Copy link
Collaborator

nao-pon commented Sep 11, 2022

This issue has already been fixed in the IRremoteESP8266 v2.8.0 release. This is included in Tasmota 10.0.0.3 and later.

@nao-pon
Copy link
Collaborator

nao-pon commented Sep 11, 2022

Oh, I may have misunderstood. If your Tasmota is 10.0.0.3 or newer, we will need to do something on the Tasmota-IRHVAC side.

@bogd
Copy link
Author

bogd commented Sep 11, 2022

@nao-pon - I updated to the latest version (12.1.1), and I am still seeing the same issue. The problem is that Tasmota-IRHVAC assumes that whatever command is sent to the AC is the full state. An absolutely normal assumption, and one that should work with pretty much every AC unit out there. However, this unit is kind of... "special" in the fact that it treats "clean" as a toggle.

For now, I worked around the issue by always sending "clean: off" when using Tasmota-IRHVAC, and adding a HomeAssistant automation that sends an additional "clean: on" message whenever Tasmota-IRHVAC detects an "off" IR signal (coming either via Tasmota-IRHVAC, or from the original remote). It works reasonably well, but I would really appreciate the option of having more granular control over when Tasmota-IRHVAC sends the "clean": "on" message.

On a similar note (and not really worthy of opening a separate issue for it) - is there a way of controlling the "Light" parameter via Tasmota-IRHVAC? It seems to always send "Light" : "on", which is a bit annoying on some of my devices.

@nao-pon
Copy link
Collaborator

nao-pon commented Sep 12, 2022

When I checked the source code of IRremoteESP8266, Beep and Clean are toggles, and there is no difference in operation regardless of whether On/Off is sent. And it seems that On is a toggle and Off is an action that does nothing. So not sending those data might solve this problem.

Please let me know how it works if you comment out the Beep and Clean in the following code.

payload_data = {
"StateMode": "SendStore",
"Vendor": self._vendor,
"Model": self._model,
"Power": self.power_mode,
"Mode": self._last_on_mode if self._keep_mode else self._hvac_mode,
"Celsius": self._celsius,
"Temp": self._target_temp,
"FanSpeed": fan_speed,
"SwingV": self._swingv,
"SwingH": self._swingh,
"Quiet": self._quiet,
"Turbo": self._turbo,
"Econo": self._econo,
"Light": self._light,
"Filter": self._filters,
"Clean": self._clean,
"Beep": self._beep,
"Sleep": self._sleep,
"Clock": int(_min),
"Weekday": int(_dt.weekday()),
}

#            "Clean": self._clean,
#            "Beep": self._beep,

Also, regarding light, it remembers the data sent by the remote control of the device and sends it every time. Therefore, please turn off the Light with the remote control of the device and send it.

Alternatively, it can be controlled by the HA service call tasmota_irhvac: set_light. You can send it through the developer tools service.

Note: It is mandatory to restart HA after changing the code.

nao-pon added a commit to nao-pon/Tasmota-IRHVAC that referenced this issue Sep 16, 2022
This is a setting that does not transmit the data if the On transmission
is a toggle operation of a function, and if tasmota_irhvac sends On each
time it does not result in normal operation. If you want a toggle
action, it can be sent by the service.

dnt_send_list: #optional - default []
    - Beep
    - Clean
    - Econo
    - Filter
    - Light
    - Quiet
    - Sleep
    - SwingH
    - SwingV
    - Turbo
nao-pon added a commit to nao-pon/Tasmota-IRHVAC that referenced this issue Sep 16, 2022
This is a setting that does not transmit the data if the On transmission
is a toggle operation of a function, and if tasmota_irhvac sends On each
time it does not result in normal operation. If you want a toggle
action, it can be sent by the service.

dnt_send_list: #optional - default []
    - Beep
    - Clean
    - Econo
    - Filter
    - Light
    - Quiet
    - Sleep
    - SwingH
    - SwingV
    - Turbo
@nao-pon
Copy link
Collaborator

nao-pon commented Sep 16, 2022

@bogd I created PR #93 which may fix this issue. Could you please use the branch nao-pon:dnt_send_key and test the behavior with the following options?

First you need to apply the branch nao-pon:dnt_send_key , then restart HA, add the option and restart HA again.

Please wait while I change my approach and recreate it.

@nao-pon
Copy link
Collaborator

nao-pon commented Sep 19, 2022

bogd I created PR #94 which may fix this issue. Could you please use the branch nao-pon:toggle_list and test the behavior with the following options?

    toggle_list: #optional - default []
      # The toggled property is a setting that does not retain the On state.
      # Set this if your AC properties are toggle function.
      #  - Beep
      - Clean
      #  - Econo
      #  - Filter
      #  - Light
      #  - Quiet
      #  - Sleep
      #  - SwingH
      #  - SwingV
      #  - Turbo

First you need to apply the branch nao-pon:toggle_list , then restart HA, add the option and restart HA again.

nao-pon added a commit to nao-pon/Tasmota-IRHVAC that referenced this issue Sep 19, 2022
@nao-pon
Copy link
Collaborator

nao-pon commented Oct 12, 2022

@bogd Can you help me with the verification? It will be merged when the operation check is completed. Thanks!

@bogd
Copy link
Author

bogd commented Oct 12, 2022

@nao-pon First of all, my apologies for the very late reply! Real life got in the way, and I simply forgot about this!

I have tested the fork, and I was unable to get it to work. Since it might be something that I am doing wrong, I am listing below all the steps I took, and what I wanted to accomplish.

  1. Installing the fork - I simply cloned https://github.com/nao-pon/Tasmota-IRHVAC/tree/toggle_list (seems to have only one branch), and copied the custom_components folder under my HAss config directory
  2. Changing the settings - my AC config now looks like this (it is unclear if the elements in the toggle_list are case-sensitive, so I kept the case from your example)
    platform: tasmota_irhvac
    unique_id: bedroom_ac
    # ...
    supported_swing_list:
    - "off"
    - vertical #up to down
    toggle_list:
    - Clean
    hvac_model: "-1" # string value

Now the part that is a bit unclear is "how do I actually send the message?" . Because, toggle or not, it still needs to be sent so that the unit will clean itself when turning off.

What I tried:
a. Sending the "clean" message as part of turning the unit off. Doesn't appear to work - as soon as I add "clean", the service is no longer called correctly (nothing happens on the AC unit). So I assume this is not valid syntax:

# From an automation:
  action:
  - service: climate.set_hvac_mode
    entity_id: climate.bedroom_ac
    data:
      hvac_mode: "off"
      #clean: "on"

b. Setting "default_clean_mode" to "on":

# from my configuration.yaml
    celsius_mode: "On" #optional - default "On" string value - you can remove it
    default_light_mode: "On"
    default_clean_mode: "on"

In this case, the unit behaves just like before (not entering cleaning mode on power off). And looking at the tasmota console for the IR unit, I see that the "clean" message is never sent to the unit (not even on power off):

10:11:06.865 MQT: stat/ytf-02/RESULT = {"IRHVAC":{"Vendor":"SAMSUNG_AC","Model":-1,"Mode":"Cool","Power":"On","Celsius":"On","Temp":29,"FanSpeed":"Auto","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"On","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}}
10:11:14.101 MQT: stat/ytf-02/RESULT = {"IRHVAC":{"Vendor":"SAMSUNG_AC","Model":-1,"Mode":"Cool","Power":"On","Celsius":"On","Temp":30,"FanSpeed":"Auto","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"On","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}}
10:11:14.499 MQT: stat/ytf-02/RESULT = {"IRHVAC":{"Vendor":"SAMSUNG_AC","Model":-1,"Mode":"Off","Power":"Off","Celsius":"On","Temp":30,"FanSpeed":"Auto","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"On","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}}

@nao-pon
Copy link
Collaborator

nao-pon commented Oct 12, 2022

Thank you for validating!

Here's my scenario:

  • The set value of clean mode is memorized by the AC itself.
  • If AC clean mode is set to ON, it will switch to clean mode every time it stops unless clean mode is turned off.

I think it works fine under these conditions. If your AC does not meet this requirement, we need to rethink how it is implemented.

To set the clean mode from OFF to ON, use the AC device remote control or call the following service from the HA. However, since the clean mode setting is a toggle, sending an On signal from the On state will turn it Off.

service: tasmota_irhvac.set_clean
data:
  clean: "on"
target:
  entity_id: climate.bedroom_ac

@bogd
Copy link
Author

bogd commented Oct 12, 2022

I think I know what the issue is...

Here's my scenario:

  • The set value of clean mode is memorized by the AC itself.
    This might actually be a wrong assumption. The setting seems to be memorized only during a powered-on cycle.

For example:

  • I turn on the AC, with "clean": "on". The "clean" setting is now on for this cycle
  • I turn off the AC, with "clean": "on". The "clean" setting is turned off, and no self-cleaning is performed.

HOWEVER! (and yes, I will admit that this is a very weird implementation...)

  • I turn on the AC, "clean": "off"
  • I turn off the AC, "clean": "on". The cleaning cycle is performed - and this seems to reset the "clean" flag on the unit, because...
  • I turn on and off the AC again, no cleaning cycle.
  • If AC clean mode is set to ON, it will switch to clean mode every time it stops unless clean mode is turned off.
    Not really. With AC clean set to on, it will start a clean session when powered off. But after that, it seems to reset the "clean" setting to off.

However, you might have provided an alternative for me here:

service: tasmota_irhvac.set_clean
data:
  clean: "on"
target:
  entity_id: climate.bedroom_ac

I could use that to turn on clean mode manually when powering the unit off. The one thing that is not 100% clear is what else tasmota-irhvac sends in the same command ("clean" cannot really be sent by itself, the system needs to send a full state to the AC, including mode and temperature). I assume that it will simply resend the stored values, but I have to check that.

@hristo-atanasov
Copy link
Owner

If you set the log level for Tasmota Irhvac to debug, you can see the full payload sent from Home Assistant to Tasmota in home-assistant.log . Also you can see the full payload in Tasmota console.

@nao-pon
Copy link
Collaborator

nao-pon commented Oct 12, 2022

HOWEVER! (and yes, I will admit that this is a very weird implementation...)

  • I turn on the AC, "clean": "off"
  • I turn off the AC, "clean": "on". The cleaning cycle is performed - and this seems to reset the "clean" flag on the unit, because...
  • I turn on and off the AC again, no cleaning cycle.

This behavior should work with my fix. With Clean mode added to the toggle list, Tasmota Irhvac will not send Clean On during normal operation. Only send Clean On when calling the service.

Also, if that doesn't work, as @hristo-atanasov said, watch the logs to see what commands were sent and what the problem was.

@bogd
Copy link
Author

bogd commented Oct 12, 2022

@nao-pon - just to clarify:

  1. When you say "send Clean:On when calling the service", you are referring to calling tasmota_irhvac.set_clean manually, right? Because climate.set_hvac_mode seems to send Clean:Off on both turning on and off the unit.
  2. Is there a recommended setting for default_clean_mode with Clean in toggle_list?

@hristo-atanasov - could you please elaborate? I know how to get the payload from the Tasmota console (and I sent it above), but I do not know how to get it from the HAss logs.
Is it something like this?

# configuration.yaml
logger:
    homeassistant.components.tasmota_irhvac: debug

@bogd
Copy link
Author

bogd commented Oct 13, 2022

I can confirm that I can get the desired behavior by calling tasmota_irhvac.set_clean while the unit is running.

Steps I normally use when using the original remote control:

  1. Turn on unit
  2. Enable self-cleaning
  3. Turn off unit (the self-cleaning cycle starts)

Resulting IR codes:

07:43:45.378 MQT: tele/ytf-02/RESULT = {"IrReceived":{"Protocol":"SAMSUNG_AC","Bits":168,"Data":"0x02920F000000F001D20F0000000001D2FE719011F0","Repeat":0,"IRHVAC":{"Vendor":"SAMSUNG_AC","Model":-1,"Mode":"Cool","Power":"On","Celsius":"On","Temp":25,"FanSpeed":"Auto","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"On","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}}}
07:43:52.872 MQT: tele/ytf-02/RESULT = {"IrReceived":{"Protocol":"SAMSUNG_AC","Bits":112,"Data":"0x02920F000000F001B2FEF19211F0","Repeat":0,"IRHVAC":{"Vendor":"SAMSUNG_AC","Model":-1,"Mode":"Cool","Power":"On","Celsius":"On","Temp":25,"FanSpeed":"Auto","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"On","Filter":"Off","Clean":"On","Beep":"Off","Sleep":-1}}}
07:44:00.927 MQT: tele/ytf-02/RESULT = {"IrReceived":{"Protocol":"SAMSUNG_AC","Bits":168,"Data":"0x02B20F000000C001D20F0000000001F2FE719011C0","Repeat":0,"IRHVAC":{"Vendor":"SAMSUNG_AC","Model":-1,"Mode":"Cool","Power":"Off","Celsius":"On","Temp":25,"FanSpeed":"Auto","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"On","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}}}

Same behavior, obtained via tasmota_irhvac:

  1. Turn on unit using climate.set_hvac_mode
  2. Enable self-cleaning using tasmota_irhvac.set_clean
  3. Turn off unit using climate.set_hvac_mode

Resulting IR codes:

07:44:19.101 MQT: stat/ytf-02/RESULT = {"IRHVAC":{"Vendor":"SAMSUNG_AC","Model":-1,"Mode":"Cool","Power":"On","Celsius":"On","Temp":25,"FanSpeed":"Auto","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"On","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}}
07:44:26.100 MQT: stat/ytf-02/RESULT = {"IRHVAC":{"Vendor":"SAMSUNG_AC","Model":-1,"Mode":"Cool","Power":"On","Celsius":"On","Temp":25,"FanSpeed":"Auto","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"On","Filter":"Off","Clean":"On","Beep":"Off","Sleep":-1}}
07:44:31.100 MQT: stat/ytf-02/RESULT = {"IRHVAC":{"Vendor":"SAMSUNG_AC","Model":-1,"Mode":"Off","Power":"Off","Celsius":"On","Temp":25,"FanSpeed":"Auto","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"On","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}}

This does work very well, and it solves my original issue. Thank you!!

This just leaves the question regarding how default_clean_mode affects tasmota_irhvac behavior in this case - is there a recommended value for this setting?

[Edited to add] And the question regarding how to enable debugging for tasmota_irhvac. I know this is not strictly related to this issue, but it will help in the future, if any other issues pop up :)

@nao-pon
Copy link
Collaborator

nao-pon commented Oct 13, 2022

It seems to work fine, so I'm merging PR #94.

This just leaves the question regarding how default_clean_mode affects tasmota_irhvac behavior in this case - is there a recommended value for this setting?

Attributes in the toggle_list are always set to "Off", ignoring their default values. Sends On only when called on the Set Attribute Value service.

And the question regarding how to enable debugging for tasmota_irhvac.

The easiest is to use logger's log level setting service.

The easiest is to use logger's log level setting service. You can view it in Settings - System - Logs "Read full log". Search for "tasmota_irhvac" if necessary.

nao-pon added a commit that referenced this issue Oct 13, 2022
Fix #78 Add new option `toggle_list`
@bogd
Copy link
Author

bogd commented Oct 13, 2022

Thank you once again, @nao-pon , for your help on this issue! And thank you once again for taking the time to explain the logging part - that will definitely help troubleshooting in the future!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants