Advertisement
boelle11

Untitled

Dec 5th, 2021
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. blueprint:
  2. name: Lights On At Sunset
  3. description: Turn on the following lights at sunset
  4. domain: automation
  5. input:
  6. # Create a variable for identifying the light to act upon
  7. target_light:
  8. name: Lights
  9. description: This is the light (or lights) that will be activated at sunset
  10. # Use a selector, to pick the light(s)
  11. selector:
  12. target:
  13. entity:
  14. domain: light
  15. # Create a variable for capturing the desired brightness of the activated lights
  16. target_brightness:
  17. name: Brightness
  18. description: Brightness of the light(s) when they're activated
  19. default: 50
  20. # Use a selector, to set the brightness
  21. selector:
  22. number:
  23. min: 0
  24. max: 100
  25. mode: slider
  26. step: 1
  27. unit_of_measurement: "%"
  28. # Create a variable for capturing the desired offset for shifting the trigger
  29. elevation_shift:
  30. name: Elevation Shift
  31. description: Using an elevation offset (height of sun relative to the horizon) to shift the sunset trigger, either earlier or later. Positive values bring the automation start time forward, whilst negative values delay the start time. To approximate Golden Hour - set the Elevation Offset to 1.
  32. default: 0.0
  33. # Use a selector, to set the time shift or offset
  34. selector:
  35. number:
  36. min: -90.0
  37. max: 90.0
  38. mode: slider
  39. step: 0.01
  40.  
  41. # Prevent the automation from running concurrently
  42. mode: single
  43.  
  44. # Define the variables used in the action section
  45. variables:
  46. target_brightness: !input target_brightness
  47. target_light: !input target_light
  48.  
  49. # Define the trigger for the automation
  50. trigger:
  51. # Using the state of the sun to act as the trigger
  52. platform: numeric_state
  53. entity_id: sun.sun
  54. attribute: elevation
  55. # Can be a positive or negative number
  56. below: !input elevation_shift
  57.  
  58. condition:
  59. - condition: template
  60. value_template: '{{state_attr("sun.sun", "rising") == false}}'
  61.  
  62. # This section will take action on the lights, and turn them on
  63. action:
  64. # A very simple structure of turning on the selected light(s)
  65. - service: light.turn_on
  66. target: !input target_light
  67. # Set and pass the desired brightness
  68. data_template:
  69. brightness_pct: "{{ target_brightness | int }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement