How to use the pyatmo.ClientAuth function in pyatmo

To help you get started, we’ve selected a few pyatmo 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 / netatmo / __init__.py View on Github external
def setup(hass, config):
    """Set up the Netatmo devices."""

    hass.data[DATA_PERSONS] = {}
    try:
        auth = pyatmo.ClientAuth(
            config[DOMAIN][CONF_API_KEY],
            config[DOMAIN][CONF_SECRET_KEY],
            config[DOMAIN][CONF_USERNAME],
            config[DOMAIN][CONF_PASSWORD],
            "read_station read_camera access_camera "
            "read_thermostat write_thermostat "
            "read_presence access_presence read_homecoach",
        )
    except HTTPError:
        _LOGGER.error("Unable to connect to Netatmo API")
        return False

    # Store config to be used during entry setup
    hass.data[DATA_NETATMO_AUTH] = auth

    if config[DOMAIN][CONF_DISCOVERY]:
github home-assistant / home-assistant / homeassistant / components / netatmo.py View on Github external
def setup(hass, config):
    """Set up the Netatmo devices."""
    import pyatmo

    global NETATMO_AUTH
    try:
        NETATMO_AUTH = pyatmo.ClientAuth(
            config[DOMAIN][CONF_API_KEY], config[DOMAIN][CONF_SECRET_KEY],
            config[DOMAIN][CONF_USERNAME], config[DOMAIN][CONF_PASSWORD],
            'read_station read_camera access_camera '
            'read_thermostat write_thermostat '
            'read_presence access_presence')
    except HTTPError:
        _LOGGER.error("Unable to connect to Netatmo API")
        return False

    if config[DOMAIN][CONF_DISCOVERY]:
        for component in 'camera', 'sensor', 'binary_sensor', 'climate':
            discovery.load_platform(hass, component, DOMAIN, {}, config)

    return True

pyatmo

Simple API to access Netatmo weather station data from any Python 3 script. Designed for Home Assistant (but not only)

MIT
Latest version published 4 months ago

Package Health Score

72 / 100
Full package analysis