Lovelace Fan Control Entity Row

I have it all in configuration.yaml
In the editor I fiddle with identations and dashes until it gives the green light, then save it, and check it for validity in the settings. Right now I changed it to this, which is fine in the editor, but not ok when I check it:

fan:
  - platform: template
    fans:
      sunroom_fan:
        friendly_name: "Sunroom Fan"
        value_template: "{{ states('input_boolean.sunroom_fan_state') }}"
        turn_on:
            service: remote.send_command
            data:
              entity_id: remote.broadlinkrm4_remote
              device: ventilator
              command: s1
        turn_off:
            service: remote.send_command
            data:
              entity_id: remote.broadlinkrm4_remote
              device: ventilator
              command: uit
        set_speed:
 
        speeds:
          - off
          - low
          - medium
          - high
          
        input_select:
            sunroom_fan_speed:
            name: Sunroom Fan Speeds
            options:
               - 'off'
               - 'low'
               - 'medium'
               - 'high'

Gives this error:

invalid config for [fan.template]: [input_select] is an invalid option for [fan.template]. Check: fan.template->fans->sunroom_fan->input_select. (See ?, line ?).

A big problem for me is right now that I honestly don’t know what I am doing and don’t know when and why I need to indent or apply dashes. But I’m good at copying and pasting :wink: Must be terrible for you all to see folks struggling with what should be obvious. Tried to find some tutorial texts to educate myself, but that is a challenge too…

Thanks for your time!

I’m not sure which editor you’re using but it obviously isn’t a reliable indicator of HA syntax if it didn’t give an error.

try it like this (especially see the indentation for input_select:):

fan:
  - platform: template
    fans:
      sunroom_fan:
        friendly_name: "Sunroom Fan"
        value_template: "{{ states('input_boolean.sunroom_fan_state') }}"
        turn_on:
            service: remote.send_command
            data:
              entity_id: remote.broadlinkrm4_remote
              device: ventilator
              command: s1
        turn_off:
            service: remote.send_command
            data:
              entity_id: remote.broadlinkrm4_remote
              device: ventilator
              command: uit
        set_speed:
        speeds:
          - off
          - low
          - medium
          - high
          
input_select:
  sunroom_fan_speed:
    name: Sunroom Fan Speeds
    options:
       - 'off'
       - 'low'
       - 'medium'
       - 'high'

input_select: is a top level domain just like fan: so it should be all the way left too.

1 Like

And indeed that works a lot better :wink: I actually found the online docs for fan_template where indeed input_select is not an option - so the error message was well deserved. Moved things around a bit. Continued my work and found the script creator in HA itself, and rather that stuffing all the script parts in my configuration.yaml, I entered them there. That went pretty good. Had to scratch my head a bit how to fit in the service_template part of the sunroon_fan_on script, but luckily that interface also had a button to edit the underlying yaml, so I could paste it in. Long story short, my buttons work, change color, turn on the fan at the right speed, all pretty neat!

BTW, I use the build in editor of HA, from the left hand menu. Oh, and sure I sometimes forget to reload scripts, but thats fine as it keeps me reminding that I should not forget to do that.

There is one little thing I need to figure out, and that is - if I click on the buttons 1-2-3 and off too fast, it sometimes indicates as if the fan is turned on, but in fact it is off. In the javascript, at the bottom, I see that the setspeed function first sets the fan off, and then sets the new speed. Not sure why is that. I am tempted to modify thing a bit, and move the turning off part to the sunroom_fan_on script, and extend the if/else to 4 choices, including the ‘off’ speed. Well, perhaps I better if I first enjoy what I have now :wink:

It is really very entertaining stuff, all this. It’s still a lot of abracadabra but I’m hopeful…

Thanks for the pointers - it really helped.

Cheers, Frank

That’s there only if the Off button pressed on the control row.

I originally only had the “turn_off” service called but then someone had a fan that didn’t have a “turn_off” function but turned the fan off by setting the speed to off. So I added that to handle both scenarios.

It shouldn’t have the effect that you are seeing so I don’t think it’s related.

1 Like

@finity Interestingly, I found a similar issue yesterday:

My fan is connected to HA via a Hunter RF kit & a Bond bridge. This particular combination supports fan.turn_off, but passing speed: off to fan.set_speed in fact sets the fan to low (HA & Bond do not realize this).

Would you be open to a patch that performs the set_speed call first, followed by the turn_off call?

If I understand the various edge cases properly, that should work for both:

  • Fans that do not support the turn_off service
  • Fans that support turn_off and respond incorrectly if set_speed is passed off.

I’ve gone ahead and opened https://github.com/finity69x2/fan-control-entity-row/pull/37 for this

As an FYI, I jusdt released an update to allow the medium speed button to be hidden for use with two speed fans.

the two remaininjg speeds need to be “low” & “high” for the row to work.

@torrancew

I’m still looking at the PR. Thanks for creating that.

Fan control for dummies (via relais)
I did install this component via HASC and created the logic for two states to change the value of
input_select.ventilation_fan_speed. But nothing happens , either if I trigger the states from outside via scripts or I push a button of the card.
The input looks as this:

options:
  - 'off'
  - low
  - medium
  - high
editable: true
friendly_name: MVC Ventilation Mode
icon: 'hass:fan'

The card as follows:

type: entities
title: MVC Ventilation
show_header_toggle: false
entities:
  - entity: input_select.ventilation_fan_speed
    type: 'custom:fan-control-entity-row'
    name: MVC Fan speed
    customTheme: true
    customHiText: high
    customLowText: low
    customMedText: not
    customOffText: 'off'
    isOnMedColor: '#111111'
    isTwoSpeedFan: true

As I am still a newbie it might be that I missed something rather trivial.

First, you need to create a “fan” entity. This plugin only works with fan entities. It won’t work with input_selects.

THX finity, I wasn’t aware about the fan class entity in HA. It works now, but I can only set the fan to low speed, If I push on Medium or High buttons, the speed goes for one second to the correct one, but than to the Low speed again. Very strange to me. I also see that my automations doesn’t work.
see: https://pastebin.com/B4sVZK0K
Here as well the scripts: https://pastebin.com/tUzWwNSz
And the fan itself: https://pastebin.com/embed_iframe/0q7zgCC1

there is a lot wrong with that config. I’m really not sure where to begin…

you don’t ever seem to be turning on any switches to control the actual fan speeds. the only place I see any reference to a speed is in the fan turn on script and then it’s only for low speed.

you are turning on and off scripts but I don’t see anywhere in those scripts that you are turning any switches.

Have you seen my github gist that shows fan configs?

If not see here.

start looking at around line 44 for setting up the fan controls.

ok, did found the issue about not to able to switch to High. The Automations where not yet complete because I wanted having first the manual mode running.

With the latest release 2021.3.1 and the changes to the template: fan , does this component still work? I only ask because I don’t want to ugrade if it’s going to break on me…Wife doesn’t like when that happens. LOL.

Any input is appreciated. Thanks!

Still works for me with existing template. I haven’t figured out the new templating yet but everything works just some warnings about being deprecated.

1 Like

What really sucks is that with the change in the control scheme for fans I may need to create a whole new plug-in to deal with the percentages. that way people who don’t want to upgrade can still use the existing plugin because I can’t think of a way to test which version of HA people are running.

So it will likely be easier to just create two versions.

Once I figure out what the right syntax is for everything I’ll start working on it. But no one who knows has answered any questions in the release thread yet (or anywhere else).

1 Like

@cybergrimes

Can I ask what HA version you are running (HA OS, supervised, core, container)?

I updated a couple of test version (one Supervised and another Container) and I’m getting different results between the two.

In the Supervised version the fans and controls still work.

But in the container version I am getting a bunch of errors for the fans and they won’t even show up as entities.

I can’t see why there would be a difference between Container or supervised tho. They are supposed to be identical in the core implementations.

I’m running HA OS

The problem was discovered in the issue report an discussed the other thread.

You need to put quotes around the “off” speed in your speeds list.

I had it in two out of three of my HA installs. The one that didn’t have it was the one that failed.

I still don’t know why that one didn’t have the quotes but I completely missed that difference.

I’m still fighting to get my template converted. It’s weird, I can still use the fan control entity row to set any speed and see it on the new percentage slider but if I use the slider I only get low and high to work. Set the fan control entity row to medium, slider says 67, set slider to 67 and nothing happens. This is all using my old template that I haven’t converted to the new 2021.3 config yet. I’ve got something going with the new config and the 67 percent doesn’t work there either but does give an error at least. Going to open an issue.

1 Like

I haven’t even started yet.

I go back to work tomorrow and, ironically, that means I’ll have a lot more time to work on it. :laughing:

2 Likes