-
Notifications
You must be signed in to change notification settings - Fork 0
/
23_zigbee2mqtt_config.sh
executable file
·64 lines (53 loc) · 1.28 KB
/
23_zigbee2mqtt_config.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
#
# Initial config of Zigbee2MQTT
#
if [ ! -e .env ]
then
echo "<!> Please create proper .env file! Exiting."
exit 1
fi
if [ ! -e zigbee_dongle.env ]
then
echo "<!> Please create proper zigbee_dongle.env file! Exiting."
exit 1
fi
if [ ! -e mqtt.env ]
then
echo "<!> Please create proper mqtt.env file! Exiting."
exit 2
fi
set -o allexport
source .env
source mqtt.env
source zigbee_dongle.env
set +o allexport
cd ${STACKDIR}
zigbee2mqtt_image=`grep "image: zigbee2mqtt" docker-compose.yml | awk -F":" '{print $2":"$3}'`
echo "Docker compose down"
${COMPOSECOMMAND} -f docker-compose.yml down
CONFIGFILE="${STACKDIR}/zigbee2mqtt/data/configuration.yaml"
echo "Creating real Zigbee2MQTT config file: ${CONFIGFILE}"
echo -e '
homeassistant: false
permit_join: true
mqtt:
base_topic: zigbee2mqtt
server: tcp://mosquitto:1883
user: '${MQTT_USER}'
password: '${MQTT_PASSWORD}'
serial:
port: /dev/ttyACM0
advanced:
homeassistant_legacy_entity_attributes: false
legacy_api: false
legacy_availability_payload: false
network_key: GENERATE
device_options:
legacy: false
frontend: true
' > ${CONFIGFILE}
echo "Setting file permissions of ${CONFIGFILE}"
sudo chown -R ${USER}:docker ${CONFIGFILE}
echo "Compose down"
${COMPOSECOMMAND} -f docker-compose.yml down