Home Assistant Unofficial Reference 2024.12.1
homeassistant.helpers.sun Namespace Reference

Functions

datetime.datetime|None get_astral_event_date (HomeAssistant hass, str event, datetime.date|datetime.datetime|None date=None)
 
datetime.datetime get_astral_event_next (HomeAssistant hass, str event, datetime.datetime|None utc_point_in_time=None, datetime.timedelta|None offset=None)
 
tuple[astral.location.Location, astral.Elevation] get_astral_location (HomeAssistant hass)
 
datetime.datetime get_location_astral_event_next (astral.location.Location location, astral.Elevation elevation, str event, datetime.datetime|None utc_point_in_time=None, datetime.timedelta|None offset=None)
 
bool is_up (HomeAssistant hass, datetime.datetime|None utc_point_in_time=None)
 

Variables

 _AstralSunEventCallable
 
tuple ELEVATION_AGNOSTIC_EVENTS = ("noon", "midnight")
 

Detailed Description

Helpers for sun events.

Function Documentation

◆ get_astral_event_date()

datetime.datetime | None homeassistant.helpers.sun.get_astral_event_date ( HomeAssistant  hass,
str  event,
datetime.date | datetime.datetime | None   date = None 
)
Calculate the astral event time for the specified date.

Definition at line 113 of file sun.py.

◆ get_astral_event_next()

datetime.datetime homeassistant.helpers.sun.get_astral_event_next ( HomeAssistant  hass,
str  event,
datetime.datetime | None   utc_point_in_time = None,
datetime.timedelta | None   offset = None 
)
Calculate the next specified solar event.

Definition at line 55 of file sun.py.

◆ get_astral_location()

tuple[astral.location.Location, astral.Elevation] homeassistant.helpers.sun.get_astral_location ( HomeAssistant  hass)
Get an astral location for the current Home Assistant configuration.

Definition at line 30 of file sun.py.

◆ get_location_astral_event_next()

datetime.datetime homeassistant.helpers.sun.get_location_astral_event_next ( astral.location.Location  location,
astral.Elevation  elevation,
str  event,
datetime.datetime | None   utc_point_in_time = None,
datetime.timedelta | None   offset = None 
)
Calculate the next specified solar event.

Definition at line 69 of file sun.py.

◆ is_up()

bool homeassistant.helpers.sun.is_up ( HomeAssistant  hass,
datetime.datetime | None   utc_point_in_time = None 
)
Calculate if the sun is currently up.

Definition at line 140 of file sun.py.

Variable Documentation

◆ _AstralSunEventCallable

homeassistant.helpers.sun._AstralSunEventCallable
private

Definition at line 25 of file sun.py.

◆ ELEVATION_AGNOSTIC_EVENTS

tuple homeassistant.helpers.sun.ELEVATION_AGNOSTIC_EVENTS = ("noon", "midnight")

Definition at line 23 of file sun.py.