Mqtt fan - esp easy - itho

I just got my esp32/c1101/espeasy hooked up and configured to control my ITHO CVE.
Now looking for controlling this via HA. MQTT FAN seems to be right way to go (MQTT HVAC, is to much).
But for both I can’t seem to find how to display and control preset modes (low, medium, high) from lovelace. Can someone point me in right direction?

Regards.

I used this. Tutorial ITHO Ventilatie bedienen en monitoren met Home Assistant

It is still working great, but i updated today and got attached screenshot. Someone can guide us for the future?

I used the same tutorial :slight_smile:
There are several things not up to date, but got me there.

I got the same warnings, so that’s why I asked how to for the new way to do this.
In the mean time i got most working with the config below.
And used a row of buttons to call the various profiles.
I’m still not completely happy, because my ITHO box (like most it seems) doesn’t support turning it off, So with the config below I tried to get the state right (not on/off, but low/medium/high/…). But still it only shows unknown.

For your question, I think you can adapt the code to the new situation.

mqtt:
  fan:
    - name: ITHOFAN01
      command_topic: "esp-itho_1/FAN01/cmd"
      state_topic : "esp-itho_1/FAN01/State"
      #state_value_template: "{% if value|float==0 %}State 0{% endif %}{% if value|float >0 %}State 1{% endif %}"
      state_value_template: >
        {% if value|float==1 %}
        low
        {% elif value|float==2 %}
        medium
        {% elif value|float==3 %}
        high
        {% elif value|float==13 %}
        timerhigh10
        {% elif value|float==23 %}
        timerhigh20
        {% elif value|float==22 %}
        timerhigh30
        {% elif value|float==0 %}
        unknown
        {% endif %}
      payload_on: "State 1"
      payload_off: "State 0"
      optimistic: true
      preset_modes:
        - "low"
        - "medium"
        - "high"
        - "timerhigh10"
        - "timerhigh20"
        - "timerhigh30"
      preset_mode_command_topic: "esp-itho_1/FAN01/cmd"
      preset_mode_command_template: >
        {% if value == 'low' %}
        State 1
        {% elif value == 'medium' %}
        State 2
        {% elif value == 'high' %}
        State 3
        {% elif value == 'timerhigh10' %}
        State 13
        {% elif value == 'timerhigh20' %}
        State 23
        {% elif value == 'timerhigh30' %}
        State 33
        {% else %}
        State 0
        {% endif %}
      preset_mode_state_topic: "esp-itho_1/FAN01/State"
      preset_mode_value_template: >
        {% if value_json.fan == low %}
        1
        {% elif value_json.fan == medium %}
        2
        {% elif value_json.fan == high %}
        3
        {% elif value_json.fan == timerhigh10 %}
        13
        {% elif value_json.fan == timerhigh20 %}
        23
        {% elif value_json.fan == timerhigh30 %}
        33
        {% else %}
        0
        {% endif %}

Buttons:

type: horizontal-stack
cards:
  - show_name: true
    show_icon: true
    type: button
    tap_action:
      action: call-service
      service: fan.set_preset_mode
      data:
        preset_mode: low
      target:
        entity_id: fan.ithofan01
    name: Low
    icon: mdi:fan
  - show_name: true
    show_icon: true
    type: button
    tap_action:
      action: call-service
      service: fan.set_preset_mode
      data:
        preset_mode: medium
      target:
        entity_id: fan.ithofan01
    name: Medium
    icon: mdi:fan
<<SNIP>>
1 Like