diff --git a/README.md b/README.md index 1d3854b159fd57997861eba6b28b9342ac3bcbae..ad42b1c073c66453b53dfbccb8d3fa6f9bb7a31a 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ The following snippet shows an example of a tile in the settings files. - `tileType` - References the name of a tile class. This class must exist on start of the server. - `uniqueName` - This name must be unique across the complete page. -- `intervalInSeconds` - Specifies the automatic refresh rate in seconds. +- `intervalInSeconds` - Specifies the automatic refresh rate in seconds (Use `-1` to disable automatic refresh). - `x` - Horizontal position in the grid, starting by 0 (**Note:** Positions should not be assigned more than once!) - `y` - Vertical position in the grid, starting by 0 (**Note:** Positions should not be assigned more than once!) - `width` - The tile's width (minimum is 1 maximum is 12 on desktop horizontal screens) diff --git a/src/logic/tile/TileScheduler.py b/src/logic/tile/TileScheduler.py index 01d361c84154cb78f099c5b1cd0abad67c920d34..0474da5314d79606b87a7ffd27a633f0c735c00e 100644 --- a/src/logic/tile/TileScheduler.py +++ b/src/logic/tile/TileScheduler.py @@ -35,10 +35,16 @@ class TileScheduler: LOGGER.warning(f'Tile "{fullName}" already registered') return + seconds = tile.get_intervalInSeconds() + nextRunTime = datetime.now() + if seconds == -1: # disable automatic refresh + seconds = 9999999999 # 317 years + nextRunTime = None # job is paused + job = self.__scheduler.add_job(tile.update, 'interval', [pageName], - seconds=tile.get_intervalInSeconds(), - next_run_time=datetime.now()) + seconds=seconds, + next_run_time=nextRunTime) self.__jobs[fullName] = job self.__cache[fullName] = None