From af1df1cd844311febc68f7f6da1a80a2b17808d9 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Sat, 10 Apr 2021 12:25:47 +0200 Subject: [PATCH] Fix tracker retrivial --- custom_components/georide/binary_sensor.py | 2 +- custom_components/georide/device_tracker.py | 2 +- custom_components/georide/sensor.py | 2 +- custom_components/georide/switch.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/custom_components/georide/binary_sensor.py b/custom_components/georide/binary_sensor.py index e4977ad..1ffe9c7 100644 --- a/custom_components/georide/binary_sensor.py +++ b/custom_components/georide/binary_sensor.py @@ -19,7 +19,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): # pylint: d if token is None: return False - trackers = await GeoRideApi.get_trackers(token) + trackers = await hass.async_add_executor_job(GeoRideApi.get_trackers,token) binary_sensor_entities = [] for tracker in trackers: diff --git a/custom_components/georide/device_tracker.py b/custom_components/georide/device_tracker.py index e3590e9..5537fea 100644 --- a/custom_components/georide/device_tracker.py +++ b/custom_components/georide/device_tracker.py @@ -23,7 +23,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): # pylint: d _LOGGER.debug('Current GeoRide token: %s', token) - trackers = await GeoRideApi.get_trackers(token) + trackers = await hass.async_add_executor_job(GeoRideApi.get_trackers, token) tracker_entities = [] diff --git a/custom_components/georide/sensor.py b/custom_components/georide/sensor.py index dce133e..4909f6c 100644 --- a/custom_components/georide/sensor.py +++ b/custom_components/georide/sensor.py @@ -21,7 +21,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): # pylint: d if token is None: return False - trackers = await GeoRideApi.get_trackers(token) + trackers = await hass.async_add_executor_job(GeoRideApi.get_trackers,token) odometer_switch_entities = [] for tracker in trackers: diff --git a/custom_components/georide/switch.py b/custom_components/georide/switch.py index b72d1e4..cccd1ec 100644 --- a/custom_components/georide/switch.py +++ b/custom_components/georide/switch.py @@ -23,7 +23,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): # pylint: d _LOGGER.info('Current georide token: %s', token) - trackers = await GeoRideApi.get_trackers(token) + trackers = await hass.async_add_executor_job(GeoRideApi.get_trackers, token) lock_switch_entities = [] for tracker in trackers: