Error on HA Dashboard (AppDaemon): Unable to find widget type 'fan' (Xiaomi Air Purifier)

Hello, everyone,
I have the following problem with my HA dashboard (AppDaemon)
I get the error message “Unable to find widget type ‘fan’” on the dashboard when including my xiaomi air purifier ON/OFF button. (Ref Below Image)
X01

My HA>developertools>states says entity as follows: “fan.xiaomi_air_purifier” which I have added to my .dash file.
X02

My Home assistant Front page works OK

Please help
Thanks in advance.

sorry there is no widget type fan.

for all available widget types look at the docs:
http://appdaemon.readthedocs.io/en/latest/DASHBOARD_CREATION.html#widget-reference

1 Like

Thanks for the reply
Is there any work around to bring it as a different widget&make it display?

i dont own a fan, so i dont know how it displays.
but from your picture it seem like it shows up in HA like a switch, so you can just use the switch widget. to turn it on and off.

Like Rene says the switch widget works perfectly fine for on/off

living_temp_sensor:
    widget_type: sensor
    title: Room Temp
    precision: 1  
    entity: sensor.thermometer_lounge

living_aqi_sensor:
    widget_type: sensor
    title: Room AQI
    precision: 0  
    entity: sensor.aqi_lounge

living_air_purifier:
    widget_type: switch
    title: Air Purifier  
    entity: fan.xiaomi_miio_device
    icon_on:   mdi-fan
    icon_off:   mdi-fan-off

Stu

1 Like

Thanks Works Great

1 Like

I am Curious to know how you have added Slider for Unit,Sofa Left, etc.
Am Interested in making one for my TV volume . I use Broadlink RM Pro.
Please guide if you dont mind.
Thanks in advance

the slider is from light with brightness.

to set the volume from your tv with broadlink you can create an input_slider in HA
then you can use the slider widget to use it.

you then also can use the heater widget which is a combination from a slider and a switch.
so you could switch the TV on and off and change the volume with the same widget.

1 Like

Is HADashboard dying? There’s been no fan widget for ages and no updates for a while either.

@easwaran83 there is a new dashboard in town called TileBoard - New dashboard for Homeassistant. It has a fan widget with speed selection too, and it looks pretty good with new features being added quickly. However, needs knowledge of JS. It is intimidating considering it is not very human readable. But worth considering if you’re just starting out on your dash.

nope HAdashboard is still very alive.
a specific fan widget is in most cases not needed, because you can use the switch or input_select widget for it.

there has not been an update for a few months, thats true, but a program that is in the big part ready doesnt need a regular update. Andrew has been very busy in real life lately, so development has been a little slow, but almost everything can be done with dashboard and AD at the moment, so updates will only be improvements.

Tileboard is nice but HAdashboard is way more easy with extreme flexibility.

1 Like

A fan widget would be nice for those of us with Insteon fan controllers.

In order to use a switch, you need three different widgets; one each for low, med and high. It would be really nice to have these all on a single widget instead, potentially with a slider for the speed that just has three positions.

the fan entity is very different for all kind of fans.
so a general widget is very hard to do.

in your case you only need 1 input_select.
1 with off/low/med/high

or you use the input_slider widget and use an input_slider in HA.
setting 0 for off
setting 1 for low
setting 2 for medium
setting 3 for high.

for both ways you can create automations that do change the fan speed.

Let me play with that a bit… It looks like I’ll need to define an input_select and write some automation to tie that into the fan devices. The Insteon Fanlinc shows up as separate switches for each level, i.e. switch.master_bedroom_fan_high, switch.master_bedroom_fan_med, and switch.master_bedroom_fan_low.

Something like:

input_select:
  master_bedroom_fan_speed:
    name: master_bedroom_fan_speed
    options:
    - high
    - med
    - low
    - off
automation:
  master_bedroom_fan_high:
    trigger:
      platform: state
      entity_id: input_select.master_bedroom_fan_speed
      to: high
    action:
      service: switch.turn_on
      entity_id: switch.master_bedroom_fan_high.turn_on
  master_bedroom_fan_med:
    trigger:
      platform: state
      entity_id: input_select.master_bedroom_fan_speed
      to: med
    action:
      service: switch.turn_on
      entity_id: switch.master_bedroom_fan_med.turn_on
  master_bedroom_fan_low:
    trigger:
      platform: state
      entity_id: input_select.master_bedroom_fan_speed
      to: low
    action:
      service: switch.turn_on
      entity_id: switch.master_bedroom_fan_low.turn_on
  master_bedroom_fan_off:
    trigger:
      platform: state
      entity_id: input_select.master_bedroom_fan_speed
      to: off
    action:
      service: switch.turn_on
      entity_id: switch.master_bedroom_fan_off.turn_on

right, but i think your entity_id isnt “switch.master_bedroom_fan_off.turn_on” but “switch.master_bedroom_fan_off”

but with that in HA you have an input_select in HA that you can change and it does what you want.
and that input_select can be put on the dashboard.

You’re right – cut-n-paste-and-retype error. :slight_smile: I’m going to give it a try tomorrow, and I’ll update the post with how it works.

1 Like

I still don’t have the slider working, but after a couple hours of beating my head against a wall I have a working input_select that updates properly when the fan is adjusted through some other method (i.e. a wall switch or app).

What I haven’t figured out how to do yet is use a slider. If I try and use input_number or input_slider, it wants a number How do I map off/low/med/high to 0/1/2/3?

I also just found a race condition in the below code. It can get into a situation where Hass can get into a battle with whatever else is changing the fan speed because the update automation lags behind the input_select. I just had a fan toggling between off and high for a few moments which can’t be good for the motor. I need figure out how to fix that (suggestions welcome). I don’t know if it’s due to the automations or hadashboard.

Here are the config changes:

sensor:
  # Fanlincs
  - platform: template
    sensors:
      office_fan_speed:
        friendly_name: "Office Fan Speed"
        value_template: "{{ states.fan.office_fan.attributes.speed }}"

input_select:
  # Ceiling fan input_select for hadashboard
  office_fan_speed:
    name: Office Fan Speed
    options:
    - high
    - medium
    - low
    - "off"
    initial: 'off'
    icon: mdi:fan

automation:
  - id: update_office_fan_speed
    alias: Office Fan Speed Update
    trigger:
      platform: state
      entity_id: sensor.office_fan_speed
    action:
    - service: input_select.select_option
      data_template:
        entity_id: input_select.office_fan_speed
        option: '{{ states.sensor.office_fan_speed.state }}'
  - id: office_fan_off
    alias: Office Fan Off
    initial_state: true
    trigger:
      platform: state
      entity_id: input_select.office_fan_speed
      to: 'off'
    action:
    - service: fan.turn_off
      entity_id: fan.office_fan
  - id: office_fan_set_speed
    alias: Office Fan Set Speed
    initial_state: true
    trigger:
    - platform: state
      entity_id: input_select.office_fan_speed
      to: 'low'
    - platform: state
      entity_id: input_select.office_fan_speed
      to: 'medium'
    - platform: state
      entity_id: input_select.office_fan_speed
      to: 'high'
    action:
    - service: fan.set_speed
      entity_id: fan.office_fan
      data_template:
        speed: '{{trigger.to_state.state}}'

the input slider would be set the same way as you now use the input select.
in the automation you now set the value from the input select, but you could change that to the value from an input_slider.

there is always a circular problem, when you want to use several ways to set a state.
and thats because you dont update a state but you change it.

it isnt because of the dashboard, because all that does is change the state from the HA input_select.
it doesnt matter if you change it in the ha frontend (which is a website that has elements to change the state) or if you use a dashboard (which has elements that change a state)

i notice 1 thing though.
you use a sensor to change the state from the input_select
and you use the input_select to change the fan state.

why use the sensor?
cant you use the fan state or use the fan speed as trigger?

Hmm… I could change the input_state to an input_slider, but having 0, 1, 2, 3 for the fan values isn’t all that intuitive. But it might be my only choice if there isn’t a way to map values to integers hidden somewhere in Hass.

I need to see what Hass is doing when the race condition happens, if I can reproduce it. I have a hunch I may have changed speeds from a KeypadLinc before the state change got processed by Hass and it sent the automations into a loop.

I have to have a sensor for the update automation. Since the fan speed is an attribute of fan.office_fan rather than a state, there isn’t a way to trigger the update automation to update the value with whatever the fan is currently doing. As far as I can tell, it’s the only way to get the current fan state into Hass – i.e. if someone walks over to the wall switch and sets the fan to low, I want to make sure that the dashboard updates to low rather than sitting at “off”.

you can use a template trigger (i just read it in the docs)

some examples i see there are:

  trigger:
    platform: numeric_state
    entity_id: sensor.temperature
    # Optional
    value_template: '{{ state.attributes.battery }}'
    # At least one of the following required
    above: 17
    below: 25
  alias: "Exterior Lighting on when dark outside"
  trigger:
    platform: numeric_state
    entity_id: sun.sun
    value_template: "{{ state.attributes.elevation }}"
    # Can be a positive or negative number
    below: -4.0
  action:
    service: switch.turn_on
    entity_id: switch.exterior_lighting
automation:
  trigger:
    platform: template
    value_template: "{% if is_state('device_tracker.paulus', 'home') %}true{% endif %}"

so you can listen to the fan speed attribute directly.
the least that would do is make things faster.