From a517784c9e6d4d67e51652f58ade87430376e1f0 Mon Sep 17 00:00:00 2001
From: Philip Lundrigan <philiplundrigan@gmail.com>
Date: Mon, 14 Dec 2015 15:07:35 -0700
Subject: [PATCH] Condense in_range template logic

---
 homeassistant/components/automation/numeric_state.py | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/homeassistant/components/automation/numeric_state.py b/homeassistant/components/automation/numeric_state.py
index 40249372b43..d73b7061eb8 100644
--- a/homeassistant/components/automation/numeric_state.py
+++ b/homeassistant/components/automation/numeric_state.py
@@ -92,12 +92,7 @@ def if_action(hass, config):
 
 def _in_range(state, range_start, range_end, renderer):
     """ Checks if value is inside the range """
-
-    if renderer is not None:
-        value = renderer({'value': state})
-    else:
-        # If no renderer is provided, just assume they want the state
-        value = state.state
+    value = state.state if renderer is None else renderer({'value': state})
 
     try:
         value = float(value)
-- 
GitLab