How to program delay from header toggle

I’d like to be able to turn on the header toggle for the outdoor lights and have them all stay on for a set period of time (eg 4mins) and then turn off. I don’t know how to do this and I don’t even know how to access the header toggle state in YAML or for automation. If I turn on any light individually I want it to stay on until I turn it off. Can anyone help me do this? Thank you.

The header toggle isn’t an entity and only exists as a UI element in the card.


Create a Group containing the four lights. Now you can control the state of all four lights by setting the group’s state.

Example:

group:
  outdoor_lights:
    name: Outdoor Lights
    entities:
      - light.front_porch
      - light.front_yard
      - light.back_porch
      - light.back_yard
    all: true

The inclusion of the all: true option is important because of this requirement:

If I turn on any light individually I want it to stay on until I turn it off.

In other words, all lights have to be on in order for the group’s state to report on. Turning on any one light won’t set the group’s state to on when using all: true. This behavior is needed in order to meet your next requirement.

That can be done with a simple automation.

alias: example 1
trigger:
  - platform: state
    entity_id: group.outdoor_lights
    from: 'off'
    to: 'on'
    for: '00:04:00'
action:
  - service: homeassistant.turn_off
    target:
      entity_id: group.your_group

Works perfectly!! Thank you.

1 Like

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions. For more information, refer to guideline 21 in the FAQ.