Skip to content

Commit 015f13a

Browse files
authored
Migrate AirSonos config out of Home Assistant config folder (#149)
1 parent bf604f1 commit 015f13a

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

airsonos/DOCS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ lack of audio. Note that `latency_rtp` does not delay playback start.
168168

169169
## Tweaking AirSonos
170170

171-
AirSonos creates a configuration file called `airsonos.xml` in your Home
172-
Assistant configuration directory. This file allows you to tweak each device
171+
AirSonos creates a configuration file called `airsonos.xml` in the add-on
172+
configuration directory. This file allows you to tweak each device
173173
separately. Every time it finds a new device, it will be added to that file.
174174

175175
> **NOTE**: It is HIGHLY recommended to stop the addon before making changes

airsonos/config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ arch:
1414
hassio_api: true
1515
host_network: true
1616
map:
17-
- config:rw
17+
- addon_config:rw
18+
- homeassistant_config:rw
1819
options:
1920
port: 49152
2021
latency_rtp: 1000

airsonos/rootfs/etc/s6-overlay/s6-rc.d/init-airsonos/run

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
# ==============================================================================
77
declare latency
88

9+
# Migrate add-on data from the Home Assistant config folder,
10+
# to the add-on configuration folder.
11+
if ! bashio::fs.directory_exists '/config/airsonos.xml' \
12+
&& bashio::fs.file_exists '/homeassistant/airsonos.xml'; then
13+
mv /homeassistant/airsonos.xml /config/airsonos.xml \
14+
|| bashio::exit.nok "Failed to migrate AirSonos configuration"
15+
fi
16+
917
# Create a configuration file, if it does not exist yet
1018
if ! bashio::fs.file_exists '/config/airsonos.xml'; then
1119
cp /etc/airsonos.xml /config/airsonos.xml

0 commit comments

Comments
 (0)