Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 102659

Sonoff iFan03 as MQTT fan: HA doesn't understand speed state

$
0
0

@barrymossel wrote:

I have configured an iFan03 (with Tasmota) as MQTT fan based on some other topics here at the forum. That results in:

fan:
  - platform: mqtt  
    name: "Plafondventilator"
    command_topic: "cmnd/tasmota_8FAD22/FanSpeed"
    speed_command_topic: "cmnd/tasmota_8FAD22/FanSpeed"    
    state_topic: "stat/tasmota_8FAD22/RESULT"
    speed_state_topic: "stat/tasmota_8FAD22/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.plafondventilator.state == 'off' -%}0{%- elif states.plafondventilator.state == 'on' -%}4{%- endif %}
      {% endif %}
   # optimistic: true
    speed_value_template: "{{ value_json.FanSpeed }}"
    availability_topic: tele/tasmota_8FAD22/LWT
    payload_off: "0"
    payload_on: "1"
    payload_low_speed: "1"
    payload_medium_speed: "2"
    payload_high_speed: "3"
    payload_available: Online
    payload_not_available: Offline
    speeds:
      - "off"
      - "low"
      - "medium"
      - "high"

When I comment the optimistic: true, HA will wait for the state topic before setting state. Unfortunately it doesn’t set speed to 'off'.

Here it is on 'low' and 'on'.
1

Here I set the fan speed to 'off'.
2

The fan turns off, but the speed remains 'low'
3

When I uncomment optimistic: true almost all works as expected. When I change speed to 'off' in the dropdown, the fan turns off AND the speed changed to 'off'. But… when I change the speed to ‘off’ in the Tasmota interface it won’t change speed again (other speeds DO work though).

This is what Tasmota publishes in the state topic:

{"FanSpeed":1}
**qos**  : 0,  **retain**  : false,  **cmd**  : publish,  **dup**  : false,  **topic**  : stat/tasmota_8FAD22/RESULT,  **messageId**  : ,  **length**  : 42

{"FanSpeed":0}
**qos**  : 0,  **retain**  : false,  **cmd**  : publish,  **dup**  : false,  **topic**  : stat/tasmota_8FAD22/RESULT,  **messageId**  : ,  **length**  : 42

So it seems FanSpeed: 1 is understood (as the speed changes to 'low'), while FanSpeed: 0 isn’t understood by Home Assistant?

So what does Home Assistant expect as a value, as '0' isn’t working, maybe 'off'? How would I change speed_value_template to test?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 102659

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>