Custom HVAC MQTT integration

I’m looking for help in developping a climate integration for my HVAC.
I got it to connect to my MQTT server and to control it I just need to publish to a tomic named after my hvac a message with this format :
uc=00&zona=00&valor=abcdef01&envio=movil&uid=1234567

Where in fact the valor is a hexadecimal value that I can build/decode like this :

  • 8bit prefix for each zone
  • 8bit temperature, offeset start from 15°C, each +1 increace in binary corresponds to half a degree, up to 35°C, and for some reason add 1F, so for 15°C we get 1E, 15.5°C 1F, 16°C is 20 and so on…
  • 4 bit to select fan speed (1,2,3 or 4=auto)
  • 4 bit to select mode (1=cool, 2=heat)
  • 4 bit always zero
  • 4 bit to select on or off (3 is on, 2 is off)

The fun part is that if I post this message in MQTT the HVAC will set itself to it, and if someone changes the HVAC with the remotes on the wall, it will itself publish a message with the same format : uc=00&zona=00&valor=abcdef01 (only missing the envio=... part)

So I’m pretty sure there is not so much effort in building a custom integration for this hvac, but from what I see I can’t really reuse the existing HVAC MQTT integration… I’m not the best developper but I am not afraid to dig in and learn, I’m pretty new both with developing an integration or developing an automation.

My current dilema is : either I write a custom integration entirely myself, or my current plan is maybe create a fake HVAC-MQTT device, and use automations to recieve/send in the real topic of my HVAC and transform to/from the mqtt-hvac topic…

But all I got to start from is this thread and the value templates are going to be hell I believe, especially since I’ll have to subscribe to a single topic from my HVAC to feed back in 4 different mqtt-hvac devices… (4 zones, each having it’s own prefix…)

Any advice is welcome !

Probably easiest to create a MQTT HVAC and use scripting engine (eg node-red) to transform the message string to and from JSON.

So from input uc=00&zona=00&valor=abcdef01 transform to a JSON for the MQTT HVAC, eg
{ "mode": 1, "setpoint": 35, "preset": 3 } (topic: my_hvac/status)

And for changes initiated from HA (mode/preset/temp), can create another script to compose the required message that your HVAC understands. In both cases all through the MQTT broker

mode_command_topic: "my_hvac/mode/set"
preset_mode_command_topic: "my_hvac/preset-mode/set"
temperature_command_topic: "my_hvac/setpoint/set"
mode_state_topic: "my_hvac/status"
mode_state_template: "{{ value_json.mode }}"
temperature_state_topic: "my_hvac/status"
temperature_state_template: "{{ value_json.setpoint }}"
preset_mode_state_topic: "my_hvac/status"
preset_mode_value_template: "{{ value_json.preset }}"

Guess it’s easier than writing a custom HVAC integration. Unless you prefer a clean solution.

Thanks a lot @ckxsmart ! I do have nodered installed and running already, didn’t even think of it, but yes it seems way easier to start with that :grin: Will try it out asap, might be a while though, just got a kid to take care of :smiley:,
And as a former PHP dev I recall frustration at using nodered and not finding it easy to simply add some code instead of only relying on nodes and messages, we’ll see how this goes