initial commit

This commit is contained in:
Marcus Westin 2019-12-04 11:17:06 +01:00
parent b43bc6c4e2
commit fe52e0901c
12 changed files with 2288 additions and 0 deletions

View file

@ -0,0 +1,8 @@
#!/usr/bin/execlineb -S0
# ==============================================================================
# Community Hass.io Add-ons: Plejd
# ==============================================================================
if -n { s6-test $# -ne 0 }
if -n { s6-test ${1} -eq 256 }
s6-svscanctl -t /var/run/s6/services

View file

@ -0,0 +1,14 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Community Hass.io Add-ons: Plejd
# Runs the Plejd service
# ==============================================================================
bashio::log.info 'Starting the Plejd service...'
# Change working directory
cd /plejd || bashio::exit.nok 'Unable to change working directory'
# Run the Plejd service
chmod +x /usr/bin/plejd.sh
exec /usr/bin/plejd.sh

25
rootfs/usr/bin/plejd.sh Normal file
View file

@ -0,0 +1,25 @@
#!/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)
PLEJD_PATH=/data/plejd.json
PLEJD_CONFIG="{
\"site\": \"$SITE\",
\"username\": \"$USERNAME\",
\"password\": \"$PASSWORD\",
\"mqttBroker\": \"$MQTTBROKER\",
\"mqttUsername\": \"$MQTTUSERNAME\",
\"mqttPassword\": \"$MQTTPASSWORD\"
}
"
echo "$PLEJD_CONFIG" > $PLEJD_PATH
exec node /plejd/main.js