Help with setting input_select based on brightness attribute

I am trying to set an input_select.select_option based on the brightness of a light. Below is the automation I have been trying to use. Could someone please take a look and let me know if there is something I am missing.

- action:
  - data:
      entity_id: input_select.fanspeed
      option: Low
    service: input_select.select_option
  alias: Living Room Fan Feedback Low
  condition: []
  id: '1518314587628'
  trigger:
  - above: '1'
    below: '85'
    entity_id: light.living_room_fan_61
    platform: numeric_state
    value_template: '{{states.light.living_room_fan_61.attributes.brightness}}'

Thanks,
Randy

I think your value template should be:

{{ state.attributes.brightness | float }}

Or, the more verbose syntax that you were using:

{{ states.light.living_room_fan_61.attributes.brightness | float }}

Alternately, you could try this as a trigger:

trigger:
    platform: template
    value_template: "{{ states.light.living_room_fan_61.attributes.brightness | float > 1 and states.light.living_room_fan_62_attributes.brightness | float < 85 }}"

You may also find that you need to take the single quotes off of your “above” and “below” values so that those fields get interpreted as a number, and not as a string.

Thank you so much for this help! After trying a few different things based on your suggestions I found that the real issue was the single quotes around the “above” and “below” values. I also tested the template you suggested and that worked perfect as well. In the end below is what I ended up going with.

- action:
  - data:
      entity_id: input_select.fanspeed
      option: Low
    service: input_select.select_option
  alias: Living Room Fan Feedback Low
  condition: []
  id: '1518314587628'
  trigger:
  - above: 1
    below: 85
    entity_id: light.living_room_fan_61
    platform: numeric_state
    value_template: '{{state.attributes.brightness}}'

Thanks again!

1 Like