added main.py, updated readme
This commit is contained in:
parent
1cde5a2cfd
commit
8293b0cc4e
2 changed files with 33 additions and 52 deletions
71
README.md
71
README.md
|
@ -1,23 +1,16 @@
|
||||||
# PiWebSense
|
# PiWebSense
|
||||||
|
|
||||||
## Milestones
|
## Git
|
||||||
|
This Repo gets pushed to three git hosts in the following order:
|
||||||
### Milestone 1
|
- [git.miaig.dev](https://git.miaig.dev/mia/abschlussarbeit)
|
||||||
|
- [git.gay](https://git.gay/mia/abschlussarbeit)
|
||||||
The Goal is to display and visualize data received/measured from a Raspberry Pi on a webinterface.
|
- [github.com](https://github.com/miaig/abschlussarbeit)
|
||||||
|
|
||||||
### Milestone 2
|
|
||||||
|
|
||||||
The Raspberry Pi should be integratable to a Home Assistant Server and be used as as sensor input and opitionally logic level output.
|
|
||||||
|
|
||||||
### Milestone 3
|
|
||||||
|
|
||||||
Data should be sent and received via MQTT to an ESP32. The Pi acts as a sensor gateway.
|
|
||||||
|
|
||||||
## Tech Stack / Hardware Requirements
|
## Tech Stack / Hardware Requirements
|
||||||
|
|
||||||
- **Raspberry Pi**: Model 4
|
- Raspberry Pi Model 4 for the sensors
|
||||||
- **Programming languages**: Python, jinja, HTML, CSS, JavaScript
|
- A Second Pc/Laptop/Server/Pi that'll host the Webserver
|
||||||
|
- **Programming languages used**: Python, jinja, HTML, CSS, JavaScript
|
||||||
- **Frameworks/tools/Libraries**:
|
- **Frameworks/tools/Libraries**:
|
||||||
- Webserver:
|
- Webserver:
|
||||||
- flask
|
- flask
|
||||||
|
@ -38,14 +31,17 @@ Data should be sent and received via MQTT to an ESP32. The Pi acts as a sensor g
|
||||||
- digitalio
|
- digitalio
|
||||||
- RPI.GPIO
|
- RPI.GPIO
|
||||||
|
|
||||||
- **Sensors**:
|
- **Exxmple Sensors**:
|
||||||
- LDR (Lightsensor)
|
- LDR (Lightsensor)
|
||||||
- Sound Detector
|
- Sound Detector
|
||||||
- Temperature and humidity
|
- Temperature and humidity
|
||||||
|
|
||||||
## Docs
|
## Docs
|
||||||
|
|
||||||
- The data needs to be providet in the following format:
|
This Program aims to receive Data from a dynamic amount of Sensors and Display the data on the Webserver. This can be done using the example Sensors in the sensor folder or by just writing your own ones using the further down documented Json file. The server and port get defined in sensors/sender.py. That file can be imported as shown in the examples.
|
||||||
|
|
||||||
|
The Webserver distiguishes between two update formats: live and history.
|
||||||
|
The data needs to be providet in the following format to be considered a history update. To be considered a live update the fielts type and unit have to be removed from the transmission.
|
||||||
|
|
||||||
```Json
|
```Json
|
||||||
{
|
{
|
||||||
|
@ -90,48 +86,19 @@ Data should be sent and received via MQTT to an ESP32. The Pi acts as a sensor g
|
||||||
- `.envrc`
|
- `.envrc`
|
||||||
This is also a bit of linux nixos magic to automatically set up the development environment using direnv
|
This is also a bit of linux nixos magic to automatically set up the development environment using direnv
|
||||||
- `main.py`
|
- `main.py`
|
||||||
The main file for the project
|
This file starts all sensors at once for easy deployment at a site.
|
||||||
|
|
||||||
### Git Help
|
## Instalation
|
||||||
|
|
||||||

|
### Sensors
|
||||||
|
To Install the exmple Sensors, simply install all the Requiered packages mentioned further above
|
||||||
|
|
||||||
### MarkDown Help
|
## Acknowledgments
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Html Help
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Css Help
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### JavaScript Help
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Jinja Help
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
## Arbeitsaufträge / Aufgabeneinteilung
|
|
||||||
|
|
||||||
|
|
||||||
| Mia | Chiara |
|
|
||||||
| --------------------------------- | --------------------------------------------- |
|
|
||||||
| Git | Daten von RPI erfassen und sauber abspeichern |
|
|
||||||
| Readme | Präsentation |
|
|
||||||
| Daten an einem Webserver anzeigen | |
|
|
||||||
|
|
||||||
### Acknowledgments
|
|
||||||
|
|
||||||
[Chiara](https://git.miaig.dev/chiara)
|
[Chiara](https://git.miaig.dev/chiara)
|
||||||
[Mia](https://git.miaig.dev/mia)
|
[Mia](https://git.miaig.dev/mia)
|
||||||
|
|
||||||
### License
|
## License
|
||||||
|
|
||||||
PiWebSense
|
PiWebSense
|
||||||
Copyright (C) 2025 Mia, Chiara
|
Copyright (C) 2025 Mia, Chiara
|
||||||
|
|
14
main.py
14
main.py
|
@ -10,3 +10,17 @@
|
||||||
# 1. Start all the Sensors
|
# 1. Start all the Sensors
|
||||||
# 2. Start the Webserver
|
# 2. Start the Webserver
|
||||||
# 3. Somehow transfer data from the Sensors to the Webserver
|
# 3. Somehow transfer data from the Sensors to the Webserver
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
programs = [
|
||||||
|
["python", "sensors/lichtwiderstandsSensor.py"],
|
||||||
|
["python", "sensors/mikrofonSensor.py"],
|
||||||
|
["python", "sensors/temperaturSensor.py"]
|
||||||
|
]
|
||||||
|
|
||||||
|
# Start each one in parallel
|
||||||
|
processes = []
|
||||||
|
for prog in programs:
|
||||||
|
p = subprocess.Popen(prog)
|
||||||
|
processes.append(p)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue