Control of air cond. Templating?

Have been using the simplest configuration where have an input select for temperatures and an IR blasterto send the codes to air cond. Works but not good enough. Stumbled upon the ToniA heatpump library

https://github.com/ToniA/arduino-heatpumpir which can properly control the air cond and is availabe for the ESP and arduino.

So now i’m thinking of how to utilise this into climate component?
This library expects a 32bit hex number wth the following structure and this can be sent

12345678
  3 MODEL
   4 POWER
    5 OPERATING MODE
     6 FAN SPEED
      78 TEMPERATURE IN HEX

00213416 (as an example of a valid code)
00 = always two zeros
  2 = PanasonicJKE
   1 = Power ON
    3 = COOL
     4 = FAN 4
      16 = Temperature 22 degrees (0x16 = 22)

Wonder if this can be done now?

Want to get rid of mysensors and air cond control is the only thing holding back

are you just trying to make the code? You could make a script and pass all the variables that you want to set:

script:
  code_setter:
    sequence:
      # use a valid service that will use this code
      service: xxx.xxxx
      data_template:
        # replace this section with the correct section, i.e. change code to xxxx.
        code: >
          002{{ power }}{{ mode }}{{ speed }}{{ '%0x'%( temperature | int ) }}

When you use it, call the script and provide the info in the data_template:

  - service: script.code_setter
    data:
      power: 1
      mode: 3
      speed: 4
      temperature: 22
1 Like

FYI here is what it looks like in the template editor

1 Like