Setting a delay for use in switch groups

Hello,
I have several switches. Some I have created switch groups for. One example is turning my PC and monitors off and on. I would like, however, a delay before the monitors are turned off. This way I can monitor the shutdown, ensuring all is well.

Here is my current code:

      desktoppc_and_monitors:
        turn_on:
          service: switch.turn_on
          data:
            entity_id: 
              - switch.1_monitors
              - switch.desktoppc
        turn_off:
          service: switch.turn_off
          data:
            entity_id: 
              - switch.desktoppc
              - delay: 00:00:30
              - switch.1_monitors

In this configuration the switch group does not work at all. If I remove the delay then it’s fine.

Does anyone know if it’s possible to get a delay working in this scenario?

Much appreciate any support.

Thank you

      desktoppc_and_monitors:
        turn_on:
          service: switch.turn_on
          data:
            entity_id: 
              - switch.1_monitors
              - switch.desktoppc
        turn_off:
          - service: switch.turn_off
            entity_id: switch.desktoppc
          - delay:
              seconds: 30
          - service: switch.turn_off
            entity_id:  switch.1_monitors

Thank you so much. Works perfectly :slight_smile:
Boyd

1 Like