Automatisation: Change light brightness without TURN_ON

Hi,

i like to set the Brightness of my LED-Stripes when its on or off. I do not like to change the power-state. I have serval LEDs for my stairs and like to dimm the brightness based on the sun elevation.

- id: brightness_led_front_entry
  alias: Change Brightness of LED on Door Front Entry depending on Sun Elevation
  trigger:
    - platform: time_pattern
      minutes: "/1"
  condition:
    - condition: template
      value_template: "{{ state_attr('sun.sun', 'elevation') <= 2.5
                          and state_attr('sun.sun', 'elevation') >= -4.5 }}"
  action:
    - service: light.turn_on
      data:
        entity_id: light.wled_eingangstuer
        brightness: '{{ ((230 / (--4.5 + 2.5 + 0.05)) * (states.sun.sun.attributes.elevation + (--4.5 + 0.05))) | int }}'

How to do this without enabling the LEDs?

1 Like

The only way i know to accomplish this is to use the light.turn_on service.
Do you want to avoid to turn on the leds if they are off? Then you have to add some logic to your automation with a condition. For me, building this is easier in node-red since it gives an easier to understand visual representation.

Add a second condition to check if LEDs are actually on. That way you mimic the behavior of the Flux integration.

Most lights can’t change brightness without turning on the light, that’s a hardware limitation.
The ones that are able to do it, have a separate service for this, e.g. LIFX has the service lifx.set_state

I solved that type of feature request:

Every light that is related to the outdoor light (ambient-sensor) i have created a “fake light object” that warps the turn off / turn on commands to the correct light. When forwarding “turn on” i also send the correct brightness value to the correct light.

Can you please share a code sample?