How to use the hdate.Location function in hdate

To help you get started, we’ve selected a few hdate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github home-assistant / home-assistant / homeassistant / components / jewish_calendar / __init__.py View on Github external
async def async_setup(hass, config):
    """Set up the Jewish Calendar component."""
    name = config[DOMAIN][CONF_NAME]
    language = config[DOMAIN][CONF_LANGUAGE]

    latitude = config[DOMAIN].get(CONF_LATITUDE, hass.config.latitude)
    longitude = config[DOMAIN].get(CONF_LONGITUDE, hass.config.longitude)
    diaspora = config[DOMAIN][CONF_DIASPORA]

    candle_lighting_offset = config[DOMAIN][CONF_CANDLE_LIGHT_MINUTES]
    havdalah_offset = config[DOMAIN][CONF_HAVDALAH_OFFSET_MINUTES]

    location = hdate.Location(
        latitude=latitude,
        longitude=longitude,
        timezone=hass.config.time_zone,
        diaspora=diaspora,
    )

    hass.data[DOMAIN] = {
        "location": location,
        "name": name,
        "language": language,
        "candle_lighting_offset": candle_lighting_offset,
        "havdalah_offset": havdalah_offset,
        "diaspora": diaspora,
    }

    hass.async_create_task(async_load_platform(hass, "sensor", DOMAIN, {}, config))

hdate

Jewish/Hebrew date and Zmanim in native Python 2.7/3.x

GPL-3.0
Latest version published 21 days ago

Package Health Score

75 / 100
Full package analysis