106 lines
2.8 KiB
Markdown
106 lines
2.8 KiB
Markdown
# Migration Node-RED → JH Photomaton
|
||
|
||
## Ce que remplace JH Photomaton
|
||
|
||
| Fonctionnalité | Node-RED (avant) | JH Photomaton (après) |
|
||
|---|---|---|
|
||
| Bouton GPIO23 multi-clic | `button-events` node | `ButtonService` (gpiozero) |
|
||
| Relay GPIO12 | Nœud GPIO | `ButtonService.relay_on/off()` |
|
||
| NeoPixels GPIO18 | `rpi-neopixels` node | `LEDService` (rpi_ws281x) |
|
||
| Webhooks photobooth-app | `/api/photobooth/` | `/api/webhook/photobooth` |
|
||
| File d'attente impression | SQLite Node-RED | SQLite via `PrinterService` |
|
||
| Dashboard admin | Node-RED Dashboard | `/admin` — FastAPI + HTML |
|
||
| RAM consommée | ~150–300 Mo | ~30–80 Mo (objectif) |
|
||
|
||
## Étapes de migration
|
||
|
||
### 1. Installer JH Photomaton
|
||
|
||
```bash
|
||
cd /home/pi/jh-photomaton
|
||
sudo bash scripts/install.sh
|
||
```
|
||
|
||
### 2. Mettre à jour plugin_commander.json
|
||
|
||
Remplacer `~/.config/photobooth-app/plugin_commander.json` par notre version :
|
||
|
||
```bash
|
||
cp /home/pi/jh-photomaton/photobooth-app/config/plugin_commander_jh.json \
|
||
~/.config/photobooth-app/plugin_commander.json
|
||
```
|
||
|
||
Redémarrer photobooth-app :
|
||
```bash
|
||
sudo systemctl restart photobooth-app
|
||
```
|
||
|
||
### 3. Mettre à jour le share_command "Demande d'impression"
|
||
|
||
Dans `~/.config/photobooth-app/config.json`, modifier l'action de partage :
|
||
|
||
```json
|
||
{
|
||
"name": "Demande d'impression",
|
||
"processing": {
|
||
"share_command": "curl 'http://127.0.0.1:8090/api/print/request?filename={filename}'"
|
||
}
|
||
}
|
||
```
|
||
|
||
Ou utiliser la page `/admin/actions` de JH Photomaton pour éditer directement.
|
||
|
||
### 4. Désactiver Node-RED
|
||
|
||
```bash
|
||
sudo systemctl stop nodered
|
||
sudo systemctl disable nodered
|
||
```
|
||
|
||
Gain RAM : ~150-300 Mo libérés.
|
||
|
||
### 5. Mettre à jour Zoraxy (optionnel)
|
||
|
||
Changer le sous-domaine `photomaton-nodered.lessapinsduweb.com` pour pointer vers `:8090` au lieu de `:1880`.
|
||
|
||
### 6. Démarrer JH Photomaton
|
||
|
||
```bash
|
||
sudo systemctl start jh-photomaton
|
||
sudo systemctl status jh-photomaton
|
||
```
|
||
|
||
Accès admin : `http://photomaton-nodered.lessapinsduweb.com/admin`
|
||
(ou `http://10.3.141.1:8090/admin` depuis le WiFi Photomaton)
|
||
|
||
## Vérification
|
||
|
||
```bash
|
||
# Logs
|
||
sudo journalctl -u jh-photomaton -f
|
||
|
||
# Test bouton (simulation)
|
||
curl -X POST http://localhost:8090/api/system/button/simulate?clicks=1
|
||
|
||
# Test LED
|
||
curl -X POST http://localhost:8090/api/leds/effect?effect=countdown
|
||
|
||
# Test webhook
|
||
curl "http://localhost:8090/api/webhook/photobooth?event_key=counting&mediaitem_type=image"
|
||
|
||
# Statut système
|
||
curl http://localhost:8090/api/system/stats
|
||
```
|
||
|
||
## Rollback (retour Node-RED)
|
||
|
||
```bash
|
||
sudo systemctl stop jh-photomaton
|
||
sudo systemctl disable jh-photomaton
|
||
sudo systemctl start nodered
|
||
sudo systemctl enable nodered
|
||
# Restaurer plugin_commander.json original
|
||
cp ~/.config/photobooth-app/plugin_commander.json_backup-* ~/.config/photobooth-app/plugin_commander.json
|
||
sudo systemctl restart photobooth-app
|
||
```
|