Service with template is not working

Hi, I am trying to call service,light.turn_on, from Developer Tools but it is not working. Template is working and verified in developer tools. It is returning correct value based on value in input_text.

Below is service details

entity_id: light.dining_room
brightness: 255
xy_color: >
     {% if is_state("input_text.dining_room_scene", "Concentrate") %}
        [0.459, 0.408]
     {% elif is_state("input_text.dining_room_scene", "Bright") %}
        [0.37, 0.372]
     {% else %}
        [0.37, 0.372]
     {% endif %}

Error is

020-11-19 02:20:33 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1888231184] None for dictionary value @ data['xy_color']
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 135, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1402, in async_call
    processed_data = handler.schema(service_data)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 218, in __call__
    return self._exec((Schema(val) for val in self.validators), v)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 340, in _exec
    raise e if self.msg is None else AllInvalid(self.msg, path=path)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 336, in _exec
    v = func(v)
  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/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 340, in _exec
    raise e if self.msg is None else AllInvalid(self.msg, path=path)
  File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 338, 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/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 432, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: None for dictionary value @ data['xy_color']

Thanks for your help.

As far as I know, Developer Tools > Services doesn’t accept templates in Service Data.

For example, the following attempt to set the light’s brightness to 150 results in an error:

Screenshot from 2020-11-18 10-32-16

voluptuous.error.MultipleInvalid: expected int for dictionary value @ data[‘brightness’]