Automation Trigger based on Fan %

Hello all,
Im trying to make a trigger for an Insteon fanlinc that is based on the % the fan is running. Here is what I got and its not working.

The scenes work as intended when activated independently so its gotta be the trigger im messed up on. Any advice on how to solve this?
  - id: Master_Fan_high
    alias: Master Fan High
    trigger:
      platform: numeric_state
      entity_id: fan.fanlinc_51_d0_cd_fan
      above: .75
    action:
      service: scene.turn_on
      entity_id: scene.M_Fan_High
      
  - id: Master_Fan_Med
    alias: Master Fan Med
    trigger:
      platform: numeric_state
      entity_id: fan.fanlinc_51_d0_cd_fan
      above: .33
      below: .75
    action:
      service: scene.turn_on
      entity_id: scene.M_Fan_Med
      
  - id: Master_Fan_Low
    alias: Master Fan Low
    trigger:
      platform: numeric_state
      entity_id: fan.fanlinc_51_d0_cd_fan
      below: .33
      above: 0
    action:
      service: scene.turn_on
      entity_id: scene.M_Fan_Low

Try adding leading zeros to your numbers.

Check the developer tools state pages for the actual state of your fan. Is it 0.75 or is it 75% ?

What do you mean “not working”? You do realise that the automation only triggers when the threshold is crossed. So if your fan is between, say, 0.33 and 0.75 all day, nothing will change.

I’ve tried both leading 0’s and doing it as percentages. Neither are working.

I understand that the thresholds need to be crossed to trigger it.

Here is what Im trying to do. When you use a voice assistant or an app to set the fan speed update the buttons. The scenes work as intended. Just not the automation that triggers the scene.

To follow up. When I check the states page it just lists as ON not a %. Any ideas?

That’s because of this:

Your state is on/off not speed.

Look at the far right right column on the states page. Which attribute has the speed?

Or is there a seperate fan sensor with the speed?

right side shows

speed: low
speed_list: off,low,medium,high
INSTEON Address: 51.D0.CD
INSTEON Group: 2
friendly_name: Master Bedroom Fan
supported_features: 1

I just changed the configuration to those values. However its still not triggering the automation.

the weird thing is off works as intended.

  - id: Master_Fan_high
    alias: Master Fan High
    trigger:
      platform: state
      entity_id: fan.fanlinc_51_d0_cd_fan
      to: 'high'
    action:
      service: scene.turn_on
      entity_id: scene.M_Fan_High
      
  - id: Master_Fan_Med
    alias: Master Fan Med
    trigger:
      platform: state
      entity_id: fan.fanlinc_51_d0_cd_fan
      to: 'medium'
    action:
      service: scene.turn_on
      entity_id: scene.M_Fan_Med
      
  - id: Master_Fan_Low
    alias: Master Fan Low
    trigger:
      platform: state
      entity_id: fan.fanlinc_51_d0_cd_fan
      to: 'low'
    action:
      service: scene.turn_on
      entity_id: scene.M_Fan_Low

  - id: Master_Fan_Off
    alias: Master Fan Off
    trigger:
      platform: state
      entity_id: fan.fanlinc_51_d0_cd_fan
      to: 'off'
    action:
      service: scene.turn_on
      entity_id: scene.M_Fan_Off

That is because the speed is an attribute not the state of the fan. You need to either use a template trigger to trigger on the attribute or create a template sensor and trigger on that.

E.g.

    trigger:
      platform: template
      value_template: "{{ is_state_attr('fan.fanlinc_51_d0_cd_fan', 'speed', 'high') }}"

Do this for the other speed automations but leave the off automation as it is. Triggering on the state of the fan for that one is correct.

First thank you for the help, im only a few weeks into this and can only research so much on my own. I updated with your code and am getting this error.

Error loading /config/configuration.yaml: mapping values are not allowed here
in “/config/automations.yaml”, line 5, column 21
Line 5 is the value_template line

  - id: Master_Fan_high
    alias: Master Fan High
    trigger:
     platform: template
      value_template: "{{ is_state_attr('fan.fanlinc_51_d0_cd_fan', 'speed', 'high') }}"
    action:
      service: scene.turn_on
      entity_id: scene.M_Fan_High

Add one space to the platform indentation. It is not indented far enough (should be two spaces under the trigger).

1 Like

thats it. THANK YOU. This automation is finally working.

Redacted. Failed to read the entire thread before posting …

1 Like