Climate with mqtt - case sensitive modes

Hi. I’m trying to integrate a zwave eurotronic trv actually part of a zwave controller that publish on mqtt broker.
I configured the climate in that way:

  - platform: mqtt
    name: radiatore asia
      - "auto"
      - "heat"
      - "off"
    temperature_command_topic: zipato/zipabox/request/attributes/af304b23-d8c0-4fd6-b08e-db83568beeeb/textValue
    temperature_state_topic: zipato/zipabox/attributes/af304b23-d8c0-4fd6-b08e-db83568beeeb/value
    temperature_state_template: "{{value_json.value}}"
    temp_step: 0.1
    mode_state_topic: zipato/zipabox/attributes/59e5d4bb-7f4e-4c10-b403-10dc1780b8f5/value
    mode_command_topic: zipato/zipabox/request/attributes/59e5d4bb-7f4e-4c10-b403-10dc1780b8f5/textValue
    mode_state_template: >-
      {% set values = { 'AUTO':'auto', 'HEAT':'heat', 'OFF':'off'} %}
      {{ values[value] if value in values.keys() else 'off' }}
    current_temperature_topic: zipato/zipabox/attributes/90392298-595f-4030-9e58-7b2dda812d04/value
    current_temperature_template: "{{value_json.value}}"
    value_template: "{{value_json.value}}"

Unfortunately if I publish the mode listed in the config, I have no reaction from the controller and valve.
Publishing manually in uppercase from dev tools works… so to get it works I have to send the mode value in the mode_command_topic in uppercase… but: it’s possibile? how to do it?

As you have discovered, there no mode_command_template to let you modify what is published.

The simplest workaround, and one I have suggested to several other people facing the same challenge, is to create a ‘middleman’ automation.

Change mode_state_topic to temp/climate/hvac_mode

Create this automation:

- alias: 'hvac_mode controller'
    platform: mqtt
    topic: temp/climate/hvac_mode
    service: mqtt.publish
      topic: zipato/zipabox/attributes/59e5d4bb-7f4e-4c10-b403-10dc1780b8f5/value
      payload: "{{ value | upper }}"

You can change temp/climate/hvac_mode to whatever you prefer. The key thing is that the climate component publishes to a ‘middleman’ topic and the automation publishes a reformatted version of the payload to the zipato topic.

1 Like

Thank you.
Today I’ll do that change :+1:

1 Like