47 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| automation:
 | |
| - alias: Encender Luz Entrada Pasillo Normal
 | |
|   initial_state: 'on'
 | |
|   trigger:
 | |
|   - platform: state
 | |
|     entity_id: binary_sensor.movimiento_entrada_pasillo
 | |
|     to: 'on'
 | |
|   condition:
 | |
|     condition: or
 | |
|     conditions:
 | |
|     - before: sunrise
 | |
|       condition: sun
 | |
|     - after: sunset
 | |
|       condition: sun
 | |
|   action:
 | |
|   - service: homeassistant.turn_on
 | |
|     data:
 | |
|       entity_id:
 | |
|         - light.luz_entrada_pasillo
 | |
|     data_template:
 | |
|       brightness: >
 | |
|        {% if 7 < now().strftime('%H')|int and now().strftime('%H')|int < 23 -%}
 | |
|           255
 | |
|        {%- else -%}
 | |
|           100
 | |
|        {%- endif %}
 | |
|   - service: timer.start
 | |
|     data:
 | |
|       entity_id: timer.luzentradapasillo
 | |
| 
 | |
| - alias: Apagar Luz Entrada Pasillo Normal
 | |
|   initial_state: 'on'
 | |
|   trigger:
 | |
|     platform: event
 | |
|     event_type: timer.finished
 | |
|     event_data:
 | |
|       entity_id: timer.luzentradapasillo
 | |
|   action:
 | |
|     service: homeassistant.turn_off
 | |
|     data:
 | |
|       entity_id:
 | |
|         - light.luz_entrada_pasillo
 | |
| 
 | |
| timer:
 | |
|   luzentradapasillo:
 | |
|     duration: '00:03:05'
 | 
