#!/usr/bin/env bashio DATA_STORE="/data/hassio.json" function _discovery_config() { local api_key=${1} local serial=${2} local config config=$(bashio::var.json \ host "$(bashio::addon.ip_address)" \ port "^$(bashio::addon.port 80)" \ api_key "${api_key}" \ serial "${serial}" \ ) bashio::var.json \ service deconz \ config "^${config}" } function _save_data() { local api_key=${1} local serial=${2} local config bashio::var.json api_key "${api_key}" serial "${serial}" > ${DATA_STORE} bashio::log.debug "Store API information to ${DATA_STORE}" } function _deconz_api() { local api_key local result local api_port api_port=$(bashio::addon.port 80) while ! nc -z localhost ${api_port}