How to use the pycarwings2.Session function in pycarwings2

To help you get started, we’ve selected a few pycarwings2 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 / nissan_leaf / __init__.py View on Github external
def setup_leaf(car_config):
        """Set up a car."""
        _LOGGER.debug("Logging into You+Nissan...")

        username = car_config[CONF_USERNAME]
        password = car_config[CONF_PASSWORD]
        region = car_config[CONF_REGION]
        leaf = None

        try:
            # This might need to be made async (somehow) causes
            # homeassistant to be slow to start
            sess = Session(username, password, region)
            leaf = sess.get_leaf()
        except KeyError:
            _LOGGER.error(
                "Unable to fetch car details..."
                " do you actually have a Leaf connected to your account?"
            )
            return False
        except CarwingsError:
            _LOGGER.error(
                "An unknown error occurred while connecting to Nissan: %s",
                sys.exc_info()[0],
            )
            return False

        _LOGGER.warning(
            "WARNING: This may poll your Leaf too often, and drain the 12V"

pycarwings2

Python library for interacting with the Nissan Leaf Carwings telematics service

Apache-2.0
Latest version published 2 years ago

Package Health Score

42 / 100
Full package analysis

Popular pycarwings2 functions

Similar packages