Super ! Ma petite salle d'attente pour les http.post fonctionne à merveille. Je graphe même maintenant l'utilisation de la mémoire pour suivre les fuites mémoire ;-)

This commit is contained in:
Christian Zufferey
2020-05-24 14:28:19 +02:00
parent e1cd0eb2af
commit 6ac26d0c89
4 changed files with 16 additions and 22 deletions

View File

@@ -1,5 +1,5 @@
-- Petit script pour faire office de crontab pour les mesures
print("\n 0_cron.lua zf200524.1246 \n")
print("\n 0_cron.lua zf200524.1416 \n")
function tprint(t)
@@ -12,31 +12,23 @@ ztemp1=20 zhum1=40 ztemp2=20 zhum2=40
cron1=tmr.create()
cron1:alarm(5*1000, tmr.ALARM_AUTO, function()
cron1:alarm(10*1000, tmr.ALARM_AUTO, function()
if verbose then print("cron1........................") end
if verbose then gpio.write(zLED, gpio.LOW) tmr.delay(10000) gpio.write(zLED, gpio.HIGH) end
http_post(influxdb_url,"energy,memory=cron1 ram="..node.heap())
f = "0_1_htu21d.lua" if file.exists(f) then dofile(f) end
f = "0_2_htu21d.lua" if file.exists(f) then dofile(f) end
http_post(influxdb_url,"energy,capteur=th1 humidity="..ztemp1)
http_post(influxdb_url,"energy,capteur=th1 temperature="..ztemp1)
http_post(influxdb_url,"energy,capteur=th1 humidity="..zhum1)
http_post(influxdb_url,"energy,capteur=th1 humidity="..ztemp2)
http_post(influxdb_url,"energy,capteur=th1 humidity="..zhum2)
table.remove(t_zurl, 1) table.remove(t_zarg, 1)
print("t_zurl:") tprint(t_zurl) print("t_zarg:") tprint(t_zarg)
f = "0_2_htu21d.lua" if file.exists(f) then dofile(f) end
http_post(influxdb_url,"energy,capteur=th2 temperature="..ztemp2)
http_post(influxdb_url,"energy,capteur=th2 humidity="..zhum2)
f = "0_send_data.lua" if file.exists(f) then dofile(f) end
ztemp1=nil zhum1=nil ztemp2=nil zhum2=nil
f = "0_zdyndns.lua" if file.exists(f) then dofile(f) end
--f = "0_zdyndns.lua" if file.exists(f) then dofile(f) end
if verbose then print("End cron:\n"..node.heap()) end
collectgarbage()

View File

@@ -1,15 +1,17 @@
-- Scripts à charger après le boot pour démarrer son projet
print("\n boot.lua zf200524.1250 \n")
print("\n boot.lua zf200524.1357 \n")
function boot()
verbose = true
print("On lance le boot...")
print(node.heap()) collectgarbage() print(node.heap())
f = "0_http_post.lua" if file.exists(f) then dofile(f) end
--f="0_tst3_socat.lua" if file.exists(f) then dofile(f) end
--f="0_btn_flipflop.lua" if file.exists(f) then dofile(f) end
--f="0_cron.lua" if file.exists(f) then dofile(f) end
f="0_btn_flipflop.lua" if file.exists(f) then dofile(f) end
f="0_cron.lua" if file.exists(f) then dofile(f) end
--f = "web_ide2.lua" if file.exists(f) then dofile(f) end
@@ -23,4 +25,4 @@ boot()
--[[
verbose = true
verbose = false
]]
]]