FYI, Check out this post to see how to properly post a code-block.
The example given above had some errors which I commented on. Your own should look something like this:
- alias: auto_light_timer
trigger:
- platform: state
entity_id: light.vtaklampa
to: 'on'
action:
- wait_template: '{{ is_state("trigger.entity_id", "off") }}'
timeout: '{{ (states("input_number.light_timer_minutes") | float * 60.0) | int }}'
continue_on_timeout: true
- condition: template
value_template: '{{ is_state("trigger.entity_id", "on") }}'
- service: homeassistant.turn_off
data:
entity_id: '{{ trigger.entity_id }}'