Skip to content

Commit

Permalink
Merge pull request #2 from nakata5321/main
Browse files Browse the repository at this point in the history
mosquitto and libp2p
  • Loading branch information
nakata5321 authored May 24, 2024
2 parents 451cc9d + fa9a1d9 commit 469eb53
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ sudo apt-get install wget unzip git

First, download the repository and go to it:
```commandline
git clone https://github.com/nakata5321/home-assistant-web3-build.git
git clone https://github.com/PinoutLTD/home-assistant-web3-build.git
cd home-assistant-web3-build/
```

Expand Down Expand Up @@ -47,7 +47,7 @@ After everything started, Home Assistant web interface will be on 8123 port and

To stop everything use next command:
```commandline
docker compose down
docker compose --profile z2m down
```

After that you delete all config directories. **This will cause you to lose all settings. You will need root accesses**
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ services:
libp2p:
container_name: libp2p-proxy
restart: unless-stopped
image: ghcr.io/pinoutltd/libp2p-ws-proxy:latest
image: ghcr.io/pinoutltd/libp2p-ws-proxy:v.${LIBP2P_VERSION}
ports:
- 127.0.0.1:8888:8888
- 127.0.0.1:9999:9999
Expand Down
41 changes: 23 additions & 18 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ if [ -d /dev/serial/by-id/ ]; then
# the directory exists
if [ "$(ls -A /dev/serial/by-id/)" ]; then
echo "the zigbee coordinator is installed"
# count how many devices connected
NUMB=$(ls -1q /dev/serial/by-id/ | wc -l)

if (($NUMB > 1)); then
echo "You have more that 1 connected devices. Please choose one"
select f in /dev/serial/by-id/*; do
test -n "$f" && break
echo ">>> Invalid Selection"
done
echo "You select $f"
Z2MPATH=$f
else
Z2MPATH=$(ls /dev/serial/by-id/)
Z2MPATH="/dev/serial/by-id/"$Z2MPATH
fi

else
echo "Cannot find zigbee coordinator location. Please insert it and run script again."
echo "Do you want to continue without zigbee coordinator? It will not start Zigbee2MQTT container."
Expand All @@ -23,6 +39,7 @@ if [ -d /dev/serial/by-id/ ]; then
* ) echo invalid response;;
esac
done
Z2MPATH="."
fi
else
echo "Cannot find zigbee coordinator location. Please insert it and run script again. The directory "/dev/serial/by-id/" does not exist"
Expand All @@ -38,24 +55,8 @@ else
* ) echo invalid response;;
esac
done
Z2MPATH="."
fi

# count how many devices connected
NUMB=$(ls -1q /dev/serial/by-id/ | wc -l)

if (($NUMB > 1)); then
echo "You have more that 1 connected devices. Please choose one"
select f in /dev/serial/by-id/*; do
test -n "$f" && break
echo ">>> Invalid Selection"
done
echo "You select $f"
Z2MPATH=$f
else
Z2MPATH=$(ls /dev/serial/by-id/)
Z2MPATH="/dev/serial/by-id/"$Z2MPATH
fi

export Z2MPATH

echo "Checking docker installation"
Expand Down Expand Up @@ -119,12 +120,16 @@ fi
if [[ -d ./mosquitto ]]
then
echo "mosquitto directory already exist"
MOSQUITTO_PASSWORD=`cat ./mosquitto/raw.txt`
export MOSQUITTO_PASSWORD
else
mkdir -p "mosquitto/config"
mkdir -p "zigbee2mqtt/data"

# create password for mqtt. Then save it in home directory and provide this data to z2m configuration
# create password for mqtt. Then save it in mosquitto home directory and provide this data to z2m configuration
MOSQUITTO_PASSWORD=$(openssl rand -hex 10)
echo "$MOSQUITTO_PASSWORD" > ./mosquitto/raw.txt

export MOSQUITTO_PASSWORD

cp $CURRENT_PATH/scripts/mosquitto.conf ./mosquitto/config/mosquitto.conf
Expand Down
3 changes: 2 additions & 1 deletion template.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ MOSQUITTO_VERSION=2.0.18
Z2M_VERSION=1.37.1
HA_VERSION=2024.5.4
ROBONOMICS_VERSION=1.8.3
IPFS_VERSION=0.27.0
IPFS_VERSION=0.27.0
LIBP2P_VERSION=1.0.1

0 comments on commit 469eb53

Please sign in to comment.