Template blueprint for a button

I fail to see what’s the issue and there aren’t many topics on blueprint templates…

2025-01-01 12:48:08.112 ERROR (MainThread) [homeassistant.config] Invalid config for 'template' at templates/blueprints.yaml, line 1: 'variables' is an invalid option for 'template', check: button->0->variables

blueprints.yaml

- use_blueprint:
    path: switch_auto_off.yaml # relative to config/blueprints/template/
    input:
      reference_entity: switch.wled_nightlight
      delay: 5
  name: momentary foo
  unique_id: momentary_foo      
- use_blueprint:
    path: homeassistant/inverted_binary_sensor.yaml # relative to config/blueprints/template/
    input:
      reference_entity: binary_sensor.bureau_motion
  name: Inverted foo
  unique_id: inverted_foo

switch_auto_off.yaml

blueprint:
  name: Momentary button
  description: Create a momentary button out of a switch (relay)
  domain: template
  input:
    reference_entity:
      name: Switch to be triggered
      description: The switch to be set on/off
      selector:
        entity:
          domain: switch
    delay:
      name: Wait time
      description: Time to leave the switch on 
      default: 3
      selector:
        number:
          min: 1
          max: 10
          unit_of_measurement: seconds
variables:
  reference_entity: !input reference_entity

button:
  press:
    - service: switch.turn_on
      target:
        entity_id: !input reference_entity
      data: {}
    - delay: !input delay
    - service: switch.turn_off
      target:
        entity_id: !input reference_entity
      data: {}

  availability: "{{ has_value(reference_entity) }}"

The “Inverted foo” sensor, based upon the builtin example, works :crazy_face: