mirror of
https://github.com/hassio-addons/addon-airsonos.git
synced 2025-05-04 19:11:22 +00:00
27 lines
1.1 KiB
Text
Executable file
27 lines
1.1 KiB
Text
Executable file
#!/command/with-contenv bashio
|
|
# shellcheck shell=bash
|
|
# ==============================================================================
|
|
# Home Assistant Community Add-on: AirSonos
|
|
# Checks latency settings before starting the AirSonos server
|
|
# ==============================================================================
|
|
declare latency
|
|
|
|
# Migrate add-on data from the Home Assistant config folder,
|
|
# to the add-on configuration folder.
|
|
if ! bashio::fs.directory_exists '/config/airsonos.xml' \
|
|
&& bashio::fs.file_exists '/homeassistant/airsonos.xml'; then
|
|
mv /homeassistant/airsonos.xml /config/airsonos.xml \
|
|
|| bashio::exit.nok "Failed to migrate AirSonos configuration"
|
|
fi
|
|
|
|
# Create a configuration file, if it does not exist yet
|
|
if ! bashio::fs.file_exists '/config/airsonos.xml'; then
|
|
cp /etc/airsonos.xml /config/airsonos.xml
|
|
fi
|
|
|
|
# Warn if latency is below 500ms
|
|
latency=$(bashio::config 'latency_rtp')
|
|
if [[ "${latency}" -lt 500 && "${latency}" -ne 0 ]]; then
|
|
bashio::log.warning \
|
|
'Setting the RTP latency of AirPlay audio below 500ms is not recommended!'
|
|
fi
|