Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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(