@callback
def async_render_with_possible_json_value(self, value, error_value=_SENTINEL, variables=None):
    'Render template with value exposed.\n\n        If valid JSON will expose value_json too.\n\n        This method must be run in the event loop.\n        '
    if self.is_static:
        return self.template
    if (self._compiled is None):
        self._ensure_compiled()
    variables = dict((variables or {}))
    variables['value'] = value
    with suppress(ValueError, TypeError):
        variables['value_json'] = json.loads(value)
    try:
        return _render_with_context(self.template, self._compiled, **variables).strip()
    except jinja2.TemplateError as ex:
        if (error_value is _SENTINEL):
            _LOGGER.error('Error parsing value: %s (value: %s, template: %s)', ex, value, self.template)
        return (value if (error_value is _SENTINEL) else error_value)
Render template with value exposed.

If valid JSON will expose value_json too.

This method must be run in the event loop.
@callback
def async_render_with_possible_json_value(self, value, error_value=_SENTINEL, variables=None):
    'Render template with value exposed.\n\n        If valid JSON will expose value_json too.\n\n        This method must be run in the event loop.\n        '
    if self.is_static:
        return self.template
    if (self._compiled is None):
        self._ensure_compiled()
    variables = dict((variables or {}))
    variables['value'] = value
    with suppress(ValueError, TypeError):
        variables['value_json'] = json.loads(value)
    try:
        return _render_with_context(self.template, self._compiled, **variables).strip()
    except jinja2.TemplateError as ex:
        if (error_value is _SENTINEL):
            _LOGGER.error('Error parsing value: %s (value: %s, template: %s)', ex, value, self.template)
        return (value if (error_value is _SENTINEL) else error_value)