docs(gateway): update README with battery field, security fixes and warnings
- Add battery level field in MQTT payload example - Replace echo with nano for secret file creation - Add warning about bash history when writing passwords - Add warning about hardcoded paths in gateway.service - Update repository URL to new name - Update validation checklist
This commit is contained in:
@@ -12,7 +12,7 @@ remote MQTT broker on each reception.
|
||||
```
|
||||
|
||||
The gateway listens passively to BLE advertising packets and filters on the
|
||||
Nordic Configuration service UUID (`ef680100`). Each received packet is
|
||||
manufacturer data company_id `0xffff` as defined in the firmware specification. Each received packet is
|
||||
decoded following the firmware key/value specification and published
|
||||
immediately to the MQTT broker.
|
||||
|
||||
@@ -29,7 +29,8 @@ Example: `gateway_lausanne_01/C4:64:02:60:D9:16/update`
|
||||
"temp": 25.37,
|
||||
"humidity": 44,
|
||||
"co2_ppm": 400,
|
||||
"window_open": false
|
||||
"window_open": false,
|
||||
"battery": 85
|
||||
}
|
||||
```
|
||||
|
||||
@@ -78,13 +79,21 @@ cp config.example.json config.json
|
||||
|
||||
## Usage
|
||||
|
||||
Set the MQTT password as an environment variable before running:
|
||||
Set the MQTT password before running:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/secrets
|
||||
echo "MQTT_PASSWORD=your_password" > ~/secrets/mqtt.env
|
||||
nano ~/secrets/mqtt.env
|
||||
chmod 600 ~/secrets/mqtt.env
|
||||
export MQTT_PASSWORD="your_password"
|
||||
```
|
||||
|
||||
Add the following content to the file:
|
||||
MQTT_PASSWORD=your_password
|
||||
|
||||
Warning: do not use echo to write the password — it will remain
|
||||
in your bash history. Always use a text editor like nano.
|
||||
|
||||
```bash
|
||||
source venv/bin/activate
|
||||
python gateway.py
|
||||
```
|
||||
@@ -139,8 +148,8 @@ sudo apt install -y mosquitto mosquitto-clients
|
||||
|
||||
**5. Clone the repository**
|
||||
```bash
|
||||
git clone https://github.com/PI-E2EEDA/Plein-de-eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-project.git
|
||||
cd Plein-de-eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-project/gateway
|
||||
git clone https://github.com/PI-E2EEDA/Plein-de-eeeeeeeeee-project.git
|
||||
cd Plein-de-eeeeeeeeee-project/gateway
|
||||
```
|
||||
|
||||
**6. Create Python environment**
|
||||
@@ -161,11 +170,17 @@ nano config.json
|
||||
**8. Create the secret file**
|
||||
```bash
|
||||
mkdir -p ~/secrets
|
||||
echo "MQTT_PASSWORD=your_password" > ~/secrets/mqtt.env
|
||||
nano ~/secrets/mqtt.env
|
||||
chmod 600 ~/secrets/mqtt.env
|
||||
```
|
||||
Add the following content to the file:
|
||||
MQTT_PASSWORD=your_password
|
||||
|
||||
**9. Install the systemd service**
|
||||
Warning: the paths in gateway.service are hardcoded for the default
|
||||
pi user on Raspberry Pi OS. If you use a different username, update
|
||||
User, WorkingDirectory and ExecStart before copying the file.
|
||||
|
||||
```bash
|
||||
sudo cp gateway.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
@@ -192,7 +207,8 @@ sudo systemctl status gateway
|
||||
### Validation checklist
|
||||
- [ ] `active (running)` in systemctl status
|
||||
- [ ] Correct gateway ID in logs
|
||||
- [ ] MQTT connection established (`MQTT client connected`)
|
||||
- [ ] MQTT connection established (`Successfully connected to MQTT broker`)
|
||||
- [ ] Battery level included in published payload
|
||||
- [ ] TLS enabled (`TLS enabled`)
|
||||
- [ ] BLE scan started (`BLE scan started`)
|
||||
- [ ] Thingy:52 nodes detected in logs after power on
|
||||
|
||||
Reference in New Issue
Block a user