created setup script
This commit is contained in:
15
README.md
15
README.md
@@ -2,20 +2,11 @@
|
|||||||
|
|
||||||
Zigbee smarthome stack
|
Zigbee smarthome stack
|
||||||
|
|
||||||
## Mosquitto ([eclipse-mosquitto](https://hub.docker.com/_/eclipse-mosquitto))
|
```
|
||||||
|
./scripts/setup.sh
|
||||||
Start the MQTT broker and create the password for `homeassistant`
|
|
||||||
|
|
||||||
```shell
|
|
||||||
docker compose run -it --rm mqtt mosquitto_passwd -c /mosquitto/config/pwfile homeassistant
|
|
||||||
```
|
```
|
||||||
|
|
||||||
###
|
## Mosquitto ([eclipse-mosquitto](https://hub.docker.com/_/eclipse-mosquitto))
|
||||||
|
|
||||||
## Zigbee2MQTT (koenkk/[zigbee2mqtt](https://hub.docker.com/r/koenkk/zigbee2mqtt/))
|
## Zigbee2MQTT (koenkk/[zigbee2mqtt](https://hub.docker.com/r/koenkk/zigbee2mqtt/))
|
||||||
|
|
||||||
Put the password in `./zigbee2mqtt/secret.yaml`
|
|
||||||
|
|
||||||
```
|
|
||||||
echo "password: <password>" > ./zigbee2mqtt/secret.yaml
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
SCRIPT_DIR=$(readlink -f $(dirname "${BASH_SOURCE[0]}"))
|
|
||||||
|
|
||||||
rm -rf $SCRIPT_DIR/mosquitto/data/mosquitto.db $SCRIPT_DIR/zigbee2mqtt/log/* $SCRIPT_DIR/zigbee2mqtt/database.db $SCRIPT_DIR/zigbee2mqtt/*.json
|
|
||||||
13
scripts/clear_data.sh
Executable file
13
scripts/clear_data.sh
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SCRIPT_DIR=$(readlink -f $(dirname "${BASH_SOURCE[0]}"))
|
||||||
|
REPO_DIR=$(dirname $SCRIPT_DIR)
|
||||||
|
|
||||||
|
rm -rf \
|
||||||
|
$REPO_DIR/mosquitto/config/pwfile \
|
||||||
|
$REPO_DIR/mosquitto/data/mosquitto.db \
|
||||||
|
$REPO_DIR/zigbee2mqtt/secret.yaml \
|
||||||
|
$REPO_DIR/zigbee2mqtt/*.json \
|
||||||
|
$REPO_DIR/zigbee2mqtt/log/* \
|
||||||
|
$REPO_DIR/zigbee2mqtt/database.db \
|
||||||
22
scripts/create_password.sh
Executable file
22
scripts/create_password.sh
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SCRIPT_DIR=$(readlink -f $(dirname "${BASH_SOURCE[0]}"))
|
||||||
|
REPO_DIR=$(dirname $SCRIPT_DIR)
|
||||||
|
COMPOSE_FILE=$REPO_DIR/docker-compose.yml
|
||||||
|
ENV_FILE=$REPO_DIR/.env
|
||||||
|
|
||||||
|
if [ ! -f "$ENV_FILE" ]; then
|
||||||
|
echo "Error: .env file not found."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
source "$ENV_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$MOSQUITTO_PASSWORD" ]; then
|
||||||
|
echo "MOSQUITTO_PASSWORD is not set. Exiting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker compose -f $COMPOSE_FILE run -it --rm mqtt mosquitto_passwd -b -c /mosquitto/config/pwfile homeassistant $MOSQUITTO_PASSWORD
|
||||||
|
|
||||||
|
echo "password: $MOSQUITTO_PASSWORD" > $REPO_DIR/zigbee2mqtt/secret.yaml
|
||||||
6
scripts/setup.sh
Executable file
6
scripts/setup.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SCRIPT_DIR=$(readlink -f $(dirname "${BASH_SOURCE[0]}"))
|
||||||
|
|
||||||
|
$SCRIPT_DIR/clear_data.sh
|
||||||
|
$SCRIPT_DIR/create_password.sh
|
||||||
Reference in New Issue
Block a user