Overnight automation seem to not be working recently

Hello all, I have the following automation. Basically turn on the bathroom light when the door sensor opens. Everything works but the conditions. I want this to run overnight (Ex: From sundown Monday to 6:30am Tuesday). This used to work before the .85 upgrade, however, doesn’t seem to work till after midnight sometime.

Can anyone give any advice on how I might handle this? I’ll do 2 automations if I need to, however, i was hoping I could just have the one.

Thank you all for your help!

  • alias: Turn on bathroom lights when bathroom door opens
    initial_state: True
    • entity_id: binary_sensor.master_bathroom_door_binary_sensor
      from: ‘off’
      platform: state
      to: ‘on’
    • condition: state
      entity_id: ‘sun.sun’
      state: ‘below_horizon’
    • condition: time
      before: 06:30:00
    • data:
      entity_id: light.master_bathroom_counter_lights
      service: light.toggle

First, use the " When posting logs or configuration snippets please use code blocks and syntax highlighting." instructions at the top of the page when you post any yaml code or configurations. Otherwise it is really hard to see formating problems.

You can try this, I adapted something I have and used your entity ids.

- alias: 'Turn on bathroom lights when bathroom door opens'
  - platform: state
    entity_id: binary_sensor.master_bathroom_door_binary_sensor
    from: 'off'
    to: 'on'
    condition: and
      - condition: state
        entity_id: sun.sun
        state: 'below_horizon'
      - condition: state
        entity_id: time
        before: '06:30:00'

    service: homeassistant.turn_on
    entity_id: light.master_bathroom_counter_lights

Thank you! I will try this. My apologies for not formatting it properly. I should have caught that when I previewed it.