forked from scooter1556/hass-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
28 lines (23 loc) · 1.06 KB
/
run.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
if bashio::services.available mqtt; then
echo "MQTT found in this Home Assistant instance."
MQTT_HOST=$(bashio::services mqtt "host")
MQTT_PORT=$(bashio::services mqtt "port")
export MQTT_USERNAME=$(bashio::services mqtt "username")
export MQTT_PASSWORD=$(bashio::services mqtt "password")
else
echo "Using external MQTT broker."
MQTT_HOST=$(bashio::config "mqtt_host")
MQTT_PORT=$(bashio::config "mqtt_port")
export MQTT_USERNAME=$(bashio::config "mqtt_user")
export MQTT_PASSWORD=$(bashio::config "mqtt_password")
fi
GLOW_DEVICE=$(bashio::config "glow_device_id")
GLOW_USERNAME=$(bashio::config "glow_username")
GLOW_PASSWORD=$(bashio::config "glow_password")
OTHER_ARGS=""
if bashio::config.true "discovery"; then
OTHER_ARGS="${OTHER_ARGS} --homeassistant"
fi
echo "Starting glow2mqtt.py..."
python3 -u /glow2mqtt.py --glow_device $GLOW_DEVICE --glow_username $GLOW_USERNAME --glow_password $GLOW_PASSWORD --mqtt_address $MQTT_HOST --mqtt_port $MQTT_PORT --mqtt_username $MQTT_USERNAME --mqtt_password $MQTT_PASSWORD $OTHER_ARGS