Add README and rc.local for LoudnessSpy setup and configuration
This commit is contained in:
parent
095ed43c84
commit
958eb59537
2 changed files with 65 additions and 0 deletions
58
Readme.md
Normal file
58
Readme.md
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
# loudnessspy
|
||||||
|
|
||||||
|
Ein Rust-Programm für den Raspberry Pi, das kontinuierlich die Lautstärke (RMS) des ersten verfügbaren Mikrofons misst und alle 2 Sekunden per MQTT an einen Server sendet.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
- Durchgehende Aufnahme des ersten (USB-)Mikrofons
|
||||||
|
- Alle 2 Sekunden Berechnung der mittleren Lautstärke (RMS)
|
||||||
|
- Versand der Werte als JSON per MQTT (mit Username/Passwort)
|
||||||
|
- Robuster Betrieb: Reconnect bei Netzwerkproblemen, Timeout beim Senden
|
||||||
|
|
||||||
|
## Konfiguration
|
||||||
|
Die Datei `config.toml` im Projektverzeichnis steuert die Verbindung:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
host = "localhost"
|
||||||
|
port = 1883
|
||||||
|
username = "user"
|
||||||
|
password = "pass"
|
||||||
|
client_id = "loudnessspy"
|
||||||
|
topic = "loudnesspy/volume"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Kompilieren für Raspberry Pi 1 (32 Bit)
|
||||||
|
1. Rust-Target installieren:
|
||||||
|
```
|
||||||
|
rustup target add arm-unknown-linux-gnueabihf
|
||||||
|
```
|
||||||
|
2. Cross-Compiler und ARM-ALSA-Entwicklerdateien installieren:
|
||||||
|
```
|
||||||
|
sudo apt-get install gcc-arm-linux-gnueabihf libasound2-dev:armhf pkg-config-arm-linux-gnueabihf
|
||||||
|
```
|
||||||
|
3. Umgebungsvariablen setzen:
|
||||||
|
```
|
||||||
|
export PKG_CONFIG_SYSROOT_DIR=/usr/arm-linux-gnueabihf
|
||||||
|
export PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig
|
||||||
|
export PKG_CONFIG=arm-linux-gnueabihf-pkg-config
|
||||||
|
```
|
||||||
|
4. Bauen:
|
||||||
|
```
|
||||||
|
cargo build --release --target=arm-unknown-linux-gnueabihf
|
||||||
|
```
|
||||||
|
|
||||||
|
## MQTT-Format
|
||||||
|
Alle 2 Sekunden wird ein JSON wie folgt gesendet:
|
||||||
|
```
|
||||||
|
{"rms":0.0123}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Hinweise
|
||||||
|
- Das Programm sucht bevorzugt nach USB-Mikrofonen, nutzt sonst das Standardgerät.
|
||||||
|
- Bei fehlender Verbindung wird automatisch reconnectet.
|
||||||
|
- Fehler beim Senden werden geloggt, blockieren aber nicht den Hauptloop.
|
||||||
|
|
||||||
|
rc.local script to start LoudnessSpy on boot
|
||||||
|
|
||||||
|
---
|
||||||
|
Autor: Leonhard Suckau
|
||||||
|
Lizenz: AGPL
|
||||||
7
rc.local
Executable file
7
rc.local
Executable file
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
# rc.local
|
||||||
|
|
||||||
|
# Start LoudnessSpy
|
||||||
|
/opt/loudnessspy/loudnessspy &
|
||||||
|
|
||||||
|
exit 0
|
||||||
Loading…
Reference in a new issue