Lovelace Fan Control Entity Row

your speed template is set up incorrectly.

I ended up finding the previous forum to this and that card had a mod for my zigbee fan. Just doing some work on the custom themes from this project to get the colors right now.

I have implemented this with Lutron PD-FSQN and it will always set the speed to medium, despite the entity showing that the states are off,low,medium,high. Do I need to do something else for this device to get the entity row plugin to work properly?

I donā€™t have one of those devices so itā€™ll be hard for me to say exactly what the issue is.

what platform doers that device use? zwave, mqtt, etc?

Did you have to code the config for the fan controller or did it create a ā€œfan.ā€ entity in HA automatically?

Being a Lutron device, Iā€™m not even sure how to answer the question of what type of device it is. They are auto-configured with the Lutron bridge integration into HA. But yes, just auto-configured by HA.

Thatā€™s the answer :wink:

Iā€™m assuming that the integration creates a fan entity in HA that has three speeds (and ā€œoffā€) that are controllable from the pop-up box?

what is the state of the fan entity when the fan is running in some speed? is the state ā€œonā€ or is it the selected speed?

Yes the integration creates the fan entity with the 3 speeds and off. They are controllable through the box and they work properly that way. Additionally when I set it to low or high through the other card, the speed in the Fan Control Entity Row card updates properly. Itā€™s just setting the speed through this card that is apparently causing me issues!

State is: ā€œonā€ and the attribute of ā€˜speedā€™ takes on low, medium or high.

without being able to see the messages being sent around Iā€™m not sure I can even begin to troubleshoot this issue.

I see no reason that particular fan controller should work any differently than any other 3 speed fan entity in HA. And as far as I know I havenā€™t heard of anyone else experiencing similar issues with it.

Can you see the commands being sent between HA and your hub when you change the speeds using the entity row and compare that to the commands when you use the pop up box?

as an alternative, you could create an MQTT template fan and use that to switch the actual fan entity speeds but then you will end up with two entities controlling the same fan which is obviously not ideal.

Otherwise Iā€™m not sure I can help.

I tried to find ā€œFan Control Entity Rowā€ in the Community Hass.io Add-ons and I donā€™t see it. I manually added it but when I reload the UI I get this:

Custom element doesn't exist: fan-control-entity-row.
entity: switch.garageafs_high_speed
type: 'custom:fan-control-entity-row'
name: Garage Air Filter
customTheme: false

I have the js file in the config/www directory and in my ui-lovelace.yaml file I have

title: My Home
resources:
  - url: /root/config/www/fan-control-entity-row.js
    type: js

and also:


      - type: entities
        title: Garage AFS
        show_header_toggle: false
        entities:
        ## USE THIS CONFIG TO HAVE IT MATCH YOUR THEME ##
          - entity: switch.garageafs_high_speed
            type: custom:fan-control-entity-row
            name: Garage Air Filter
            customTheme: false

Right now Iā€™m just trying to test getting the card to display as I have a Sonoff 4 Channel Pro hooked up to an air filtration system that uses 3 separate relays for the speed control. I know Iā€™ll have to do some work to get that actually working correctly but I thought Iā€™d start with the UI first since the individual switches work in the UI now.

Thatā€™s because itā€™s not in the hassio add-ons. Itā€™s installed thru the HACS custom component:

And normally when you have to install components manually and the file is located in the /www/ directory you have to add them to the lovelace config like:

title: My Home
resources:
  - url: /local/fan-control-entity-row.js
    type: js

in this case ā€œ/config/www/ā€ = ā€œ/local/ā€

OK, itā€™s been a few years since I messed with HA so Iā€™m back to being a noob. I had tried using just like in your example and got the error so I thought wasnā€™t finding the js file.

I donā€™t have HACS installed but I think for now Iā€™ve accomplished the same result or should I undo my changes and go through the HACS path?

I always recommend using HACS. It (almostā€¦ :wink:) makes things idiot proof.

As long as you follow the instructions in the install page of HACS for each component exactly as written regarding the way to add it your resources section in Lovelace you will be fine there.

But if you think you have it done correctly otherwise (in the above you donā€™tā€¦) then you can do it that way too.

But HACS is just way easier.

OK, I think installing HACS was more steps than what I did before but I just restarted and the card is loaded properly with the buttons now so thatā€™s a step forward.

Now I just need to figure out how to get this to work with my setup. Each speed is just a different POWER command, Low is Power1, Medium is Power2, High is Power3:

- platform: mqtt
  name: "GarageAFS Low Speed"
  state_topic: "stat/Garage_AFS/POWER1"
  command_topic: "cmnd/Garage_AFS/POWER1"
  availability_topic: "tele/Garage_AFS/LWT"
  qos: 1
  payload_on: "ON"
  payload_off: "OFF"
  payload_available: "Online"
  payload_not_available: "Offline"
  retain: true

Iā€™m not sure how that will work.

You will have to find someway to translate each ā€œspeedā€ into a combined ā€œfanā€ entity that sends the different command topics for each speed and retrieves the fan state and speed for each speed.

you might take a look at my config for converting a ā€œdumbā€ fan that uses an rf transmitter that doesnā€™t have any speed/state feedback into a fan entity for use with the control row.

itā€™s here and the section you are looking for starts on row 41. Be warned that itā€™s pretty long and involved tho:

OK, thanks for the tip. In my old setup I had created an automation (jet_afs.yaml) and then in my groups.yaml I had this:

jet_speed_control:
  name: Jet AFS Speed
  control: hidden
  entities:
    - input_select.afs_speed

This is all from a few years ago so some of those brain cells are dead now :wink:

OK, Iā€™ve been digesting your code and reviewing what I had done a few years ago and fortunately there are a lot of similarities. I do have a couple of questions though:

  • sunroom_fan_off:
      alias: Sunroom Fan Off
      sequence:
        - service: switch.turn_on
          entity_id: switch.sunroom_fan_0
          # data:
            # packet: 'JgA0ACsMKw0PKA8pDygPKQ8oKw0PKA8oDykPAAEGKw0qDQ8pDygPKA8pDygrDQ8oDykPKA8ADQUAAAAA'
        - service: input_boolean.turn_off
          data:
            entity_id: input_boolean.sunroom_fan_state ```
    
    

If youā€™re turning off the fan why do you start with - service: switch.turn_on?

  • In your automations section you have a bunch of toggles where you turn on for 1 second and then turn off. Are those code blocks used anywhere? I think only the script section is actually used and maybe those are for something else?

Scripts are new to me and I currently only have automations defined. Is there a reason to use a script block over an automation block?

Those are really good questions.

Itā€™s been so long since Iā€™ve looked at the code I really canā€™t remember the details anymore.

Iā€™ll have to dig in myself and try to jog my memory.

Or maybe itā€™s all just bad coding that I did a long time back and things need to be changed to make more sense. it really could go either way at this point. :laughing:

OK, I feel the same so no worries! Iā€™m making changes now to see if I can get this to work. I havenā€™t messed with packages before but I can see how useful it is to keep everything in 1 spot.

Iā€™ve got it all working now, itā€™s a bit messy but at least it works. Iā€™m on to my next challenge and thought Iā€™d ask here first before I start from scratch. Iā€™d like to enhance this now so that you have an option to run the fan for a set amount of time. Iā€™m thinking either a fixed button choice for time (say 30, 60, 90min) or a slider that jumps by 30min steps (I want this to be easy to use with a touch screen).

So the fan operation works the same but if you select a time the fan will run for that set time and then turn off.