Zigbee Button & Fan Automation

Hello friends!

I ordered one of those 1-key Zigbee button… LINKIND ZB Button
I was able to get the button to work to turn on/off lights.

But I’m thinking of trying to get it to work with my smart FAN. My fan has 3 speeds, low, med and high.
Can you please assist me in creating an automation that for every button press it will go through those speeds one by one in sequence – low, med, high, off. Is this possible? I just don’t know how to start.

Thanks in advance!

Straight forward solution(not the optimal);

  • create 3 automations same with each button click trigger
  • place different conditions to each as fan state low, med, high
  • in each automation, move to next state as low to med, med to high, high to low

Optimal solution is to go with one automation as;

  • triggered based on click event
  • in actions, have an action as choose
  • create three conditions as state equals to low or med or high
  • for each condition, set actions to move next state as from low to med, med to high, high to low

I cannot get the fan.toggle to work:


  • conditions:
    • condition: state
      entity_id: fan.master_bedroom_fan
      state: ‘on’
    • service: fan.increase_speed
      entity_id: fan.master_bedroom_fan
  • conditions:
    • condition: state
      entity_id: fan.master_bedroom_fan
      state: ‘off’
    • service: fan.toggle
      entity_id: fan.master_bedroom_fan
      default: []

I really could not get CHOOSE to work. I gave up! LOL
I ended up doing 3 separate automation. Which is fine for as long as it works, right?!

I have a zwave button and I use the following for an automation that steps thru the speeds on each button click.

I’m still on 2021.6.x so I can’t guarantee that it will still work when the new fan speed setting schema (removing the set-speed service) fully goes into effect.

  - alias: Turn MBR Fan On With Scene Switch
      - platform: event
        event_type: zwave.scene_activated
          entity_id: zwave.mbr_scene_switch
          node_id: 35
          scene_id: 1
          scene_data: 0
      - service: fan.set_speed
          entity_id: fan.master_bedroom_fan
          speed: >-
            {% if states('fan.master_bedroom_fan') == 'off' %}
            {% elif states('fan.master_bedroom_fan') == 'on' and state_attr('fan.master_bedroom_fan', 'speed') == 'low' %}
            {% elif states('fan.master_bedroom_fan') == 'on' and state_attr('fan.master_bedroom_fan', 'speed') == 'medium' %}
            {% elif states('fan.master_bedroom_fan') == 'on' and state_attr('fan.master_bedroom_fan', 'speed') == 'high' %}
            {% endif %}