hassio-plejd/plejd/rootfs/usr/bin/plejd.sh

29 lines
904 B
Bash
Raw Normal View History

2019-12-04 11:17:06 +01:00
#!/usr/bin/with-contenv bashio
CONFIG_PATH=/data/options.json
SITE=$(jq --raw-output ".site" $CONFIG_PATH)
USERNAME=$(jq --raw-output ".username" $CONFIG_PATH)
PASSWORD=$(jq --raw-output ".password" $CONFIG_PATH)
MQTTBROKER=$(jq --raw-output ".mqttBroker" $CONFIG_PATH)
MQTTUSERNAME=$(jq --raw-output ".mqttUsername" $CONFIG_PATH)
MQTTPASSWORD=$(jq --raw-output ".mqttPassword" $CONFIG_PATH)
INCLUDEROOMSASLIGHTS=$(jq --raw-output ".includeRoomsAsLights" $CONFIG_PATH)
2019-12-04 11:17:06 +01:00
PLEJD_PATH=/data/plejd.json
PLEJD_CONFIG="{
\"site\": \"$SITE\",
\"username\": \"$USERNAME\",
\"password\": \"$PASSWORD\",
\"mqttBroker\": \"$MQTTBROKER\",
\"mqttUsername\": \"$MQTTUSERNAME\",
\"mqttPassword\": \"$MQTTPASSWORD\",
\"includeRoomsAsLights\": \"$INCLUDEROOMSASLIGHTS\"
2019-12-04 11:17:06 +01:00
}
"
bashio::log.info 'Wrote plejd.json'
2019-12-04 11:17:06 +01:00
echo "$PLEJD_CONFIG" > $PLEJD_PATH
bashio::log.info 'Running add-on'
2019-12-04 11:17:06 +01:00
exec node /plejd/main.js