pour la vérification des sondes toutes les 15 min

tache cron
pensez vous que ce code pourrait fonctionner
Code : Tout sélectionner
#!/usr/bin/env python
# -------------------------------------------
# Affichage du niveau d'eau de la cuve
# Fred J. mars2014
# -------------------------------------------
import RPi.GPIO as GPIO
import time
DEBUG = 0;
#-------------[ CABLAGE ]--------------------
# sondes 4 à 9 puisard ( 0, 33, 66, 100%)
# sondes 10 à 15 cuve eau ( 0, 33, 66, 100%)
Sonde = [4, 7, 8, 9, 10, 11, 14, 15];
#-------------[ Initialisation ]--------------
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
for i in range(0,8):
GPIO.setup(Sonde[i], GPIO.IN)
#-------------[ url suivant n° sonde et si true ou false ]--------------
sonde_true[1]="http://@IP:port/xxxxxxxxxx"
sonde_false[1]="http://@IP:port/xxxxxxxxxx"
sonde_true[2]="http://@IP:port/xxxxxxxxxx"
sonde_false[2]="http://@IP:port/xxxxxxxxxx"
sonde_true[3]="http://@IP:port/xxxxxxxxxx"
sonde_false[3]="http://@IP:port/xxxxxxxxxx"
sonde_true[4]="http://@IP:port/xxxxxxxxxx"
sonde_false[4]="http://@IP:port/xxxxxxxxxx"
sonde_true[5]="http://@IP:port/xxxxxxxxxx"
sonde_false[5]="http://@IP:port/xxxxxxxxxx"
sonde_true[6]="http://@IP:port/xxxxxxxxxx"
sonde_false[6]="http://@IP:port/xxxxxxxxxx"
sonde_true[7]="http://@IP:port/xxxxxxxxxx"
sonde_false[7]="http://@IP:port/xxxxxxxxxx"
sonde_true[8]="http://@IP:port/xxxxxxxxxx"
sonde_false[8]="http://@IP:port/xxxxxxxxxx"
#-------------[ Main ]--------------
for i in range(0,8):
if GPIO.input(sonde[i]) == True:
r = requests.get(sonde_true[i])
else:
r = requests.get(sonde_false[i])
r.url
exit