How Do I Use Fan Switch Speed in Automations?

I know this is probably simple for most but I’m still pretty new to this whole HA thing so I’m missing an important piece of data.

I’m trying to use the various fan speeds in an automation to be able to assign to 4-button remote controls we have. I’ve already programmed the 4 buttons to toggle devices on and off, as necessary. Now I’m onto trying to use double taps, triple taps of the same buttons for other actions. Example, button 2 toggles the fan on and off. I’d like a double tap to set the fan speed to medium, triple tap goes to high and then a long press goes back to low. Most of the time, the tap will toggle it on and off with on being the last speed (I assume this is default behavior) which will almost always be low. On occasion, we may want to access medium or high using the remote and this will allow us to easily process this.

When I go to the device (a GE Z-Wave fan switch) and click on the controls link I see the following pop-up:

There’s all 4 potential settings I need. Perfect.

Now, within the visual automation editor… how do I access these? I read something about using percentages (33% for low, 66% for medium and 100% for high with 0% being off) but I still see nothing from the options I have available to select from. When I select this device, these are the options I have to choose from:

I’ve successfully used the toggle option to create the single tap of the button, same as the other buttons assigned to toggle other devices (lights, etc.) but I don’t see which option will allow for specifying the speed, as stated. If that virtual switch exists as a default multi-position switch upon addition to HA, which are these same options not available in automations? This seems a logical connection but it doesn’t seem to exist. At least not in any simple and easy to understand label for the average newer user, such as myself.

I assume I’m still missing something obvious preventing me from doing something seemingly so simple. What is it?

I think I’ve found it.

For anyone else who finds this via a search (since I wasn’t finding much via searching myself, probably poor keywords) I think you want to choose “Fan” from the add action drop-down and then “Set Speed” from the options.

I think I tried most other options here (mode seems to match up with that virtual soft switch pictured in the first pic of my original post) but I don’t think I tried this specific option before giving up and posting here for assistance.

Once you do that, you should be able to select the device and then set the percentage that relates to the speed, as listed in my original post.

I haven’t yet tested this but wanted to get the info out there before others invested the time to point me in the right direction. I also didn’t want to just delete the post in case it helps others who are searching for this specific information.

It’s really not as simple and straight forward for those new to HA as the rabbit hole has lots of forks and turns and the road signs aren’t typically labeled with the most logical labels and that’s if they even exist at all.

          - action: fan.set_percentage
            entity_id: fan.master_bedroom_ceiling_fan
            data:
              percentage: 50

The trick is indeed to stay away from device actions (unfortunately on top of the list for many of us) but scroll down and and pick the type of device you want to control, such as fan (or light, etc… Then you get choices of what you can do: turn on, turn off, set speed, …

This works for all types of devices. The added bonus is that you can control multiple things in one go. So if you want to turn on multiple lights, you can do so with just one action. That wouldn’t be possible if you had picked a specific device first (before you selected what kind of action you want to perform).

Doing it this way (choosing the type instead of by device) has got me into trouble many times as well. Example: I have a light but it’s controlled by a switch, technically speaking. Most all of my lights are, in fact.

I’m dealing with this right meow because I’m trying to use the default motion sensor option but can’t proceed past the 2nd step since it REQUIRES a light and most all (all?) of my lights are controlled by switches.

A little bit annoying which is only magnified by the fact that every time I create a new automation there’s a short-cut that won’t work for me due to this very fact. I’ve tried to convert the type of the device but that just breaks things downstream for anything I’ve already setup using that previous device type. I just don’t understand why there isn’t a way to also select from switches if the goal for these templates is to make it easier for those newer to HA.

I can’t begin to tell you how much time I’ve wasted trying to implement a devices abilities thinking I did something wrong adding a device because it wasn’t showing up using one of these “easier” methods that actually end up being harder if you aren’t already armed with the more advanced knowledge of how they’re “broken” in the simplest of terms since they’re unable to meet the expectations of a newer user.

I’m finding that a lot, actually. A bunch of the items that were introduced to make things easier aren’t fully formed and therefore don’t indicate where they have shortcomings which actually make it harder for newer users who don’t inherently already understand what these specific shortcomings are or how they apply to their use case.

If your light is represented as a switch in HA there are multiple ways to go about it (hint: there are better ways):

  1. You can pick switch, and control it as a switch. That is what HA thinks it is. You can’t blame Home Assistant for not knowing what the switch controls.

  2. If you are only turning things on or off then can pick ‘generic’ home assistant turn on/off actions. They work on whatever type of entity as long as it supports turn on/off.

  3. ‘Converting’ the switch (what you describe) is what happens if you go to the firmware of the switch and change its type to light. That way the switch entity disappears as you say, (fine if you do it right away, but it will break existing automations you have). Doing that can also break device actions, so it is not a good reason for using those. See below why device actions are considered a bad way.

  4. Use the Switch-as-X integration: it was invented just for this. If you go to the properties of the switch in HA and say it is a light there, it will create a light for you and hides the switch. Because the switch still exists, automations won’t break. But now Home Assistant has a light entity as well that you can control as any other light.

Note that if you ever need to replace a light with a different one, automations using device triggers, conditions and actions will always break. They will not break if you use the method I describe, but rename the entity id of the new entity to what the old one used to be.

Just for the sake of completeness if you have a Tuya TS0601 Fan Switch like THIS to control the speeds (ON/OFF and fan speeds from 1-5) as for the action-part of your automation use i.e. for speed level 3:

  action:
    - action: switch.turn_on
      data:
        entity_id: switch.ts0601_fan_switch
    - data:
        entity_id: number.ts0601_fan_switch_fan_speed
        value: 3
      action: number.set_value