Use Tradfri Brightness to trigger switch

I have some tradfri bulbs, and also an LED light which can be dimmed.

I have the LED light in homeassistant OK, and I can use a switch on the dashboard to dim it.

What I’d like to do is when I dim the tradfri lights to 20%, I want that to trigger the switch to dim the LED light.

I can’t work out how to do the automation!

Use the numeric_state trigger with the attribute property (brightness is an attribute of the light) and it should trigger below 20.

Thanks. I can’t get it to work, do you put it in automations.yaml? I put the following in and the config errors with
Invalid config for [automation]: [attribute] is an invalid option for [automation]. Check: automation->trigger->0->attribute. (See /config/configuration.yaml, line 13).

trigger:
    platform: numeric_state
    entity_id: light.tradfri_bulb_15
    # Optional
    # At least one of the following required
    below: 30
    # If given, will trigger when the value of the given attribute for the given entity changes
    attribute: brightness
    # If given, will trigger when the condition has been true for X time; you can also use days and milliseconds.
  action:
  - data: {}
    entity_id: switch.strip
    service: switch.turn_on

You are missing an alias for the automation, try like this:

- alias: turn light strip on when brightness below 30
  trigger:
    platform: numeric_state
    entity_id: light.tradfri_bulb_15
    below: 30
    attribute: brightness
  action:
  - entity_id: switch.strip
    service: switch.turn_on

Thanks, I’m still getting the error about attribute being an invalid option.

I’m on v 0.114.1, does that make a difference?

Yes, this feature was introduced in 0.115. Before 0.115 you have to create a template trigger.

Thanks, I updated to 0.117 and got it working. Really appreciate your help.

1 Like