Tracking the Sun


The sun component will use your current location to track if the sun is above or below the horizon. The sun can be used within automation as a trigger with an optional offset to simulate dawn/dusk.

1
2
3
4
5
6
7
8
# Example configuration.yaml entry
homeassistant:
  latitude: 32.87336
  longitude: -117.22743

sun:
  # Optional. If ommitted will be retrieved from Google Maps
  elevation: 123

Implementation Details

Maintains entity sun.sun.

Possible state Description
above_horizon When the sun is above the horizon.
below_horizon When the sun is below the horizon.
State Attributes Description
next_rising Date and time of the next sun rising
next_setting Date and time of the next sun setting