From 48b41042bf5e9bbb478606ae2a25bd6ade3a5198 Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Sun, 19 Jan 2020 09:54:38 +0100 Subject: [PATCH] =?UTF-8?q?Mis=20en=20service=20le=20mode=20verbose=20afin?= =?UTF-8?q?=20de=20pas=20polluer=20la=20console=20telnet=20avec=20tous=20l?= =?UTF-8?q?es=20*prints*=20utilis=C3=A9s=20pour=20les=20debugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Mesures/humidity/bolo-thingspeak/0_cron.lua | 18 ++++++++---------- .../humidity/bolo-thingspeak/0_send_data.lua | 17 ++++++----------- .../humidity/bolo-thingspeak/_zremote_cmd.txt | 15 ++++++++------- Mesures/humidity/bolo-thingspeak/luatool.py | 0 4 files changed, 22 insertions(+), 28 deletions(-) mode change 100644 => 100755 Mesures/humidity/bolo-thingspeak/luatool.py diff --git a/Mesures/humidity/bolo-thingspeak/0_cron.lua b/Mesures/humidity/bolo-thingspeak/0_cron.lua index 79a98ac..05e913a 100644 --- a/Mesures/humidity/bolo-thingspeak/0_cron.lua +++ b/Mesures/humidity/bolo-thingspeak/0_cron.lua @@ -1,16 +1,14 @@ --- Petit script pour faire office de crontab pour les mesures de température -print("\n 0_cron.lua zf200115.1704 \n") +-- Petit script pour faire office de crontab pour les mesures +print("\n 0_cron.lua zf200119.0947 \n") cron1=tmr.create() cron1:alarm(20*1000, tmr.ALARM_AUTO, function() - print("cron1........................") - ztemp1=readTemp() - zhum1=readHumi() - print("Temperature: "..ztemp1.." °C") - print("Humidity: "..zhum1.." %") + if verbose then print("cron1........................") end + if verbose then gpio.write(zLED, gpio.LOW) tmr.delay(10000) gpio.write(zLED, gpio.HIGH) end + ztemp1=readTemp() zhum1=readHumi() + if verbose then print("Temperature: "..ztemp1.." °C") end + if verbose then print("Humidity: "..zhum1.." %") end zurl=thingspeak_url.."field1="..tostring(ztemp1).."&field2="..tostring(zhum1) send_temp() + if verbose then print(node.heap()) collectgarbage() print(node.heap()) end end) - - - diff --git a/Mesures/humidity/bolo-thingspeak/0_send_data.lua b/Mesures/humidity/bolo-thingspeak/0_send_data.lua index 53132e7..c7784f2 100644 --- a/Mesures/humidity/bolo-thingspeak/0_send_data.lua +++ b/Mesures/humidity/bolo-thingspeak/0_send_data.lua @@ -1,25 +1,20 @@ -- Petit script pour envoyer les valeurs de température sur un serveur WEB via un HTTP GET -print("\n 0_send_data.lua zf200115.1705 \n") +print("\n 0_send_data.lua zf200119.0932 \n") function send_temp() - print("send_web_temp: ") - print(zurl) + if verbose then print("send_web_temp: ") end + if verbose then print(zurl) end http.get(zurl, nil, function(code, data) --- print("toto") if (code < 0) then - print("HTTP request failed") - print("zuzu", code, data) + if verbose then print("HTTP request failed") end + if verbose then print("zuzu", code, data) end else - print(code, data) + if verbose then print(code, data) end end --- print("tutu") end) --- print("titi") end --[[ - send_temp() - ]] diff --git a/Mesures/humidity/bolo-thingspeak/_zremote_cmd.txt b/Mesures/humidity/bolo-thingspeak/_zremote_cmd.txt index 32a1c0d..0f29d54 100644 --- a/Mesures/humidity/bolo-thingspeak/_zremote_cmd.txt +++ b/Mesures/humidity/bolo-thingspeak/_zremote_cmd.txt @@ -1,15 +1,17 @@ # Quelques commandes remote (luatool) à envoyer avec le plugin Atom-IDE-terminal de l'éditeur Atom -# zf200116.1833 +# zf200119.0953 Todo à faire pour ce projet ! +v- if verbose print partout dans *.lua +v- clignoter la led à chaque mesure en fonction de verbose +- utiliser le bouton pour piloter le verbose -- terminer la page .html affichage de la température et de l'humidité +v- terminer la page .html affichage de la température et de l'humidité - trouver un moyen pour configurer la lED dans initz.lua sans le rendre dangereux en cas de problème (éviter le reflashing en cas de reboot loop) - lancement ou arrêt du WEBIDE via la home page - arrêter de demander de connecter le WIFI automatiquement en mode station juste après le boot dans la config wifiinit (automatic connect) -- if verbose print partout dans *.lua - le wifi setup ne fonctionne toujours pas quand il y a déjà un ap de connecté (problème du reboot quand adrs ip ok)! v- ajouter fonction restart dans z_index.html (ATTENTION avec un argument restart, pas besoin de faire une page restart.html !) @@ -64,13 +66,12 @@ for k,v in pairs(_G) do print(k,v) end # commandes lua pour ce projet -export zIP="192.168.0.182" -export zIP="192.168.4.1" -export zIP="192.168.4.4" +export zIP="192.168.0.152" export zport="23" ./luatool.py --ip $zIP:$zport -f z_index.html -./luatool.py --ip $zIP:$zport -f secrets_project.lua +./luatool.py --ip $zIP:$zport -f 0_send_data.lua +./luatool.py --ip $zIP:$zport -f 0_cron.lua ./luatool.py --ip $zIP:$zport -f api_sonoff.html http://192.168.0.182 diff --git a/Mesures/humidity/bolo-thingspeak/luatool.py b/Mesures/humidity/bolo-thingspeak/luatool.py old mode 100644 new mode 100755