mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Condense in_range template logic
This commit is contained in:
parent
91a945f4c7
commit
a517784c9e
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user