mirror of
https://github.com/hassio-addons/addon-airsonos.git
synced 2025-05-04 19:11:22 +00:00
✨ Adds support for tweaking AirSonos using its configuration file
This commit is contained in:
parent
f22416b468
commit
e1a7ac068d
4 changed files with 29 additions and 1 deletions
|
@ -15,6 +15,9 @@
|
|||
"hassio_api": true,
|
||||
"homeassistant_api": false,
|
||||
"host_network": true,
|
||||
"map": [
|
||||
"config:rw"
|
||||
],
|
||||
"options": {
|
||||
"log_level": "info",
|
||||
"address": "",
|
||||
|
|
14
airsonos/rootfs/etc/airsonos.xml
Normal file
14
airsonos/rootfs/etc/airsonos.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0"?>
|
||||
<aircast>
|
||||
<common>
|
||||
<enabled>1</enabled>
|
||||
<stop_receiver>0</stop_receiver>
|
||||
<latency></latency>
|
||||
<codec>pcm</codec>
|
||||
<artwork></artwork>
|
||||
</common>
|
||||
<main_log>info</main_log>
|
||||
<cast_log>info</cast_log>
|
||||
<util_log>warn</util_log>
|
||||
<log_limit>-1</log_limit>
|
||||
</aircast>
|
|
@ -8,8 +8,13 @@ source /usr/lib/hassio-addons/base.sh
|
|||
|
||||
declare latency
|
||||
|
||||
latency=$(hass.config.get 'latency_rtp')
|
||||
# Create a configuration file, if it does not exist yet
|
||||
if ! hass.file_exists '/config/airsonos.xml'; then
|
||||
cp /etc/airsonos.xml /config/airsonos.xml
|
||||
fi
|
||||
|
||||
# Warn if latency is below 500ms
|
||||
latency=$(hass.config.get 'latency_rtp')
|
||||
if [[ "${latency}" -lt 500 && "${latency}" -ne 0 ]]; then
|
||||
hass.log.warning \
|
||||
'Setting the RTP latency of AirPlay audio below 500ms is not recommended!'
|
||||
|
|
|
@ -13,6 +13,12 @@ hass.log.info 'Starting the AirSonos server'
|
|||
# Non-interactive
|
||||
options+=(-Z)
|
||||
|
||||
# Configuration file
|
||||
options+=(-x '/config/airsonos.xml')
|
||||
|
||||
# Update configuration file when new devices where detected
|
||||
options+=(-I)
|
||||
|
||||
# Bind to a specific interface
|
||||
if hass.config.has_value 'address'; then
|
||||
options+=(-b "$(hass.config.get 'address'):$(hass.config.get 'port')")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue