Problem with cover automation state/conditions

For some time I have been using an automation to open downstairs window blinds group when the sun is at a specific elevation and people are at home.

However, now we are at the time of year where sunrises are just after 4.30am I didn’t want the blinds opening so early, so yesterday I added an extra condition to open the blinds no earlier than 6am.

But this morning they didn’t open so, I’m guessing, this is because the automation needs to include some code to re-poll the state of the sun after the time condition is met?

Can anyone please suggest a way of doing this or how to correct my code to get it to work as expected?

alias: Open Blinds
id: open_blinds
mode: single
trigger:
  platform: numeric_state
  entity_id: sun.sun
  attribute: elevation
  above: 0.35
condition:
  condition: and
  conditions:
    - condition: state
      entity_id: sun.sun
      attribute: rising
      state: true
    - condition: time
      after: '06:00:00'
    - condition: numeric_state
      entity_id: zone.home
      above: 0
action:
  - service: script.open_downstairs_blinds

Your automation is only triggered once when the sun goes up and the conditions are not met do to your new time condition. You should try to add a second trigger fireing at 06:00.

You could also do it with a wait template, like this

  action:
    - choose:
        - conditions:
            - condition: time
              before: "06:00:00"
          sequence: 
            - wait_template: "{{ states.sensor.time.state == '06:00' }}"
            - service: script.open_downstairs_blinds
      default:
        - service: script.open_downstairs_blinds
1 Like

Thanks for that. I added the wait template last night and waited for it to run this morning but it didn’t. Looked into my code and I’d forgotten to remove the below part of my original automation

    - condition: time
      after: '06:00:00'

It should work correctly now so thank you.

It didn’t work unfortunately. I had to trigger the action manually via Settings and the action part ran successfully.

Logs show no errors.

This is my full automation and all conditions were met so I’m unsure as to why it’s not worked.

- alias: Open Blinds
  id: open_blinds
  mode: single
  trigger:
    platform: numeric_state
    entity_id: sun.sun
    attribute: elevation
    above: 0.35
  condition:
    condition: and
    conditions:
    - condition: state
      entity_id: sun.sun
      attribute: rising
      state: true
    - condition: numeric_state
      entity_id: zone.home
      above: 0
  action:
  - choose:
    - conditions:
      - condition: time
        before: '06:00:00'
      sequence:
      - wait_template: '{{ states.sensor.time.state == "06:00:00" }}'
      - service: script.open_downstairs_blinds
    default:
    - service: script.open_downstairs_blinds