How to use volkswagencarnet - 2 common examples

To help you get started, we’ve selected a few volkswagencarnet 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 cyberjunky / home-assistant-custom-components / volkswagencarnet / __init__.py View on Github external
def setup(hass, config):
    """Setup Volkswagen Carnet component"""

    username = config[DOMAIN].get(CONF_USERNAME)
    password = config[DOMAIN].get(CONF_PASSWORD)
    interval = config[DOMAIN].get(CONF_UPDATE_INTERVAL)
    state = hass.data[DATA_KEY] = VolkswagenData(config)

    # create carnet connection
    connection = Connection(username, password)
    # login to carnet
    _LOGGER.debug("Creating connection to carnet")
    connection._login()
    if not connection.logged_in:
        _LOGGER.warning('Could not login to carnet')

    def discover_vehicle(vehicle):
        """Load relevant platforms."""
        state.entities[vehicle.vin] = []
        for attr, (component, *_) in RESOURCES.items():
            if (getattr(vehicle, attr + '_supported', True) and
                    attr in config[DOMAIN].get(CONF_RESOURCES, [attr])):
                discovery.load_platform(
                    hass, component, DOMAIN, (vehicle.vin, attr), config)

    def update_vehicle(vehicle):
github cyberjunky / home-assistant-custom-components / volkswagencarnet / __init__.py View on Github external
def setup(hass, config):
    """Setup Volkswagen Carnet component"""

    username = config[DOMAIN].get(CONF_USERNAME)
    password = config[DOMAIN].get(CONF_PASSWORD)
    interval = config[DOMAIN].get(CONF_UPDATE_INTERVAL)
    state = hass.data[DATA_KEY] = VolkswagenData(config)

    # create carnet connection
    connection = Connection(username, password)
    # login to carnet
    _LOGGER.debug("Creating connection to carnet")
    connection._login()
    if not connection.logged_in:
        _LOGGER.warning('Could not login to carnet')

    def discover_vehicle(vehicle):
        """Load relevant platforms."""
        state.entities[vehicle.vin] = []
        for attr, (component, *_) in RESOURCES.items():
            if (getattr(vehicle, attr + '_supported', True) and
                    attr in config[DOMAIN].get(CONF_RESOURCES, [attr])):
                discovery.load_platform(

volkswagencarnet

Communicate with Volkswagen Connect

GPL-3.0
Latest version published 5 months ago

Package Health Score

74 / 100
Full package analysis

Similar packages