From 5059ff133e8a3f5b1535124a41141a64993d6fe5 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 29 Apr 2025 11:37:24 +0200 Subject: [PATCH] Add Supervisor country (#165) --- lib/supervisor.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/supervisor.sh b/lib/supervisor.sh index 83ad9a0..7870226 100644 --- a/lib/supervisor.sh +++ b/lib/supervisor.sh @@ -182,6 +182,26 @@ function bashio::supervisor.timezone() { fi } +# ------------------------------------------------------------------------------ +# Returns or sets the current country of the system. +# +# Arguments: +# $1 Country to set (optional). +# ------------------------------------------------------------------------------ +function bashio::supervisor.country() { + local country=${1:-} + + bashio::log.trace "${FUNCNAME[0]}:" "$@" + + if bashio::var.has_value "${country}"; then + channel=$(bashio::var.json country "${country}") + bashio::api.supervisor POST /supervisor/options "${country}" + bashio::cache.flush_all + else + bashio::supervisor 'supervisor.info.country' '.country' + fi +} + # ------------------------------------------------------------------------------ # Returns the current logging level of the Supervisor. #