Adjustable countdown timer to switch off any entity for dashboard

Adjustable countdown timer with a dashboard card that will switch off an entity at a selected amount of time and show a by the minute count down of time left .
**You can also tell google assistant or alexa to turn on office timer for your Last preset time set.
by saying " ok google turn on office timer"
officetimer card

Step 1:
Create a INPUT NUMBER input_number.office and a TOGGLE input_boolean.office_timer
for timer with HELPERS or with yaml.
this will be the timer and switch to activate timer.
in the settings for input number you can set your MIN or Max time to what you want.

Step 2:
Countdown timer template in your template.yaml file
or in configuration.yaml under your template: lines in the proper yaml format and spacing.

change the names of your input number and in the two spots for your input boolean below…

- sensors:
       office_time_remaining:
        friendly_name: 'office Time Remaining'
        unit_of_measurement: "min"
        value_template: >
          {% if is_state('input_boolean.office_timer', 'on') %}
            {{ [ (states('input_number.office')|int - (as_timestamp(now()) - as_timestamp(states.input_boolean.office_timer.last_changed))/60)|round(0) ,0 ] | max }}
          {% else %}
            0
          {% endif %} 

Dont forget to reload Templates entities in the YAML configuration reloading in the YAML section of Developer tools after any changes to your template.

Step 3:

Automate using automation UI or with Yaml

alias: office timer
description: adjust office light lime
trigger:
  - platform: state
    entity_id:
      - sensor.office_time_remaining
    to: "0"
condition: []
action:
  - service: light.turn_off
    data: {}
    target:
      entity_id: light.office_light
  - service: input_boolean.turn_off
    data: {}
    target:
      entity_id: input_boolean.office_timer
mode: restart

Step 4:
Create a Entities card with Dashboard UI or Yaml.
entities card

type: entities
entities:
  - entity: light.office_light
  - entity: input_number.office
  - entity: sensor.office_time_remaining
  - entity: input_boolean.office_timer

With this card you can Select the top Office light timer toggle to turn on/off the light and timer together.

Toggle Just the light on with the Office light Toggle

Or just use the Office timer start toggle to start/stop timer or stop timer if light is already on.

Can you pleas help me?
what am i doing wrong?

what is the issue?
could be your formatting