diff --git a/README.md b/README.md index a38cdcd..289a2f4 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,9 @@ Zigbee smarthome stack ``` ./scripts/setup.sh ``` + +Process: + +- clears all the existing data, except certain files +- asks for a new MQTT password, which gets saved in `./zigbee2mqtt/secret.yaml` +- runs `docker compose up ...` \ No newline at end of file diff --git a/scripts/restic_backup.sh b/scripts/restic_backup.sh new file mode 100755 index 0000000..39f4f3e --- /dev/null +++ b/scripts/restic_backup.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -e + +SCRIPT_DIR=$(readlink -f $(dirname "${BASH_SOURCE[0]}")) +REPO_DIR=$(dirname $SCRIPT_DIR) +COMPOSE_FILE=$REPO_DIR/docker-compose.yml + +SERVICES="mqtt z2m" + +echo -n "Stopping containers..." +docker compose -f $COMPOSE_FILE stop $SERVICES 2>/dev/null +echo "Done" + +echo -n "Running backup..." +$SCRIPT_DIR/restic_command.sh backup /data "$@" +echo "Done" + +echo -n "Executing compose up..." +docker compose -f $COMPOSE_FILE up -d 2>/dev/null +echo "Done" + +echo -n "Pruning restic repo..." +$SCRIPT_DIR/restic_prune.sh 1>/dev/null +echo "Done" + +SPACE=$(du -hs /mnt/* | awk '{print $1}') +echo "Total space used: $SPACE" diff --git a/scripts/restic_command.sh b/scripts/restic_command.sh index 736bfb6..e6b28d7 100755 --- a/scripts/restic_command.sh +++ b/scripts/restic_command.sh @@ -3,9 +3,10 @@ set -e SCRIPT_DIR=$(readlink -f $(dirname "${BASH_SOURCE[0]}")) -DATA_DIR=$SCRIPT_DIR/data +REPO_DIR=$(dirname $SCRIPT_DIR) +DATA_DIR=$REPO_DIR -ENV_FILE=$SCRIPT_DIR/.env +ENV_FILE=$REPO_DIR/.env source $ENV_FILE docker run -it --rm \ diff --git a/scripts/restic_prune.sh b/scripts/restic_prune.sh new file mode 100755 index 0000000..34fa1f6 --- /dev/null +++ b/scripts/restic_prune.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +SCRIPT_DIR=$(readlink -f $(dirname "${BASH_SOURCE[0]}")) + +$SCRIPT_DIR/restic_command.sh forget --prune \ +--keep-last 5 \ +--keep-weekly 8 \ +--keep-monthly 12 \ +--keep-yearly 7 diff --git a/zigbee2mqtt/configuration.yaml b/zigbee2mqtt/configuration.yaml index 1c4dc13..09202cf 100644 --- a/zigbee2mqtt/configuration.yaml +++ b/zigbee2mqtt/configuration.yaml @@ -15,3 +15,98 @@ advanced: device_options: legacy: false frontend: true +devices: + '0x54ef4410005ca806': + friendly_name: Bathroom Motion + '0x00158d0006ca3f53': + friendly_name: Bedroom Motion + '0x00158d000894fb3a': + friendly_name: Closet Motion + '0x00158d0006c49d5f': + friendly_name: Kitchen Motion + '0x00158d0007e22931': + friendly_name: Cube 1 + '0x7cb03eaa00a698a6': + friendly_name: Server Lamp + '0x7cb03eaa00a68979': + friendly_name: Desk Lamp + '0xa4c138f4c2fce2ed': + friendly_name: Couch Corner + '0xa4c1388ed789ca18': + friendly_name: Kitchen + description: Under cabinet lights + '0xf0d1b8000001ccc4': + friendly_name: Bedside 2 + '0xf0d1b80000021416': + friendly_name: Bedside 1 + description: Nearest to the door + '0x00158d0006ba2970': + friendly_name: Living Room Button + legacy: false + '0x00158d0006f3a190': + friendly_name: Bedroom Button 1 + description: Nearest to the door + '0x00158d0006ba47e9': + friendly_name: Bedroom Button 2 + '0x00158d0007004bc5': + friendly_name: Bathroom Button + '0x00158d0006ba29fb': + friendly_name: Kitchen Button + '0x00158d0006ca405f': + friendly_name: Laundry Motion + '0x7cb03eaa00a69ad3': + friendly_name: Patio + '0xf0d1b8000001d920': + friendly_name: Laundry + '0x001788010ce41962': + friendly_name: Closet Back + '0x001788010ce41939': + friendly_name: Closet Front + '0x001788010cdfb112': + friendly_name: Bathroom Middle + '0x001788010c752d04': + friendly_name: Bathroom Right + '0x001788010cdfb05e': + friendly_name: Bathroom Left + '0x00124b0022305984': + friendly_name: Overhead 1 + '0x00124b0022305ad5': + friendly_name: Overhead 2 + '0x00124b0022305735': + friendly_name: Overhead 3 + '0x00158d0007ef801d': + friendly_name: Back + '0x00158d00067960ef': + friendly_name: Front + '0xa4c1385e575697be': + friendly_name: RGBCCT Strip + '0x00158d0006a0cebe': + friendly_name: Living Room Motion +groups: + '1': + friendly_name: living_room + devices: + - 0x7cb03eaa00a698a6/3 + - 0x7cb03eaa00a68979/3 + '2': + friendly_name: bedroom + devices: + - 0xf0d1b80000021416/1 + - 0xf0d1b8000001ccc4/1 + '3': + friendly_name: closet + devices: + - 0x001788010ce41962/11 + - 0x001788010ce41939/11 + '4': + friendly_name: bathroom + devices: + - 0x001788010cdfb05e/11 + - 0x001788010cdfb112/11 + - 0x001788010c752d04/11 + '5': + friendly_name: overhead + devices: + - 0x00124b0022305984/1 + - 0x00124b0022305ad5/1 + - 0x00124b0022305735/1 \ No newline at end of file