Skip to content

Commit

Permalink
✨ Adds support for Hass.io Ingress (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck authored Apr 7, 2019
1 parent 2f2f529 commit ca249a2
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions lib/addons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,75 @@ function bashio::addon.audio_output() {
fi
}

# ------------------------------------------------------------------------------
# Returns IP address assigned on the hassio network for an add-on.
#
# Arguments:
# $1 Add-on slug
# ------------------------------------------------------------------------------
function bashio::addon.ip_address() {
local slug=${1:-'self'}
bashio::log.trace "${FUNCNAME[0]}" "$@"
bashio::addons "${slug}" "addons.${slug}.ip_address" '.ip_address // empty'
}

# ------------------------------------------------------------------------------
# Returns if the add-on support ingress mode.
#
# Arguments:
# $1 Add-on slug
# ------------------------------------------------------------------------------
function bashio::addon.ingress() {
local slug=${1:-'self'}
bashio::log.trace "${FUNCNAME[0]}" "$@"
bashio::addons "${slug}" "addons.${slug}.ingress" '.ingress // false'
}

# ------------------------------------------------------------------------------
# Returns the ingress entry point of the add-on.
#
# Arguments:
# $1 Add-on slug
# ------------------------------------------------------------------------------
function bashio::addon.ingress_entry() {
local slug=${1:-'self'}
bashio::log.trace "${FUNCNAME[0]}" "$@"
bashio::addons \
"${slug}" \
"addons.${slug}.ingress_entry" \
'.ingress_entry // empty'
}

# ------------------------------------------------------------------------------
# Returns the ingress url of the add-on.
#
# Arguments:
# $1 Add-on slug
# ------------------------------------------------------------------------------
function bashio::addon.ingress_url() {
local slug=${1:-'self'}
bashio::log.trace "${FUNCNAME[0]}" "$@"
bashio::addons \
"${slug}" \
"addons.${slug}.ingress_url" \
'.ingress_url // empty'
}

# ------------------------------------------------------------------------------
# Returns the ingress port of the add-on.
#
# Arguments:
# $1 Add-on slug
# ------------------------------------------------------------------------------
function bashio::addon.ingress_port() {
local slug=${1:-'self'}
bashio::log.trace "${FUNCNAME[0]}" "$@"
bashio::addons \
"${slug}" \
"addons.${slug}.ingress_port" \
'.ingress_port // empty'
}

# ------------------------------------------------------------------------------
# List all available stats about an add-on.
#
Expand Down

0 comments on commit ca249a2

Please sign in to comment.