Skip to content

Commit 3e5107b

Browse files
Allow maintenance windows without selected days
1 parent 51cf57a commit 3e5107b

6 files changed

Lines changed: 21 additions & 5 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ windows:
6767
- sun
6868
```
6969

70+
Leave `days` empty or omit it from a window to run that window every day.
71+
7072
After dry-run testing, enable real Core stop with:
7173

7274
```yaml

maintenance_window/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
All notable changes to the Maintenance Window add-on are documented here.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
55

6+
## 0.8.6
7+
8+
- Allow window `days` to be empty or omitted; such windows now run every day.
9+
610
## 0.8.5
711

812
- Add `pause_core_watchdog`, enabled by default, to temporarily pause the Home

maintenance_window/DOCS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,9 @@ A list of maintenance windows. Each entry has:
247247
| `restart_core` | Optional per-window Core stop/restart override. |
248248
| `stop_addons` | Optional per-window list of add-ons to stop. |
249249
| `start_addons` | Optional per-window list of add-ons to start temporarily. |
250-
| `days` | Days of week the window runs (`mon`–`sun`). |
250+
| `days` | Optional days of week the window runs (`mon`–`sun`). Leave empty or omit it to run every day. |
251+
252+
If `days` is empty or omitted, the window runs every day.
251253

252254
If a window omits `restart_core`, `stop_addons`, or `start_addons`, the global
253255
setting with the same name is used.

maintenance_window/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Maintenance Window",
3-
"version": "0.8.5",
3+
"version": "0.8.6",
44
"slug": "maintenance_window",
55
"description": "Scheduled quiet mode: stop Home Assistant Core (and optionally selected add-ons) for a short maintenance window, then restart automatically.",
66
"url": "https://github.com/sergey-goncharenko/ha-maintenance-window-addon/tree/main/maintenance_window",
@@ -76,7 +76,7 @@
7676
"str?"
7777
],
7878
"days": [
79-
"list(mon|tue|wed|thu|fri|sat|sun)"
79+
"list(mon|tue|wed|thu|fri|sat|sun)?"
8080
]
8181
}
8282
]

maintenance_window/rootfs/usr/lib/maintenance-window/scheduler.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,10 +687,16 @@ window_runs_on_day() {
687687
local window_index="${1}"
688688
local day_name="${2}"
689689
local configured_day
690+
local configured_days
691+
692+
configured_days="$(bashio::config "windows[${window_index}].days" '__all__')"
693+
if [[ "${configured_days}" == "__all__" || -z "${configured_days}" ]]; then
694+
return 0
695+
fi
690696

691697
while IFS= read -r configured_day; do
692698
[[ "${configured_day}" == "${day_name}" ]] && return 0
693-
done < <(bashio::config "windows[${window_index}].days")
699+
done <<< "${configured_days}"
694700

695701
return 1
696702
}

maintenance_window/translations/en.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,6 @@ configuration:
9393
during this window, even while Core is down.
9494
days:
9595
name: Days
96-
description: Days of the week this window runs (mon through sun).
96+
description: >-
97+
Days of the week this window runs (mon through sun). Leave empty to
98+
run every day.

0 commit comments

Comments
 (0)