Remove exception handling for templates

It is now handled in the layers below
pull/732/head
Philip Lundrigan 2015-12-12 13:34:21 -07:00
parent ab9ab532c8
commit a84ff14b00
1 changed files with 1 additions and 14 deletions

View File

@ -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