Home Assistant Template

Prompt user to confirm toggle of Entity

When switching items like PC’s make sure they meant it and include what is going to happen. So you need to prompt based on the sale of the entity.

You need to use a custom:button-card as the standard card confirmation does not include templating.

The formatting for this is in javascript/jquery an example is shown below note the odd back tick quotes for the strings.

  - type: 'custom:button-card'
      action: toggle
        text: |-
            if (`${entity.state}` == "off")
            return `Turn ${entity.attributes.friendly_name} On?`;
            return `Turn ${entity.attributes.friendly_name} Off?`;
    entity: switch.ebony_viii