#!/usr/bin/env bashio
function enable_interface(){
local name="$1"
local description="$2"
local port="$3"
(
echo " "
echo " ${name}"
echo " xmlrpc://127.0.0.1:${port}"
echo " ${description}"
echo " "
) >> /etc/config/InterfacesList.xml
}
function init_interface_list() {
local rf=$1
local ip=$2
local wired=$3
echo -e "\n" > /etc/config/InterfacesList.xml
enable_interface "VirtualDevices" "Virtual Devices" "9292/groups"
if [ "$rf" == "true" ]; then
enable_interface "BidCos-RF" "BidCos-RF" "2001"
fi
if [ "$ip" == "true" ]; then
enable_interface "HmIP-RF" "HmIP-RF" "2010"
fi
if [ "$wired" == "true" ]; then
enable_interface "Hm-Wired" "Hm-Wired" "2000"
fi
echo "" >> /etc/config/InterfacesList.xml
}