Lovelace Fan Control Entity Row

I’ve never done that but I think it should be easy enough with an automation. you could either use a timer entity and start the timer with the desired time duration and turn off the fan when the timer is finished.

Or you could do it with a delay in the automation but I think that needs to be hard coded into the automation. So option one would be better.

You could set the timer duration with an input datetime, input number or input slider. for the input number or input slider you will need two - one for hours and one for minutes since minutes can’t be more than 59 (I think…).

OK, looks like I’m back to the research but I figured it wouldn’t hurt to ask. I think I need to create something that has the timer entity and then change my existing automation to check that timer entity and if set run for that duration and then turn off.

I’ve just released an update to the plugin based ion this (very old :flushed:) issue. I’m really sorry about letting that one slip under the radar for so long…

But it fixes a bug from when I updated it to work with my iFan02 flashed with ESPHome which needed the state (on) to be sent along with the speed command.

I didn’t realize that it would break functionality for other fans,

This update adds an option “sendStateWithSpeed” (which defaults to false) to maintain that functionality for fans that still need it but should restore functionality to those that don’t.

If you update and everything still works then great! You have nothing else to do.

If you find your speed buttons don’t work (especially if you use ESPHome) try adding the new config option back in and everything should then work just like it did before the update.

Hi @finity according, to the github issue.

I’m facing iFan03 problem with latest Tasmota (8.1.0) and MQTT
My OFF button is disabled and doesn’t send stat/RESULT = {“FanSpeed”:0}
All other buttons send correct speeds (1 for LOW, 2 for MID and 3 for HIGH)

When I try to set “off” from dropdown menu in entity view, works fine. The problem is only with button.

Thanks for popping in here for this.

I was just on the verge of closing that other issue and didn’t want you problem to be lost.

But on to your issue…

I don’t know if tasmota has changed anything with the code (I use 6.1.1 I think) but I don’t think it should have changed the basic functionality of the iFan03.

Could you post your code that you have for the iFan03 from HA?

The plugin won’t send stat/RESULT when you click the button. It should send “fan.turn_off” service to your entity_id. Then HA will send a command with 0 in the payload to your speed topic (cmnd/YOUR_TOPIC/FanSpeed) via your MQTT broker. Then when the fan turns off the fan will send a response to the broker to the state topic (stat/YOUR_TOPIC/RESULT) with a {“FanSpeed”: 0} in the payload. and the HA receives that message and sets the state of the fan to off.

At least that’s how mine works.

Do you have an MQTT sniffer to see what the messages are that get sent around when you turn on & off your fan? if not I recommend MQTTFx.

@finity
My HA config:

fan:
 - platform: mqtt
   name: "ifan03-borys Fan"
   command_topic: "ifan03-borys/cmnd/FanSpeed"
   speed_command_topic: "ifan03-borys/cmnd/FanSpeed"
   state_topic: "ifan03-borys/stst/RESULT"
   speed_state_topic: "ifan03-borys/stat/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.ifan03_borys_fan.state == 'off' -%}0{%- elif states.fan.ifan03_borys_fan.state == 'on' -%}4{%- endif %}
     {% endif %}
   speed_value_template: "{{ value_json.FanSpeed }}"
   availability_topic: ifan03-borys/tele/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

Lovelance card config:

entities:
  - customTheme: false
    entity: fan.ifan03_borys_fan
    name: Ceiling Fan
    type: 'custom:fan-control-entity-row'
show_header_toggle: false
title: Borys
type: entities

I’m using MQTT Explorer

you have a typo in your fan config.

state_topic: "ifan03-borys/stst/RESULT"

should be:

state_topic: "ifan03-borys/stat/RESULT"

stst -> stat

try that and see if it works for you.

1 Like

OMG, you’re right!
Now, works like a charm
Thanks and sorry for that

:wink: :+1:

The HACS update today fixed the Lutron issue for what it’s worth!

awesome!

Good to know.

Thanks

Do you mind sharing your config to get this working with a Lutron fan switch? I’m struggling to understand which parts of the provided config I need to update.

Go to Overview > Hamburger Menu (Upper Right) > Config UI > Hamburger Menu (Upper Right) > Raw Config Editor

Add this to the top:

resources:
  - type: js
    url: /community_plugin/fan-control-entity-row/fan-control-entity-row.js

Save this and exit.

Go into the view you want and create a new “Entities” card. Use this as the config but make sure to change your fan entity. You can customize it using the documented theming on the github page.

entities:
  - customTheme: false
    entity: fan.master_bedroom_ceiling_fan
    name: Ceiling Fan
    type: 'custom:fan-control-entity-row'
show_header_toggle: false
title: Fan
type: entities

Hope that helps!

Thank you, that does help! I’m still trying to figure out how to integrate it into my theme but now I understand how this custom card works.

What do you need help with?

I actually just figured it out. I’m using Dwain’s Theme https://dwainscheeren.github.io/lovelace-dwains-theme/

His theme requires any extra components to be setup as addons and I had trouble figuring out the correct syntax. It’s working now though.

Good, because I’ve never used Dwain’s Theme so I would have no idea how to convert the syntax.

Maybe you could post what you did here in case anybody else has the same question…

Sure.

In rooms.yaml under the room that I have the fan I put:

    addons:
      - name: Fans
        icon: mdi:fan
        path: '/dwains-theme/addons/rooms/fans/master_bedroom_fan.yaml'

Then in the path I put:

- type: custom:layout-card
  cards:
    - type: entities
      title: Fans
      show_header_toggle: false
      entities:
        - entity: fan.master_bedroom_ceiling_fan
          type: 'custom:fan-control-entity-row'
          name: Master Bedroom Fan
          customTheme: true

I didn’t have much time to investigate but I was wondering if it’s easy to add another speed to the row? The lutron fan switch has speeds Low, Medium, Medium High, High.

No, sorry. It’s only three speeds.