From 28bc0ceee01bffc89fff739663e305902d33a27c Mon Sep 17 00:00:00 2001 From: Daniel Muehlbachler-Pietrzykowski Date: Tue, 12 Dec 2023 18:50:46 +0100 Subject: [PATCH] fix: interpolate updates instead of dropping old ones --- custom_components/hella_onyx/sensors/shutter.py | 10 ++++++---- tests/sensors/test_light.py | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/custom_components/hella_onyx/sensors/shutter.py b/custom_components/hella_onyx/sensors/shutter.py index 33f9fe8..b915eb1 100644 --- a/custom_components/hella_onyx/sensors/shutter.py +++ b/custom_components/hella_onyx/sensors/shutter.py @@ -233,10 +233,12 @@ def _start_moving_device(self, animation: AnimationValue): ) if moving: - track_point_in_utc_time( - self.hass, - self._end_moving_device, - utcnow() + timedelta(seconds=delta + INCREASED_INTERVAL_DELTA), + asyncio.run_coroutine_threadsafe( + track_point_in_utc_time( + self.hass, + self._end_moving_device, + utcnow() + timedelta(seconds=delta + INCREASED_INTERVAL_DELTA), + ) ) else: _LOGGER.debug("end moving device %s due to too old data", self._uuid) diff --git a/tests/sensors/test_light.py b/tests/sensors/test_light.py index da581c5..8a99606 100644 --- a/tests/sensors/test_light.py +++ b/tests/sensors/test_light.py @@ -3,7 +3,6 @@ import pytest import time -from math import ceil import pytz from datetime import datetime from homeassistant.components.light import (