How to Consolidated two sun trigger automation with different offset

Hi guys how to combine this two automation

- alias: Blind open at sunrise
  trigger:
    platform: sun
    event: sunrise
  action:
    service: switch.turn_on
    entity_id: switch.blind
    
- alias: Blind close at sunset
  trigger:
    platform: sun
    event: sunset
    offset: "+01:00:00"
  action:
    service: switch.turn_off
    entity_id: switch.blind

So far thanks to @123 thread I got this far but dont know how to offset +1 hour after sunset on closing. Also multiple events dont seem to work.

- alias: Blind open at sunrise
  trigger:
    platform: sun
    event: 
      - sunrise
      - sunset
  action:
    service: "switch.turn_{{ 'on' if trigger.to_state.state == 'sunrise' else 'off' }}"
    entity_id: switch.blind

Thank you

- alias: Blind open at sunrise
  trigger:
    - platform: sun
      event: sunrise
    - platform: sun
      event: sunset
      offset: "+01:00:00"
  action:
    service: "switch.turn_{{ 'on' if trigger.to_state.state == 'sunrise' else 'off' }}"
    entity_id: switch.blind
1 Like

Sunset and it wot working due to ‘trigger.to_state.state’ is incorrect because it is not a state but an event, what is the correct way for

    service: "switch.turn_{{ 'on' if trigger.to_state.state == 'sunrise' else 'off' }}"

will this work?

    service: "switch.turn_{{ 'on' if trigger.event == 'sunrise' else 'off' }}"
- alias: Blind open at sunrise
  trigger:
    - platform: sun
      event: sunrise
      id: sunrise
    - platform: sun
      event: sunset
      offset: "+01:00:00"
      id: sunset
  action:
    service: "switch.turn_{{ 'on' if trigger.id == 'sunrise' else 'off' }}"
    entity_id: switch.blind