Make an automation group initial state to off?

I have a group of switch automations I use once a year. I’d like to make the default HA power up state of the whole group to OFF, currently it and all other groups of automations are ON after a system restart or power cycle.

This is my example below from groups.yaml.
I added text inital_state: ‘off’ after name: but this caused an config error when groups were reloaded…
Where did I go wrong ?

  xmas_lights_card:
    name: Xmas lights group
    inital_state: 'off'
    entities:
      - automation.xmas_outdoor_lights_off_via_sw2
      - automation.xmas_outdoor_lights_on_via_sw2
      - automation.xmas_tree_lights_off  
      - automation.xmas_tree_lights_on

I think I’ve struggled with this as well. Perhaps in the each above automation time & date are checked? ie; from Dec 1st through Jan 1st (when I keep mine on, I’m lazy that way) they’ll fire otherwise they won’t?

The first pair of outdoor switch automations are triggered by sun: sunset and sunrise, the second for the tree are by time.

I expected a group automation switch to override any of that like a condition would.
I guess it boils down to if initial_state: is a valid option for a group ?

Unless I’m misunderstanding you - it’s good to use sunset/sunrise and time in this but I think you may also want to include the date as well. As I said, I turn my Xmas lights on from Dec 1st through Jan 1st (wife think they need to be on for that time period, who am I to say otherwise?) so if you added a date check into your automation with the period you would actually run the lights, that might be the final piece to your puzzle and then it wouldn’t matter if the group initially is on or off.

Basically your conditions would be:

  • Sunrise/Sunset
  • Time of Day (for the tree)
  • Date period; XMas only lasts so long so if it’s in that date range, turn it all up otherwise don’t.

That’s how I see the solution anyways :slight_smile:

EDIT: I assume you have an “off” automation for all this too; use the same conditions to ensure they stay off unless conditions are matched.

could you not set the initial_state of each individual automation to false, and then have 1 automation to switch them to on at the given date?

That might work too.

Yes there are a batch of ‘on’ and a batch of ‘off’ automations controlling each switch, and all are inside one group that sets them all on or all off. It’s at the group level that I’d like to have it’s initial state to OFF, otherwise the group is active after a power failure or reset.
There is no start or end date for the automations, and I’d prefer not to create more parameters to have to manage at the switch automation level. I thought it would be one tweak of the group automation, but looks like not so.
Thanks all for the ideas.

No problem. I personally love the flexibility of it all. For example, I turn on my son’s bedroom lights @ 7:30am every weekday (he’s a bear to get up in the mornings…heh…) and I use something similar to what I suggested previously to do it:

- alias: Wakeup Logan
  trigger:
    - platform: time
      at: "07:30:00"
  condition:
    condition: or
    conditions:
      - condition: state
        entity_id: input_select.chris_status_dropdown
        state: 'Home'
      - condition: state
        entity_id: input_select.val_status_dropdown
        state: 'Home'
      - condition: and
        conditions:
          - condition: time
            weekday:
              - mon
              - tue
              - wed
              - thu
              - fri
  action:
    - service: scene.turn_on
      entity_id: scene.logan_bright

In this case, either my wife or myself have to be home. Has to be a week-day (school day) and triggers at 7:30am each weekday. I just figured applying similar logic to your xmas lights would easily solve your problem (granted, initial:off would be easiest.) I find very specific conditions get around some of the “gotchas” that I’ve encountered in HA (whether there by design or by MY design, remains to be seen…:))