From a84ff14b00b69230d8e2ba9a115c8e621db4cc74 Mon Sep 17 00:00:00 2001 From: Philip Lundrigan Date: Sat, 12 Dec 2015 13:34:21 -0700 Subject: [PATCH] Remove exception handling for templates It is now handled in the layers below --- homeassistant/components/sensor/rest.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/homeassistant/components/sensor/rest.py b/homeassistant/components/sensor/rest.py index 041a656a5ba..f824f022966 100644 --- a/homeassistant/components/sensor/rest.py +++ b/homeassistant/components/sensor/rest.py @@ -9,7 +9,6 @@ https://home-assistant.io/components/sensor.rest/ from datetime import timedelta import logging import requests -import jinja2.exceptions from homeassistant.const import CONF_VALUE_TEMPLATE from homeassistant.util import template, Throttle @@ -59,18 +58,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None): 'Please check the URL in the configuration file.') return False - value_template = config.get(CONF_VALUE_TEMPLATE) - data = response.text - if value_template is not None: - try: - template.render_with_possible_json_value(hass, - value_template, - data) - except jinja2.exceptions.UndefinedError: - _LOGGER.error('Template "%s" not found in response: "%s"', - value_template, data) - return False - if use_get: rest = RestDataGet(resource, verify_ssl) elif use_post: @@ -121,7 +108,7 @@ class RestSensor(Entity): else: if self._value_template is not None: value = template.render_with_possible_json_value( - self._hass, self._value_template, value) + self._hass, self._value_template, value, 'N/A') self._state = value