Lovelace Fan Control Entity Row

No, sorry.

Only for fans

1 Like

You can make a template fan using the cover

2 Likes

Thatā€™s a good idea.

But @woody4165, how does your cover get set to the different positions? Does it use percent open/closed or 0-254 settings?

If itā€™s the latter you can make a template light from your cover and use my light-brightness-preset-row. It has programmable presets that you can use for your cover.

1 Like

@finity
cover user a value, as attribute, from 0 to 100
Now Iā€™ve used an input_select to choose some fixed values (i.e. 0,25,50,75,100) where 0 and 100 are closed and openedā€¦

you could convert your cover percent values to 0 to 254 using a very simple math template.

1 Like

Just wanted to reply so others are aware, in latest versions of HA (I am on 0.108.6) this is now done in the Lovelace Dashboards config page, it gives you a warning if you try to add a the top of the raw config.

Configuration > Lovelace Dashboards > Resources > Add new > ā€œ/community_plugin/fan-control-entity-row/fan-control-entity-row.jsā€

Having HACS makes it some much easier than in the past.

1 Like

I fought the HACS iFan02 custom entity for many hours, finally got it working.on 0.109.6
Iā€™m not a code junky, need some visuals, and explanation. Sometimes I will struggle for hours over a bad space, indentā€¦A Picture of a copy of someones valid code helps me figure this stuff out.

Flashed latest Tasmota 8.03 https://tasmota.github.io/docs/
(I needed to power the ifan02 with an external 3.3v battery to configure it. The ifan in run mode draws too much current for my TTL to serial dongle.
Blakadder config ifan02 ifan03 info: https://templates.blakadder.com/sonoff_ifan02.html

Followed the HACS installation process https://hacs.xyz/docs/installation/manual
HACS Fan Plugin: Fan Control Entity Row (ver 1.5) Installed from the HACS Home Assistant Community Store. (HACS store looks similar to Supervisor Add-ons Store)

In the Configuration.yaml ā€œresourcesā€ no longer works for me, so I ā€œ#ā€ it out.

#resources:
#   - url: /local/fan-control-entity-row.js</s>
#     type: module</s>

Saw hints in this thread above about using the new tab ā€œLovelace Dashboardsā€ under Configurations iPanel, Lovelace Dashboards, Resources added url. (see pic below)

url added to Resources

/community/fan-control-entity-row/fan-control-entity-row.js

confguration.yaml
Light

light: 
 - platform: mqtt
    name: "Computer Fan"
    state_topic: "stat/comp_fan/POWER1"  # <------ This worked
#state_topic: "tele/comp_fan/STATE" <-------- didn't work
    value_template: "{{ value_json.POWER1 }}"
    command_topic: "cmnd/comp_fan/POWER1"
    availability_topic: "tele/comp_fan/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false
    

confguration.yaml
Fan

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

Manual View Card added inside Overview UI

type: entities
title: Fans
show_header_toggle: false
entities:
  - entity: fan.computer_fan
    type: 'custom:fan-control-entity-row'
    name: MBR Fan Not Custom
    customTheme: false

I deleted the 1st url below, adding the second url fixed the HACS Fan Control Entity Row add-on

Added Manual Entity Card


Default Fan Card
ScreenHunter_451 May. 17 14.49

Your mileage my vary

1 Like

Thanks for the heads up.

I added basic instructions for installing thru HACS to all three of my repos.

1 Like

If I have 2 fans how do i add them to the same card in Love lace. I can do one fan but if I add another it gives me an error.

can you show me the card config (copy/paste yaml - no screenshots)?

I have had a couple of requests to switch the button order around and make the order ā€œoff-low-med-highā€.

Iā€™m tending to agree that it makes more sense to have it like that since Iā€™ve made a couple of other control rows in the same theme. One of them is a binary control.

the way they are now they follow the same style as this card but since all of the other binary devices in HA have the ā€œonā€ state to the right then I think it makes more sense to switch the binary control row to that style. But Iā€™d like all three of my cards to match in style and that means I would switch the order of the buttons here.

the only real reason Iā€™m hesitant is that the way they are now all of the ā€œoffā€ button are lined up so itā€™s a bit cleaner looking, I think.

Iā€™d like the opinion of anyone who uses any of the cards for feedback on whether they would or wouldnā€™t like the change.

here is how they all look together now:

ex4

I donā€™t think I ever announced the other cards but here they are in case anyone would like to use them:

they are also available to be installed in HACS as a default repo.

Iā€™m loving this, but is there any way to eliminate the space dedicated to the ā€œname:ā€? Ideally, I would have the fan icon, and then immediately next to that controls for ā€œlow, med, high, offā€. Currently, even if I populate the name field with " ", thereā€™s still a hug gap between the icon and the first control.

Thanks!

No way that I know of.

You might be able to do something with a templatable custom card but I wouldnā€™t know how.

Alright, banging my head here maybe someone else can help see whatā€™s wrong?

I had the card working for quite awhile but had a range issue with stupid Hampton Bay Zigbee canopy module so we quit controlling fan in HA for awhile. I just put the new Inovelli fan module in (which showed up as a light but I reconfigured to the fan domain with a template) but canā€™t seem to get the card working again. I donā€™t know if HACS was a thing when I originally setup, I remember I had ā€œfan-control-entity-row.jsā€ in my config/www directory with it setup in Lovelace as " url: /local/fan-control-entity-row.js" with a ā€œtype: jsā€

Today I grabbed the newest JS from the repo, set the resource as a module from Configuration->Lovelace Dashboards->Resources section. I can see the fan controls in Lovelace plain as day but clicking them does nothing. I can open the fan entity and use the drop down to control them like normal though.

What am I missing here? Thanks for any help!

type: entities
title: living room
show_header_toggle: false
entities:
  - entity: fan.living_room_fan
    name: Living room fan
    type: 'custom:fan-control-entity-row'
    customTheme: false

image

the problem is likely with your template. post that here.

fan:
  - platform: template
    fans:
      living_room_fan:
        friendly_name: "Living room fan"
        value_template: "{{ states('light.inovelli_lzw36_fan_light_dimmer_level_2') }}"
        speed_template: >
          {% set output = ['Low','Medium','High'] %}
          {% set idx = state_attr('light.inovelli_lzw36_fan_light_dimmer_level_2', 'brightness') | int // 85 - 1 %}
          {{ output[idx] }}
        turn_on:
          service: homeassistant.turn_on
          entity_id: light.inovelli_lzw36_fan_light_dimmer_level_2
        turn_off:
          service: homeassistant.turn_off
          entity_id: light.inovelli_lzw36_fan_light_dimmer_level_2
        set_speed:
          service: light.turn_on
          entity_id: light.inovelli_lzw36_fan_light_dimmer_level_2
          data_template:
            brightness: >
              {% set mapper = {'Low': 85, 'Medium': 170, 'High': 255} %}
              {{ mapper[speed] }}
        speeds:
          - 'Low'
          - 'Medium'
          - 'High'

try changing you speeds to all lowercase.

the card is expecting lowercase speeds.

If that works then Iā€™ll have to figure out how to deal with that in the card itself.

1 Like

Yep that did it. I never would have figured that out. Thanks for all of it!

1 Like

I think Iā€™ll have to settle for putting a note in the installation instructions for that situation.

I can convert the speed settings to all lowercase in the card before it gets processed but then Iā€™d also have to figure out how to know which format the original speed setting was and convert it back to that to make the actual service call to set the speed. I think thatā€™s going to be way too complicated to figure out how to do that if itā€™s even doable.

thanks for finding that ā€œfeatureā€ :wink: (I canā€™t really call it a bug).

Loving this entity row. Works great.

The only thing Iā€™d like to do is move ā€˜Offā€™ to the left of the three speeds. I tried moving the container for the Off button above the one for Low in the js:

            	  <hui-generic-entity-row hass="[[hass]]" config="[[_config]]">
                    <div class='horizontal justified layout' on-click="stopPropagation">
                    <button
			class='speed'
                        style='[[_offColor]]'
                        toggles name="off"
                        on-click='setSpeed'
                        disabled='[[_isOffState]]'>[[_offText]]</button>
                      <button
			class='speed'
			style='[[_lowOnColor]]'
			toggles name="low"
			on-click='setSpeed'
                        disabled='[[_isOnLow]]'>[[_lowText]]</button>
                    <button
			class='speed'
                        style='[[_medOnColor]]'
                        toggles name="medium"
                        on-click='setSpeed'
                        disabled='[[_isOnMed]]'>[[_medText]]</button>
                    <button
			class='speed'
                        style='[[_highOnColor]]'
                        toggles name="high"
                        on-click='setSpeed'
                        disabled='[[_isOnHigh]]'>[[_hiText]]</button>
		    <button
			class='speed'
                        style='[[_offColor]]'
                        toggles name="off"
                        on-click='setSpeed'
                        disabled='[[_isOffState]]'>[[_offText]]</button>
                  </div>
                </hui-generic-entity-row>

ā€¦but it has no effect at all. Shouldnā€™t this section govern the order that the buttons are displayed in the row?

Is there some other way to do this?