Light brightness automation

Hi,

i have a simple automation for turn on the light by detecting motion.
there are 3 setups based on the daytime modifying the brightness. Thats working excellent and has just one annoying side effect.

When the automation for turn on light with 20% brightness was triggered, the light turn on with 100% for a millisecond and will then adjusted down to 20% brightness. In a dark room, it looks like lightning and is not good for the eyes.
it is more a question of the sorting and order in which automations are processed?
could someone solve this effect?

Best Reagrds

If you have two automations with the same trigger you have no control over which one fires first.

Better to have one automation and use the choose: option to determine what action to take.

That’s a good hint. i didn’t have this new feature on my focus.
I will update my automation and test it this evening. let’s see if it works and the flickering disappears.

Thank you

There are some lights that always come on at 100%. Hopefully yours aren’t this type (that I have forgotten the brand of).

Hi,
i changed my automation to the “choose” option and delete all other automation for the same light.
My brand for the light is IKEA Tradfri in this case.
The result are a bit astonishing, because the behavoir are now excactly reversed to the first issue.
When the light is triggered the brightness turn on to 20% percent for 1-3 milliseconds and then adjust to 100%. this is not that much annyoing like the flash in the that other case, but for my personal requirement im looking for a perfect solution, if it possible.

Can you post your automation?

If you are using the Ikea Intergration and have multiple bulbs , you can change the brightness on the group rather than the bulbs , this should give a smooth transition . In your automation you can give a transition to solve the “lightning effect”

service: light.turn_on
data:
  entity_id: light.ikea
  transition: 3
  brightness: 100

There is a bug in Ikea intergration. If your bulbs support hue and brightness they cannnot be changed in the same service call. You need to seperate them into two service requests and put a pause between them longer than the transition.

I have a script moodlight.yaml that give me three different moods from an input.select which transitions without a “lightning effect”. I cannot use scences because of the above error . Also i am changing 6 bulbs at once, and using Light groups which changes each bulb in turn, again giving a less than smooth change.

moodlight.yaml

moodlight:
  sequence:
    - service: light.turn_on
      data_template:
        entity_id: light.all_living_room
        transition: 3
        color_temp: >
          {% if states.input_select.light_state.state == "Dark" %}
            454
          {% elif states.input_select.light_state.state == "Relaxed" %}
            420
          {% elif states.input_select.light_state.state == "Bright" %}
            200
          {% endif %}
    - delay: 00:00:05
    - service: light.turn_on
      data_template:
        entity_id: light.ikea
        transition: 3
        brightness: >
          {% if states.input_select.light_state.state == "Dark" %}
            1
          {% elif states.input_select.light_state.state == "Relaxed" %}
            170
          {% elif states.input_select.light_state.state == "Bright" %}
            254
          {% endif %}

Input select

light_state:
    name: Living Room Light State
    options:
      - "Off"
      - Dark
      - Relaxed
      - Bright
      - Unknown
    icon: mdi:lightbulb

Light.ikea is Ikea Group and light.all_living_room is the group of 6 bulbs in HA.

So the trick is change the hue (color_temp) first wait than change the brightness with the ikea group. This will give a very smooth effect , similar to the Ikea App

Hope this helps

Hi,
thanks for your hints.
I’ve found a solution that works like a charm.
Firstable, to put the light into a group should be better for transition and brightness, thats right. Im using deconz zipbee adapter that support groups on the hub and can be focused on the ha.
But the key to prevent the flashing by multiple automation for the same device, is to define a end-time as condition.
In my case i build my automation in that way:
The second automation for the night, put i in a other automation that have a condition for sunrise “above_horizon” that alway works fine.

- id: '1599559525430'
  alias: Küche Licht an
  description: ''
  trigger:
  - device_id: 2f5a06d574fc466782dbf75c23c1ba37
    domain: binary_sensor
    entity_id: binary_sensor.bewegungsmelder_kueche
    platform: device
    type: motion
  condition:
  - after: sunset
    after_offset: -00:45:00
    condition: sun
  action:
  - choose:
    - conditions:
      - after: '21:00'
        before: '23:59'
        condition: time
      sequence:
      - brightness_pct: 50
        device_id: 307a2b760d474c36bd96f1d1b16ebd9d
        domain: light
        entity_id: light.g_kuche
        type: turn_on
    default:
    - brightness_pct: 100
      device_id: 307a2b760d474c36bd96f1d1b16ebd9d
      domain: light
      entity_id: light.g_kuche
      type: turn_on
  mode: single