litinoveweedle / SmartIR

⏻ Control Home Assistant climate, media and fan devices via IR/RF controllers (Broadlink, Xiaomi, MQTT, LOOKin, ESPHome)
MIT License
45 stars 12 forks source link

Fix RC3 logic #43

Open klimofey opened 1 week ago

klimofey commented 1 week ago
litinoveweedle commented 1 week ago

Hello, thank you for PR. I would like to understand what is the use case you are proposing to implement. If I understand your changes correctly, you are proposing changes to implement very specific Electra IR remote control. It seems, that it differs a lot from how currently supported AC units works.

Could you please describe in detail how Electra IR works and what is the use case behind your PR?

P.S.: I am not too much in favor of implementing features used only on specific type of AC units. This would be nightmare to maintain in longer term. Also I am currently working on preset modes support and most of the changes are exactly at the same place like your PR.

klimofey commented 1 week ago

@litinoveweedle

Hi, yes, of course I will describe the changes

I solved several issues.

  1. When I change something while the air conditioner is turned off, a shutdown command is sent with the specified values. In my air conditioner, the same command also turns it on. Therefore, I added a field in the air conditioner file that would disable sending shutdown commands when turned off.
  2. There is no single command to turn on my air conditioner. When sending a power-on command, the entire set of variables of the current mode is immediately transmitted. Therefore, when I switch modes with the air conditioner already turned on, I use the “regular” commands, and when I need to turn on the air conditioner from the off state with the specified settings, use the command from the “on” field
  3. Added a file with codes for Moes UFO-R11 for my air conditioner
litinoveweedle commented 1 week ago

Thank you for an explanation.

  1. That is actually seems like bug. I will check this, I probably know from where this is coming from.
  2. This is normal behavior and most of the AC unit are working in this way. Only one code including all the setting shall be sent.
  3. Clear, thank you
klimofey commented 1 week ago

@litinoveweedle

  1. ok
  2. ok

  1. Did not quite understand. Now if I send a command from the off state to cooling, for example, then the command cold + intensity + temperature is sent

But for the air conditioner to accept this command, it must first be turned on. If I add "on" next to the "off" command, it is sent every time the temperature changes. It turns off my air conditioner if it was on and vice versa.

That's why I added commands to turn it on from the off mode and switch the air conditioner already in the on mode. At the same time, I left the option of simply specifying the code in the temperature, and not the dictionary

litinoveweedle commented 5 days ago

So let me rephrase your issue. Your device has same command for "on" and "off", therefore if defined as 'on' command it will cause AC to switch off, if already on. The problem here is, that this whole integration only assume states of the device, and therefore to be sure 'on' and 'off' commands are send always.

I could add condition, than when on and off commands are same, than if will not be send if device state is already assume i the required state. Would this solve your issue?

klimofey commented 4 days ago

Yes, this will partially solve the problem If you use this approach, then you need to add a point that when you turn on the AC from the off state, you need to send two commands. First the "on" command, and then the command for a specific temperature state and other things. If already enabled, then yes, only the command to switch the temperature state. And to turn off - only shutdown commands

This will be simpler than my approach, but it seems to me that if the AC enable command already contains the necessary characteristics, then calling two commands instead of one is a crutch :)

litinoveweedle commented 4 days ago

Hello,

That point is already there, as I mentioned previously. If dedicated 'on' command exists it is always sent first, followed by modes and temperature combined command. So modification for sending 'on' command only if it is the same as 'off' command and if the device is in off state is relatively simple. In your case, the following combined modes and temperature command should never contain the 'on' bit. Because if it would, then you do not need this change at all - simply removing the 'on' command would fix your issue.