mirror of
				https://github.com/CCOSTAN/Home-AssistantConfig.git
				synced 2025-11-04 04:55:16 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			40 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
#-------------------------------------------
 | 
						|
#  @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
 | 
						|
      #emulated_hue_
 | 
						|
      
 | 
						|
#---Sensor for Light-----------------------------
 | 
						|
sensor:
 | 
						|
  - platform: template
 | 
						|
    sensors:
 | 
						|
      lights_on:
 | 
						|
        value_template: >
 | 
						|
          {% macro get_lights_on() -%}
 | 
						|
            {%- for group in states.light|groupby('state') -%}
 | 
						|
              {%- for entity in group.list -%}
 | 
						|
                {%- 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') -%}
 | 
						|
                  {{ entity.entity_id }}{{ ' ' }}
 | 
						|
                {%- endif -%}
 | 
						|
              {%- endfor -%}
 | 
						|
            {%- endfor -%}
 | 
						|
          {%- endmacro %}
 | 
						|
          {{ get_lights_on()|trim|replace(' ', ',') }}
 |