MQTT fan preset_mode not read from state topic

I have a working MQTT fan (working = I can set the preset), however the preset is not read back from the state topic somehow. I’m using preset_mode_state_topic and preset_mode_value_template but I think I’m doing something wrong. In developer tools (and elsewhere), state_attr("fan.itho_hru_350", "preset_mode") always gives medium.

Does anyone have any pointers? :slight_smile:

MQTT fan config:

  fan:
    - name: "itho_hru_fan"
      device:
        identifiers: ["mqtt", "nrg-itho-28ac"]
        model: ITHO Wifi Add-on
        name: itho_hru_fan_device
      unique_id: itho_hru_fan
      state_topic: itho/lwt
      payload_on: "online"
      payload_off: "offline"
      command_topic: "itho/cmd"
      preset_mode_command_template: "{ vremote: '{{ value }}'}"
      preset_mode_command_topic: "itho/cmd"
      preset_mode_state_topic: "itho/ithostatus"
      preset_mode_value_template: >
       {% set am = value_json['actual-mode'] | int %}
         {% if am == 1 %}
           low
         {% elif am == 2 %}
           medium
         {% elif am == 3 %}
           high
         {% elif am == 13 %}
            timer
         {% elif am == 24 %}
           auto
         {% elif am == 25 %}
           autonight
         {% else %}
           {{ am }}
         {% endif %}
      preset_modes:
       - "low"
       - "medium"
       - "high"
       - "auto"
       - "autonight"
       - "timer1"
       - "timer2"
       - "timer3"

My MQTT looks like (formatted with jq for clarity):

itho/remotesinfo {}
itho/lastcmd
{
  "source": "MQTT API-vremote-0",
  "command": "timer3",
  "timestamp": 2656943
}
itho/ithostatus
{
  "requested-fanspeed_perc": 100,
  "balance_perc": 101.1,
  "supply-fan_rpm": 3100,
  "supply-fan-actual_rpm": 3096,
  "exhaust-fan_rpm": 2857,
  "exhaust-fan-actual_rpm": 2855,
  "supply-temp_c": 23.31,
  "exhaust-temp_c": 23.33,
  "status": 0,
  "room-temp_c": 23.33,
  "outdoor-temp_c": 23.31,
  "valve-position": 0,
  "bypass-position": 1,
  "summercounter": 300,
  "summerday_kmin": 1,
  "frost-timer": 0,
  "boiler-timer": 177,
  "frost-block": 120,
  "current-position": 720,
  "vkkswitch": 0,
  "gheswitch": 0,
  "airfilter-counter": 66,
  "global-fault-code": 0,
  "actual-mode": 13,
  "pir-fan-speed-level": -1,
  "highest-received-co2-value_ppm": 510,
  "highest-received-rh-value_rh": 239,
  "air-quality_perc": 99.5,
  "remaining-override-timer_sec": 13298,
  "fallback-speed-timer_sec": 0,
  "label-out-of-bound-error": 0
}