-
Notifications
You must be signed in to change notification settings - Fork 13
/
ozwcp.sh
executable file
·29 lines (23 loc) · 1.35 KB
/
ozwcp.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bashio
# Link options.xml from /config/ (used by OZW within Home Assistant) to
# the OZW used by OZWCP, so that they both will use the same options.
ln -fs /config/options.xml /root/open-zwave/config/options.xml
# Edit options.xml to force OZW to use /config/ for its user directory
# (where it puts logs, scene config, network cache). Home Assistant does
# this through other means; putting it in options.xml makes sure that OZWCP
# will look in the same place.
xmlstarlet ed -L -N x="http://code.google.com/p/open-zwave/"\
-d '/x:Options/x:Option[@name="UserPath"]'\
-s '/x:Options' -t elem -n NewOption\
-i '/x:Options/NewOption' -t attr -n name -v UserPath\
-i '/x:Options/NewOption' -t attr -n value -v "/config/"\
-r '/x:Options/NewOption' -v Option\
/config/options.xml
# The part of OZW that *writes* the log respects the UserPath setting in options.xml
# However, OZWCP's web interface expects to find it in its working directory (and its
# working directory must be the ozwcp repo), so we link it.
ln -fs /config/OZW_Log.txt /root/open-zwave-control-panel/OZW_Log.txt
bashio::log.info "Attempting to stop hass.io to avoid network, config, and log conflicts..."
bashio::homeassistant.stop || bashio::log.warning 'Failed top stop hass.io; continuing anyway'
bashio::log.info "Starting ozwcp..."
/root/open-zwave-control-panel/ozwcp