From 5d810dae86aa98c527e82cab1fb10a607dcb7851 Mon Sep 17 00:00:00 2001
From: Phil Hawthorne
Date: Mon, 24 Jul 2017 06:42:41 +1000
Subject: [PATCH] REST binary sensor value_template optional (#8596)
According to the documentation, the `value_template` for the REST
binary_sensor is not required. However, if you don't provide this when
setting up a binary sensor, the component fails. Looks like a variable
was not being set, which I've now included.
This should make the REST binary sensor act the same way as the REST
sensor now.
---
homeassistant/components/binary_sensor/rest.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/homeassistant/components/binary_sensor/rest.py b/homeassistant/components/binary_sensor/rest.py
index abdbc8251c7..6d1745700bd 100644
--- a/homeassistant/components/binary_sensor/rest.py
+++ b/homeassistant/components/binary_sensor/rest.py
@@ -107,6 +107,8 @@ class RestBinarySensor(BinarySensorDevice):
if self.rest.data is None:
return False
+ response = self.rest.data
+
if self._value_template is not None:
response = self._value_template.\
async_render_with_possible_json_value(self.rest.data, False)