diff --git a/custom_components/bmw_connected_drive/config_flow.py b/custom_components/bmw_connected_drive/config_flow.py index fe1eca4..bbe0fd4 100644 --- a/custom_components/bmw_connected_drive/config_flow.py +++ b/custom_components/bmw_connected_drive/config_flow.py @@ -2,7 +2,7 @@ import logging from homeassistant import config_entries, core, exceptions -from homeassistant.const import CONF_USERNAME +from homeassistant.const import CONF_USERNAME, CONF_SOURCE from . import ACCOUNT_SCHEMA as DATA_SCHEMA, DOMAIN, setup_account from .const import CONF_REGION @@ -35,7 +35,7 @@ async def validate_input(hass: core.HomeAssistant, data): raise InvalidAuth # Return info that you want to store in the config entry. - return {"title": data[CONF_USERNAME]} + return {"title": f"{data[CONF_USERNAME]}{data.get(CONF_SOURCE, '')}"} class BMWConnectedDriveConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): @@ -71,6 +71,7 @@ async def async_step_user(self, user_input=None): async def async_step_import(self, user_input): """Handle import.""" + user_input[CONF_SOURCE] = " (configuration.yaml)" return await self.async_step_user(user_input) diff --git a/custom_components/bmw_connected_drive/device_tracker.py b/custom_components/bmw_connected_drive/device_tracker.py index 45f0471..2c63cf2 100644 --- a/custom_components/bmw_connected_drive/device_tracker.py +++ b/custom_components/bmw_connected_drive/device_tracker.py @@ -97,6 +97,10 @@ def source_type(self): def icon(self): return "mdi:car" + def update(self): + """Update state of the decvice tracker.""" + self._location = self._vehicle.state.gps_position + def update_callback(self): """Schedule a state update.""" self.schedule_update_ha_state(True)