work: добавлин web интерфейс.
This commit is contained in:
+22
-1
@@ -105,6 +105,27 @@ class ScheduleService:
|
||||
def config(self) -> ScheduleConfig:
|
||||
return self._config
|
||||
|
||||
async def replace_config(
|
||||
self,
|
||||
config: ScheduleConfig,
|
||||
) -> None:
|
||||
"""Заменить расписание без перезапуска приложения."""
|
||||
if not isinstance(config, ScheduleConfig):
|
||||
raise TypeError("config must be ScheduleConfig")
|
||||
|
||||
self._config = config
|
||||
self._last_applied_when = None
|
||||
self._clear_override()
|
||||
self._last_error = None
|
||||
|
||||
# Сохранение расписания не должно завершаться ошибкой только из-за
|
||||
# временно недоступного Bluetooth. Фоновый цикл повторит применение.
|
||||
if self._running and not self._paused:
|
||||
try:
|
||||
await self._process()
|
||||
except Exception as exc:
|
||||
self._last_error = f"{type(exc).__name__}: {exc}"
|
||||
|
||||
def _load_runtime_state(self) -> None:
|
||||
|
||||
if self._state_path is None:
|
||||
@@ -626,4 +647,4 @@ class ScheduleService:
|
||||
if settings.power is False:
|
||||
await self._tion.execute(
|
||||
lambda tion: tion.power_off()
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user