From cc673420c302b1f0a72465a623b6adb3e8d6e243 Mon Sep 17 00:00:00 2001 From: CCOSTAN Date: Fri, 10 Feb 2017 20:45:11 +0000 Subject: [PATCH] List out the lights that are left on please. --- automation/home_today.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/automation/home_today.yaml b/automation/home_today.yaml index 5d97e444..625b3ca3 100755 --- a/automation/home_today.yaml +++ b/automation/home_today.yaml @@ -29,7 +29,13 @@ {% endif %} . There are {% for state in states.light if state.state == 'on' -%} - {%- if loop.last -%} - {{ loop.index }} - {%- endif -%} - {%- endfor %} lights on right now." \ No newline at end of file + {%- if loop.last -%} + {{ loop.index }} + {%- endif -%} + {%- endfor %} lights on right now." + {% set comma = joiner(', ') %} The + {% for group in states.group|groupby('state') -%} + {%- for entity in group.list if entity.state == 'on' and entity.name.split(' ')[1]|lower == 'lights' and entity.name.split(' ')[0]|lower != 'all' and entity.name.split(' ')[0]|lower != 'interior' -%} + {{ comma() }}{{ entity.name }} + {%- endfor -%} + {%- endfor %}. \ No newline at end of file