diff --git a/goosebit/updater/manager.py b/goosebit/updater/manager.py index 6658364f..a7752ec4 100644 --- a/goosebit/updater/manager.py +++ b/goosebit/updater/manager.py @@ -32,7 +32,6 @@ class HandlingType(StrEnum): class UpdateManager(ABC): def __init__(self, dev_id: str): self.dev_id = dev_id - self.poll_time = POLL_TIME async def get_device(self) -> Device | None: return @@ -101,6 +100,14 @@ def update_complete(self): def update_complete(self, value: bool): device_update_status[self.dev_id] = value + @property + def poll_time(self): + return device_poll_time.get(self.dev_id, POLL_TIME) + + @poll_time.setter + def poll_time(self, value: str): + device_poll_time[self.dev_id] = value + async def publish_log(self, log_data: str | None): for cb in self.log_subscribers: await cb(log_data) @@ -293,9 +300,10 @@ async def clear_log(self) -> None: await self.publish_log(None) -device_managers = {"unknown": UnknownUpdateManager("unknown")} device_log_subscriptions: dict[str, list[Callable]] = {} device_update_status: dict[str, bool] = {} +device_poll_time: dict[str, str] = {} +device_managers = {"unknown": UnknownUpdateManager("unknown")} async def get_update_manager(dev_id: str) -> UpdateManager: