2018-06-06 23:00:28 +00:00
|
|
|
#-------------------------------------------
|
|
|
|
# @BrianHanifin's Light sensor speech helper. - https://gist.github.com/brianhanifin/1f9436c7b6c28917c9be02605b6cff74
|
|
|
|
#-------------------------------------------
|
|
|
|
#------LightSensor Node---http://amzn.to/2oUgj5i
|
|
|
|
homeassistant:
|
|
|
|
customize:
|
|
|
|
sensor.lights_on:
|
|
|
|
icon: mdi:sensor
|
|
|
|
friendly_name: Lights on
|
2020-06-06 20:54:36 +00:00
|
|
|
#emulated_hue_
|
|
|
|
|
2018-06-06 23:00:28 +00:00
|
|
|
#---Sensor for Light-----------------------------
|
|
|
|
sensor:
|
|
|
|
- platform: template
|
|
|
|
sensors:
|
|
|
|
lights_on:
|
|
|
|
value_template: >
|
|
|
|
{% macro get_lights_on() -%}
|
2019-02-26 02:24:49 +00:00
|
|
|
{%- for group in states.light|groupby('state') -%}
|
2018-06-06 23:00:28 +00:00
|
|
|
{%- for entity in group.list -%}
|
2019-02-26 02:24:49 +00:00
|
|
|
{%- if entity.state == 'on'
|
|
|
|
and entity.entity_id != 'light.dummy'
|
|
|
|
and entity.entity_id != 'light.garage_entry_light'
|
|
|
|
and entity.entity_id != 'light.hue'
|
|
|
|
and entity.entity_id != 'light.living_room'
|
|
|
|
and entity.entity_id != 'light.kitchen_undercabinet'
|
|
|
|
and entity.entity_id != 'light.porch_light'
|
|
|
|
and entity.entity_id != 'light.shoe_closet_light'
|
|
|
|
and not ('gateway_light' in entity.entity_id)
|
|
|
|
and not ('hub' in entity.entity_id)
|
|
|
|
and not (entity.entity_id).endswith('_led')
|
|
|
|
and not (entity.entity_id).endswith('nightlight')
|
|
|
|
and not (entity.entity_id).startswith('light.lamplinc') -%}
|
2018-06-06 23:00:28 +00:00
|
|
|
{{ entity.entity_id }}{{ ' ' }}
|
|
|
|
{%- endif -%}
|
|
|
|
{%- endfor -%}
|
|
|
|
{%- endfor -%}
|
|
|
|
{%- endmacro %}
|
|
|
|
{{ get_lights_on()|trim|replace(' ', ',') }}
|