Shelly dimmer 2 automation doesn't set the brightness initially but turning on and off the switch works

I’ve a shelly dimmer 2 in the en suite, set so that the dimmer goes to 30% during the night and back to 100% during the day. There’s a plain light switch controling it.

In the day time, all is good.
At night, when you switch the light on at the switch, it comes on at 100%, but when you turn it off and back on a few seconds later it goes to 30% as expected.

In the short term, I’ve set it to a detached switch, but I’d rather use the single switch setting as if HA goes down when someone needs to use the windowless ensuite, they won’t be able to turn on the light.

alias: Dim the En Suite overnight
description: ""
trigger:
  - type: powered
    platform: device
    device_id: <device id>
    entity_id: binary_sensor.shellydimmer2_<id>_channel_1_input
    domain: binary_sensor
condition: []
action:
  - if:
      - condition: time
        before: "09:00:00"
        after: "00:30:00"
    then:
      - service: light.turn_on
        data:
          brightness_pct: 30
        target:
          device_id: <device id>
    else:
      - service: light.turn_on
        data:
          brightness_pct: 100
        target:
          device_id: <device id>
mode: single