Control RF AC

Hi everybody,

I have a “dumb” air conditioner. It is a mobile AC unit that is only connected during summer and controlled via RF. I use a broadlink adapter to control it, and it has already learned all necessary commands. So I can switch the power, mode, speed, and temperature.

This is already a bit hacky (will explain below), but I got most of it already. What I need now is to run a command x many times, x being the current temperature minus the wish temperature (or plus, depending).

I have found out that the device will always be set to

  • cool mode
  • medium speed
  • 25°C

after a power off. So I can completely power it off via a smart outlet and can be sure that any time it is turned on it is set to 25°C (and also set the input_number in Home Assistant to this value when the smart outlet is switched on). To display the current value, I wrote an automation to increase this input_number value any time I “press” the temperature down button (via broadlink adapter through Home Assistant). So when I press down 4 times, I actually get 21°C on the AC and as the value of my input_number - which is great.

BUT let’s say I want to set temperature via this input_number entity instead of going one degree at the time; if it is at 25°C, and I put it to 17°C, I’d need

  • switch.turn_on => switch.klimaanlage_schlafzimmer_power
  • delay: "00:00:02" (to assure that there is enough time in between sending the RF code via broadlink)
  • switch.turn_on (...)
  • delay: "00:00:02"
  • (…)
  • (8 times total)

I can’t figure out how to do this. I can trigger the automation, but how can I trigger it x times depending on the difference between those two numbers and somehow determine how to determine this number (if current temp > wanted temp it needs to subtract current from wanted, if current temp < wanted temp, it needs to subtract wanted from current and run another automation this many times).

There are other things bugging me about the device, for example, that it will set current temperature to 20°C whenever switching to heat instead of cool, but since we only use it to cool down the room, it doesn’t really matter (though I’d like to have this figured out just for the sake of it). But the main thing I need to figure out now is this input_number math automation problem. Is this possible, and if so, how?

Thank you for your ideas :slight_smile: