Sunrise and Sunset as a trigger but called script gets turned off after 1s

Hi there,

  • I have an automation for Sunrise and Sunset as triggers.
  • The automation runs at the expected times and calls the scripts listed, but the script debugger is saying that the script is being turned off by the same automation that started it.
  • The problem is that the script isn’t finished running and I am left with some exterior devices turned off, but others left on all day after Sunrise.

Am I doing something wrong? Is this a bug in Homeassistant?

Here is the automation:

alias: Sunrise/Sunset With OhmHours
description: ''
trigger:
  - platform: sun
    event: sunrise
    offset: 0
    id: sunrise
  - platform: sun
    event: sunset
    offset: 0
    id: sunset
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: sunrise
        sequence:
          - service: script.sunrise
            data: {}
      - conditions:
          - condition: trigger
            id: sunset
          - condition: not
            conditions:
              - condition: state
                entity_id: sensor.ohm_hour
                state: Active
        sequence:
          - service: script.sunset
            data: {}
          - service: script.victsing_auto_on_play
            data: {}
    default: []
mode: single

Here is the partially executed script:

alias: Sunrise
sequence:
  - service: light.turn_off
    data: {}
    target:
      area_id:
        - 6d821ecb49614ed5b85dd5b091a3e04c
        - in_law_front
  - service: remote.send_command
    data:
      command: Power
      num_repeats: 1
      delay_secs: 1
      device: Victsing
    target:
      device_id: e41882bcb7f8329a3c37084627d94f63
mode: single
icon: mdi:weather-sunset-up

I changed “num_repeats: 1” to “num_repeats: 2” and now the remote.send_command is properly sending the Power command twice.

This is confusing, a repeat of 1 should equal a total of two commands being sent, but this apparently is not the case.