Need help with brightness automation

I’m trying to make an automation that will turn my light to a certain brightness between a specific time. Technically it works but it looks bad because the light goes to the brightness it was set on last and then goes to the correct brightness. So if it was full brightness before, when I turn it on, it will go to full and then to the correct brightness. Thanks in advance

- id: '1633574137215'
  alias: Bath Lights - Morning
  description: ''
  trigger:
  - platform: state
    entity_id: light.master_bath
    from: 'off'
    to: 'on'
  condition:
  - condition: time
    after: 06:00:00
    before: 08:00:00
    weekday:
    - mon
    - tue
    - wed
    - thu
    - fri
  action:
  - service: light.turn_on
    target:
      entity_id: light.master_bath
    data:
      brightness: 30
  mode: single

Well, the light is actually turned on (to full brightness) before the automation is executed, as it is its trigger.
What actually turn on the light in the first place?

Me turning on the light manually using the switch. I just want to have the light go to a certain brightness whenever I manually turn on the light during a specific time.

You mean a plain switch, that cut power to the light?
Then the initial brightness is decided elsewhere, depending on what kind of light it is (zigbee, hue, …)

the switch is zwave. Whenever I turn the zwave switch on manually, I want it to go to a specific brightness if it’s within a certain time.

I got that part :wink:

Does the switch goes through HA? If so you have to adapt the automation that turn on the light in the first place.
If it’s some kind of direct zwave binding between the switch and the light, IDK

It’s through HA. Any ideas on how to adapt the automation?

If it is so, it is not the automation you showed.
Show the automation that actually turn on the light.

In case all other fails, then a workaround would be to turn on the light with an automation in the middle of the night and set the brightness to 1, then turn off.
That way when you get out of bed it starts at 1 and transition to 30.
That automation could be very annoying if someone is in there at the time the automation runs though.
But you could set the action on a wait until it’s off and delay with 10 seconds, that way if it runs when someone is in there it waits until that person left and another 10 seconds.