49 lines
1.1 KiB
YAML
49 lines
1.1 KiB
YAML
automation:
|
|
- alias: Encender Luz Pasillo Normal
|
|
initial_state: 'on'
|
|
trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.movimiento_pasillo_habitaciones
|
|
to: 'on'
|
|
condition:
|
|
condition: or
|
|
conditions:
|
|
- before: sunrise
|
|
condition: sun
|
|
- after: sunset
|
|
condition: sun
|
|
action:
|
|
- service: homeassistant.turn_on
|
|
data:
|
|
entity_id:
|
|
- light.luz_estudio_pasillo
|
|
- light.luz_habitaciones_pasillo
|
|
data_template:
|
|
brightness: >
|
|
{% if 7 < now().strftime('%H')|int and now().strftime('%H')|int < 23 -%}
|
|
255
|
|
{%- else -%}
|
|
50
|
|
{%- endif %}
|
|
- service: timer.start
|
|
data:
|
|
entity_id: timer.luzpasillo
|
|
|
|
- alias: Apagar Luz Pasillo Normal
|
|
initial_state: 'on'
|
|
trigger:
|
|
platform: event
|
|
event_type: timer.finished
|
|
event_data:
|
|
entity_id: timer.luzpasillo
|
|
action:
|
|
service: homeassistant.turn_off
|
|
data:
|
|
entity_id:
|
|
- light.luz_estudio_pasillo
|
|
- light.luz_habitaciones_pasillo
|
|
|
|
timer:
|
|
luzpasillo:
|
|
duration: '00:00:20'
|