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

Thanks! Your template really helped me along. I have a “most fans” type, which also doesn’t have a standby mode, and neither a “full” mode. So the following template works beautifully. The only state which may cause confusion in the interface is the off state, where it will stay on but have “Off” selected.

This makes use of the 2.0 version of Communication - Itho — ESP Easy 2.1-beta1 documentation

fan:
  - name: Huisventilator
    unique_id: huisventilator
    command_topic: Itho Controller/Ventilator/cmd
    state_topic: Itho Controller/status
    payload_on: "\nOK"
    percentage_command_template: "itho {{ value }}"
    percentage_command_topic: Itho Controller/Ventilator/cmd
    percentage_state_topic: Itho Controller/Ventilator/State
    percentage_value_template: |
      {% set val = value | int %}
      {{ 1 if val == 1 else 2 if val == 2 else 3 if val in [3, 13, 23, 22] else 0 }}
    speed_range_min: 1
    speed_range_max: 3
    preset_modes:
      - manual
      - timer1
      - timer2
      - timer3
    preset_mode_state_topic: Itho Controller/Ventilator/State
    preset_mode_value_template: |
      {% set val = value | int %}
      {{ "timer1" if val == 13 else "timer2" if val == 23 else "timer3" if val == 33 else "manual" }}
    preset_mode_command_topic: Itho Controller/Ventilator/cmd
    preset_mode_command_template: |
      itho {% if value == 'timer1' %}13{% elif value == 'timer2' %}23{% elif value == 'timer3' %}33{% else %}1{% endif %}
1 Like

Hello do have anyone made the state visual in HA , I have connected the esp easy to the itho box en can Control it with HA only the state is not visable?