96 lines
1.4 KiB
Markdown
96 lines
1.4 KiB
Markdown
# Aorus
|
|
|
|
## Description
|
|
|
|
installe un service qui creer des entites pour home assistant:
|
|
- etat de la batterie
|
|
- button pour eteindre le pc
|
|
- reboot
|
|
- eteindre l'ecran
|
|
- cpu
|
|
- memory
|
|
- adresse ip
|
|
- cpu frequency
|
|
|
|
## Prérequis
|
|
|
|
installation de python3 et de python-env:
|
|
```
|
|
sudo apt install python3-venv
|
|
```
|
|
|
|
```
|
|
python3 -m venv monenv
|
|
```
|
|
activation de l'environnement:
|
|
|
|
```
|
|
source monenv/bin/activate
|
|
```
|
|
|
|
## Installation
|
|
|
|
```
|
|
git clone http://10.0.1.200/pilot/aorus.git
|
|
```
|
|
|
|
```
|
|
cd aorus
|
|
```
|
|
Création de l'environnement:
|
|
|
|
```
|
|
python3 -m venv monenv
|
|
```
|
|
Activation de l'environnement:
|
|
```
|
|
source monenv/bin/activate
|
|
```
|
|
Installation des paquets additionnels:
|
|
```
|
|
pip install -r requirements.txt
|
|
```
|
|
## Test du programme
|
|
|
|
```
|
|
python3 main.py
|
|
```
|
|
Sortie de l'environnement:
|
|
```
|
|
deactivate
|
|
```
|
|
|
|
## Installation en temps que service
|
|
|
|
authorisation de shutdown: ajouter a la fin du fichier
|
|
|
|
```
|
|
sudo visudo
|
|
```
|
|
```
|
|
gilles ALL=(ALL) NOPASSWD: /sbin/shutdown
|
|
gilles ALL=(ALL) NOPASSWD: /sbin/reboot
|
|
gilles ALL=(ALL) NOPASSWD: /usr/bin/tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
|
|
```
|
|
Installation du service en manuel:
|
|
|
|
```
|
|
sudo cp mqtt_pilot.service /etc/systemd/system/
|
|
```
|
|
```
|
|
sudo systemctl daemon-reload
|
|
```
|
|
```
|
|
sudo systemctl enable mqtt_pilot.service
|
|
```
|
|
```
|
|
sudo systemctl start mqtt_pilot.service
|
|
```
|
|
```
|
|
sudo systemctl status mqtt_pilot.service
|
|
```
|
|
lancer l'installation du service:
|
|
```
|
|
sudo ./install.sh
|
|
```
|