Cant create light templates - Configuration validation wont finish-Bug in HA?

I am trying to create Light template following this guide :

I am trying to start with the basic, so I dont F… anything. (Done that before)

Basically just trying to create a light based on a switch. The code really doesnt matter, because no matter what i write under light: ends up with the same problem. Even copying straight from HAs documentation site.

light:
  - platform: template
    lights:
      fridge_spot_light:
      friendly_name: "Lys over kjøleskap"
      turn_on:
        service: switch.turn_on
        data:
            entity_id: switch.on_off_plug_fridge_lights
      turn_off:
        service: switch.turn_off
        data:
            entity_id: switch.on_off_plug_fridge_lights

When i click “Validate configuration” it just spins for ever and never finishes. If i check the logs i get the following error message.

ogger: aiohttp.server
Source: helpers/config_validation.py:750
First occurred: 10:14:44 PM (1 occurrences)
Last logged: 10:14:44 PM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 118, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/core.py", line 29, in post
    errors = await async_check_ha_config_file(request.app["hass"])
  File "/usr/src/homeassistant/homeassistant/config.py", line 877, in async_check_ha_config_file
    res = await check_config.async_check_ha_config_file(hass)
  File "/usr/src/homeassistant/homeassistant/helpers/check_config.py", line 215, in async_check_ha_config_file
    p_validated = platform_schema(p_validated)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 386, in validate_mapping
    cval = cvalue(key_path, value)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable
    return schema(data)
  File "/usr/src/homeassistant/homeassistant/helpers/config_validation.py", line 497, in verify
    return cast(Dict, schema(value))
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 386, in validate_mapping
    cval = cvalue(key_path, value)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 215, in _run
    return self._exec(self._compiled, value, path)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 339, in _exec
    v = func(path, v)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable
    return schema(data)
  File "/usr/src/homeassistant/homeassistant/helpers/config_validation.py", line 750, in validator
    if key in config:
TypeError: argument of type 'NoneType' is not iterable```

I really need to be able to do light templates. Is there anything else i can do to make this work? 

Latest Hass on Rpi4

Compare your code above with the examples in the template light docs.
Indentation matters in yaml!

Indention is correct :slight_smile:

Confirm that you have corrected it from your post above (which is definitely not correct)?

If so, what’s the new error message please?

As mentioned already your indentation is wrong.

Also in this case, to turn a switch into a light, it’s better/easier to use the light switch integration.