Template sensor if statment

Hi All,

please can someone help, i can get this to work in the develop tool template but not in yaml?

  - platform: template
    sensors:
      tulia_bedding check:
        friendly_name: "Tulia Bedding check"
        icon_template: mdi:tortoise
        value_template: >
          {% if is_state('timer.tortoise_bedding', 'active') -%}
          {{ as_timestamp(state_attr('timer.tortoise_bedding', 'finishes_at')) | timestamp_custom('%a %d-%m-%Y') }}
          {%- else -%}
          Change bedding
          {%- endif %}

but when i go to check yaml before restarting i am gettng:

Invalid config for [sensor.template]: invalid slug tulia_bedding check (try tulia_bedding_check) for dictionary value @ data[‘sensors’]. Got {‘tulia_bedding check’: {‘friendly_name’: ‘Tulia Bedding check’, ‘icon_template’: ‘mdi:tortoise’, ‘value_template’: “{% if is_state(‘timer.tortoise_bedding’, ‘active’) -%} {{ as_timestamp(state_attr(‘timer.tortoise_bedding’, ‘finishes_at’)) | timestamp_custom(‘%a %d-%m-%Y’) }} {%- else -%} Change bedding {%- endif %}\n”}}. (See ?, line ?).

tulia_bedding check:

The error you’re encountering is due to the use of spaces in the name of the sensor.

tulia_bedding_check:

thankyou @krskrab i was staring at this for 30 minutes, its always something simple