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. #