Sunrise / Sunset trigger

I created an automation that automatically streams my camera to my Nest Hub. Here I also mentioned at sunset this should be streamed. In addition, I also have a trigger that sends the stream to e.g. should stop automatically after 5 minutes. For the day it’s no problem if I start the stream at 12:00 and stop it at 12:05, it works fine.

At sunset I don’t have any time that I can fix. I am now looking for a command to automatically stop the stream 5 minutes after sunset. Anyone have an idea how this works?

image

And with this trigger, the stream starts at sunset with another automatisation and will end 5 minutes after sunset with this automatisation? I tried to test it, but everytime i run it the cast stops instantly.

Does it need a + before like +00:05:00?

There are always a # of different ways to do things in HA. The ‘simplest’ is to have two automations - one to turn ON / start the cast and another to turn OFF / stop the cast.

I believe you only need a hyphen before the time if you want to subtract (before), adding time doesn’t require a plus (I guess it’s understood). Here are two of my automations:

- id: '1601250284166'
  alias: Halloween - OFF - Sunrise +30min
  description: ''
  trigger:
  - platform: sun
    event: sunrise
    offset: 00:30:00
  condition: []
  action:
  - service: homeassistant.turn_off
    data: {}
    entity_id: group.morning_off_halloween_lights
  mode: single

- id: '1601250342797'
  alias: Halloween - ON - Sunset -30m
  description: ''
  trigger:
  - platform: sun
    event: sunset
    offset: -00:30:00
  condition: []
  action:
  - service: homeassistant.turn_on
    data: {}
    entity_id: group.all_halloween_lights
  mode: single

First one turns OFF lights 30 minutes AFTER sunrise and 2nd turns ON the lights 30 minutes BEFORE sunset. Hope this helps.