Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This Automation triggers when someone gets home OR when the sun goes below 5 degrees. If someone gets home and the sun is below -10 degrees the lights will start dimmed, otherwise they will start at normal brightness. The time condition prevents the lights from turning on in the middle of the night/morning when the sun rises again and we are home sleeping. And the other two conditions make sure someone has to arrive/be home and the sun has to be below 5 degrees for the action to fire. The action is to start scene A or B depending on sun elevation.
- - id: Sunset_if_home
- alias: 'Hemkomst'
- # Triggar scen normalvit eller dimmad_vit beroende på solens position över/under horisonten när någon kommer hem.
- trigger:
- - platform: state
- entity_id: 'group.telefoner'
- to: 'home'
- - platform: numeric_state
- entity_id: sun.sun
- value_template: '{{ states.sun.sun.attributes.elevation }}'
- below: 5
- condition:
- - condition: time
- after: '12:00:00'
- before: '03:00:00'
- - condition: state
- entity_id: group.telefoner
- state: 'home'
- - condition: numeric_state
- entity_id: sun.sun
- value_template: '{{ states.sun.sun.attributes.elevation }}'
- below: 5
- action:
- - service_template: scene.turn_on
- data_template:
- entity_id: >-
- {% set elevation = states.sun.sun.attributes.elevation | int %}
- {% if elevation > -10 and elevation < 5 %}
- scene.normalvit
- {% elif elevation < -10 %}
- scene.dimmad_vit
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement