From be4e68e15282f83810b2805b60d4fbdffbe8efd0 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Sat, 10 Apr 2021 12:54:42 +0200 Subject: [PATCH] Add version in manifet, and add_executor_job on config_flow --- custom_components/georide/__init__.py | 2 +- custom_components/georide/config_flow.py | 6 +++--- custom_components/georide/manifest.json | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/custom_components/georide/__init__.py b/custom_components/georide/__init__.py index 9f6eac4..e0e9ad9 100644 --- a/custom_components/georide/__init__.py +++ b/custom_components/georide/__init__.py @@ -209,7 +209,7 @@ class GeoRideContext: async def refresh_trackers(self): """Used to refresh the tracker list""" _LOGGER.info("Tracker list refresh") - self._georide_trackers = await self._hass.async_add_executor_job(GeoRideApi.get_trackers, await self.get_token) + self._georide_trackers = await self._hass.async_add_executor_job(GeoRideApi.get_trackers, await self.get_token()) @property def socket(self): diff --git a/custom_components/georide/config_flow.py b/custom_components/georide/config_flow.py index 52361bc..b8d5cc5 100644 --- a/custom_components/georide/config_flow.py +++ b/custom_components/georide/config_flow.py @@ -7,13 +7,13 @@ import georideapilib.api as GeoRideApi import georideapilib.exception as GeoRideException -from .const import CONF_EMAIL, CONF_PASSWORD, CONF_TOKEN +from .const import CONF_EMAIL, CONF_PASSWORD, CONF_TOKEN, DOMAIN _LOGGER = logging.getLogger(__name__) @config_entries.HANDLERS.register("georide") -class GeoRideConfigFlow(config_entries.ConfigFlow): +class GeoRideConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): """GeoRide config flow """ async def async_step_user(self, user_input=None): #pylint: disable=W0613 @@ -54,7 +54,7 @@ class GeoRideConfigFlow(config_entries.ConfigFlow): password = user_input[CONF_PASSWORD] try: - account = GeoRideApi.get_authorisation_token(email, password) + account = await self.hass.async_add_executor_job(GeoRideApi.get_authorisation_token, email, password) data = { CONF_EMAIL: email, CONF_PASSWORD: password, diff --git a/custom_components/georide/manifest.json b/custom_components/georide/manifest.json index 0cad021..b3209e6 100644 --- a/custom_components/georide/manifest.json +++ b/custom_components/georide/manifest.json @@ -8,5 +8,6 @@ "pyjwt>=1.7.1" ], "dependencies": [], - "codeowners": ["ptimatth"] + "codeowners": ["ptimatth"], + "version": "0.6.0" } \ No newline at end of file