From 06bd812b7b4f32dc56df734e30c327d1779887e2 Mon Sep 17 00:00:00 2001
From: Paulus Schoutsen <paulus@paulusschoutsen.nl>
Date: Fri, 12 Feb 2016 08:58:07 -0800
Subject: [PATCH] Make state unknown if None returned

---
 homeassistant/helpers/entity.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/homeassistant/helpers/entity.py b/homeassistant/helpers/entity.py
index 0f5ccf78bc7..742b877946a 100644
--- a/homeassistant/helpers/entity.py
+++ b/homeassistant/helpers/entity.py
@@ -145,7 +145,7 @@ class Entity(object):
         if force_refresh:
             self.update()
 
-        state = str(self.state)
+        state = STATE_UNKNOWN if self.state is None else str(self.state)
         attr = self.state_attributes or {}
 
         device_attr = self.device_state_attributes
-- 
GitLab