Ignore template if it isn't set

This commit is contained in:
Philip Lundrigan 2015-12-14 10:49:54 -07:00
parent 600831cff5
commit e821b546d5

View file

@ -73,8 +73,11 @@ class CommandSensor(Entity):
self.data.update()
value = self.data.value
self._state = template.render_with_possible_json_value(
self._hass, self._value_template, value, 'N/A')
if self._value_template is not None:
self._state = template.render_with_possible_json_value(
self._hass, self._value_template, value, 'N/A')
else:
self._state = value
# pylint: disable=too-few-public-methods