Statut connexion
Hors ligne
Dernier ping
08/05 21:45:17
Il y a 40422min
Firmware
audit-test
En attente
0 action
En cours
2 actions
Dernière action : post_listing
23/04 09:15
π Authentification RPi
π Logs Raspberry Pi
| # | Niveau | Message | Action ID | Date |
|---|---|---|---|---|
| 1 | info | Audit test log | β | 23/04 09:17:33 |
π Documentation API pour le Raspberry Pi
ImplΓ©mentez ces appels API dans votre code Python sur le Raspberry Pi (src/orchestrator.py).
Exemple Python (boucle principale RPi)
import requests, time
API = "https://plzbot.fr/api.php"
SECRET = "ccd8d15c85cc019a"
HEADERS = {"X-RPi-Secret": SECRET}
def ping():
requests.post(f"{API}?action=rpi_ping", json={"firmware": "1.0.0"}, headers=HEADERS, timeout=10)
def pull_and_execute():
r = requests.get(f"{API}?action=rpi_pull_action", headers=HEADERS, timeout=10).json()
action = r.get("data", {}).get("action")
if not action:
return
try:
result = execute_action(action) # votre logique ici
requests.post(f"{API}?action=rpi_complete_action",
json={"action_id": action["id"], "success": True, "result": result},
headers=HEADERS, timeout=10)
except Exception as e:
requests.post(f"{API}?action=rpi_complete_action",
json={"action_id": action["id"], "success": False},
headers=HEADERS, timeout=10)
while True:
ping()
for _ in range(6): # Pull toutes les 10s, ping toutes les 60s
pull_and_execute()
time.sleep(10)