HVAC with custom Tasmota and raw payload

Hi
I have here a little bit unusual situation. I have WiFi enabled portable HVAC that was using Tuya. Because I didn’t like the app and I wanted to have more direct integration in HA without relying on external clouds, I thought it would be great to put Tasmota there. But because I’m not familiar with all those weird modification things ;), I asked my brother to help with it. And he did modify it. I do have generic Tasmota there, it’s detected in Tasmota integration and I can send payloads to manage it.

The issue I’m having are the payloads. I need to send raw data, like a51101ff11f5 to power HVAC on. And now I wonder, how can I use this knowledge to integrate this into HA? I don’t want to ask brother again because he already did a lot with it. :stuck_out_tongue:
I found that there are those two things that looks like they could be used somehow:

But in both cases I don’t have enough knowledge to try to execute it. For example, I tried this for MQTT HVAC:

climate:
  - name: KlimaPrzenosna
    fan_modes:
      - 'low'
      - 'high'
    modes:
      - 'off'
      - 'cool'
      - 'dry'
      - 'fan_only'
    temperature_unit: 'C'
    power_command_topic: 'cmnd/klimaprzen/SSerialSend5'
    payload_on: 'a51101ff11f5'
    payload_off: 'a511010012f5'
    mode_command_topic: 'cmnd/klimaprzen/SSerialSend5'
    mode_command_template: 'a51201{{ value.mode }}{{ value.chksum }}f5'
    fan_mode_command_topic: 'cmnd/klimaprzen/SSerialSend5'
    fan_mode_command_template: 'a51601{{ value.mode }}{{ value.chksum }}f5'

I didn’t define all the things because I wanted to first check what it would exactly do. And the only thing that I’ve manage to achieve it to power on/off from Thermostat card, because there’s a clear way to define both states as opposed to other functions, which requires some templating. And yes, the topic is the same for all things that sends to HVAC. That’s one of the reasons I’m not sure how to approach this. I know it has to be done with templates somehow but I don’t know how to send values in {{ values.mode }} and {{ value.chksum }} or rather - from where those values should came from.
And it’s going to be even more troublesome when I’ll try to set temperatures because of the checksum that’s needed in each payload. It is constant for each command and payload but the best would be to have some sort of function to calculate it on the fly with formula: (command + payload length + payload) % 256, e.g. for powering on it would be: (11 + 01 + FF) % 256 = 11.

There’s also a way to get info from it using tele/klimaprzen/RESULT which results in something like A5 00 0D 00 01 00 1B 16 00 01 000000000000 40 F5, which in this case translates to:

  • it’s powered off 00,
  • cooling mode 01,
  • sleep mode is off 00,
  • current temp (27C) 1B,
  • temp set (22C) 16,
  • unknown 00,
  • fan speed is low 01.

Which I didn’t even start to think how I could put into HA. :smiley:

For the moment I’ve manage to cook something like this:

climate:
  - name: KlimaPrzenosna
    fan_modes:
      - 'low'
      - 'high'
    modes:
      - 'off'
      - 'cool'
      - 'dry'
      - 'fan_only'
    temperature_unit: 'C'
    min_temp: 16
    max_temp: 26
    temp_step: 1
    temperature_command_topic: 'cmnd/klimaprzen/SSerialSend5'
    temperature_command_template: 'a51401{{ "%0x" % value|int }}{{ "%0x" % (21 + value|int) }}f5'
    power_command_topic: 'cmnd/klimaprzen/SSerialSend5'
    payload_on: 'a51101ff11f5'
    payload_off: 'a511010012f5'
    mode_command_topic: 'cmnd/klimaprzen/SSerialSend5'
    mode_command_template: >
      {% if value == "off" %}
        a511010012f5
      {% elif value == "fan_only" %}
        a512010316f5
      {% elif value == "dry" %}
        a512010215f5
      {% else %}
        a512010114f5
      {% endif %}

It does work although there’s a weird behaviour for changing temp by using circle on thermostat card - is there a way to make it work on release? Currently moving from min value to the max value sends all the temps that are between. I don’t think that’s optimal and would be better to send data when the the knob is released, to send final data.