Fan speed off issues (alexa, tasmota, ifan02, mqtt)

Tags: #<Tag:0x00007f73a67a3048> #<Tag:0x00007f73a67a2e90> #<Tag:0x00007f73a67a2d28> #<Tag:0x00007f73a67a2be8>

Hello there!

Trying to get fan integration to work with Alexa and Home Assistant. I’m using Sonoff IFAN02 with tasmota, and it works almost perfectly… even room aware (which is AWESOME as the old way i had it with routines was a pain).

What I’m running into now is the on/off commands are not room aware (in alexa), but the fan speed commands are (weird right?). Anyways, I saw some folks putting in an “off” speed in the fan entity, so I did that, which works in HASS, but Alexa says it’s unresponsive when calling the “set fan speed”. Likewise on the alexa app, if I toggle the fan speed to zero, it gives me an unresponsive, but toggling to 1-3 work fine.

Anyone run into this problem that has been able to solve it? Or am I barking up a tree that just won’t work with the current alexa skill set from amazon?

Thanks in advance for looking!

I used the template posted on tasmota HASS integration website as a basis and added the payload_off_speed: "0" and the -"off" to the speed list.

i’m using the direct alexa/HASS integration found here https://www.home-assistant.io/integrations/alexa.smart_home/

Here is my fan entity:

fan:
  - platform: mqtt  
    name: "Office Fan"  
    state_topic: "stat/Office/RESULT"
    speed_state_topic: "stat/Office/RESULT"
    state_value_template: >
        {% if value_json.FanSpeed is defined %}
          {% if value_json.FanSpeed == 0 -%}0{%- elif value_json.FanSpeed > 0 -%}2{%- endif %}
        {% else %}
          {% if states.fan.office_fan.state == 'off' -%}0{%- elif states.fan.office_fan.state == 'on' -%}2{%- endif %}
        {% endif %}
    speed_value_template: "{{ value_json.FanSpeed }}"
    availability_topic: tele/Office/LWT
    payload_available: Online
    payload_not_available: Offline
    speed_command_topic: "cmnd/Office/FanSpeed"
    payload_off_speed: "0"
    payload_low_speed: "1"
    payload_medium_speed: "2"
    payload_high_speed: "3"
    command_topic: "cmnd/Office/FanSpeed"
    payload_off: "0"
    payload_on: "2"
    qos: 1
    retain: false
    speeds:
      - "off"
      - "low"
      - "medium"
      - "high"

I don’t use Tasmota for the iFan02 anymore (I use ESPHome) but my iFan03 config is as follows:

- platform: mqtt  
    # name: "iFan03-1 Test Fan"
    name: "Sunroom Fan"
    command_topic: "cmnd/iFan03-1/FanSpeed"
    speed_command_topic: "cmnd/iFan03-1/FanSpeed"    
    state_topic: "stat/iFan03-1/RESULT"
    speed_state_topic: "stat/iFan03-1/RESULT"
    state_value_template: >
      {% if value_json.FanSpeed is defined %}
        {% if value_json.FanSpeed == 0 -%}0{%- elif value_json.FanSpeed > 0 -%}4{%- endif %}
      {% else %}
        {% if states.fan.sunroom_fan.state == 'off' -%}0{%- elif states.fan.sunroom_fan.state == 'on' -%}4{%- endif %}
      {% endif %}
    speed_value_template: "{{ value_json.FanSpeed }}"
    availability_topic: tele/iFan03-1/LWT
    payload_off: "0"
    payload_on: "4"
    payload_low_speed: "1"
    payload_medium_speed: "2"
    payload_high_speed: "3"
    payload_available: Online
    payload_not_available: Offline
    speeds:
      - "off"
      - low
      - medium
      - high

and the voice command for setting the speed to 0 is “turn the off”.

thanks! the “turn the fan off” isn’t room aware, so I have to say “turn the office fan off” However, the fan speed IS room aware, so I can just say “set the fan speed to…” It’s a bit confusing to have to switch between room aware and not when turning it off, so I was trying a hacky way of creating an “off” speed.

If I put off in the speed list without creating an “off speed” then it returns a false as an option in the list for some reason. I’m pretty sure I tried it with off in quotations, too, and it did the same thing for me, but I’ll try it again.

I was thinking of trying ESPhome, but I’m not sure if this would address my problem since the config seems to work fine in home assistant as is.

Sorry if I wasn’t clear :slight_smile:

looking at the developer config options and the output on my alexa app, I’m guessing HASS has this setting

              },
              "configuration": {
                "supportedRange": {
                  "minimumValue": 1,
                  "maximumValue": 10,
                  "precision": 1

for Alexa.RangeController

My alexa app shows the off speed as an option, but when I move the slider to it, it’s empty, and it says device is unresponsive. The other speeds have an associated value of 1-3.

Anyone have any idea how to change that minimum value to zero? Would that even be accepted by the rangecontroller function?

I can’t help you with the “room aware” stuff since i’ve never used it for no other reason than it will take some time to try to figure out how to use it. :smile:

But I can’t understand why the “on/off” wouldn’t be room aware when the “set speed” would be. Maybe that’s a question for Amazon?