diff --git a/Mesures/humidity/solar-grafana/0_1_htu21d.lua b/Mesures/humidity/solar-grafana/0_1_htu21d.lua index 60120ed..72526fb 100644 --- a/Mesures/humidity/solar-grafana/0_1_htu21d.lua +++ b/Mesures/humidity/solar-grafana/0_1_htu21d.lua @@ -2,8 +2,8 @@ -- https://github.com/zuzu59/NodeMCU_Lua/tree/master/Mesures/humidity/bolo-thingspeak/docu/HTU21D.txt function readHTU21D() - if verbose then print("\n 0_1_htu21d.lua zf200524.1656 \n") end - if verbose then print("1readHTU21D: "..ztime_format(rtctime.get())) end + if verbose then print("\n 0_1_htu21d.lua zf200524.1915 \n") end + if verbose then print("1readHTU21D: "..ztime_stamp()) end id = 0 sda = 5 scl = 6 addr = 0x40 HUMIDITY = 0xE5 TEMPERATURE = 0xE3 diff --git a/Mesures/humidity/solar-grafana/0_2_htu21d.lua b/Mesures/humidity/solar-grafana/0_2_htu21d.lua index 5430191..24ea5bd 100644 --- a/Mesures/humidity/solar-grafana/0_2_htu21d.lua +++ b/Mesures/humidity/solar-grafana/0_2_htu21d.lua @@ -2,8 +2,8 @@ -- https://github.com/zuzu59/NodeMCU_Lua/tree/master/Mesures/humidity/bolo-thingspeak/docu/HTU21D.txt function readHTU21D() - if verbose then print("\n 0_2_htu21d.lua zf200524.1657 \n") end - if verbose then print("2readHTU21D: "..ztime_format(rtctime.get())) end + if verbose then print("\n 0_2_htu21d.lua zf200524.1915 \n") end + if verbose then print("2readHTU21D: "..ztime_stamp()) end id = 0 sda = 5 scl = 7 addr = 0x40 HUMIDITY = 0xE5 TEMPERATURE = 0xE3 diff --git a/Mesures/humidity/solar-grafana/0_cron.lua b/Mesures/humidity/solar-grafana/0_cron.lua index c578fda..8fbcac4 100644 --- a/Mesures/humidity/solar-grafana/0_cron.lua +++ b/Mesures/humidity/solar-grafana/0_cron.lua @@ -1,5 +1,5 @@ -- Petit script pour faire office de crontab pour les mesures -print("\n 0_cron.lua zf200524.1728 \n") +print("\n 0_cron.lua zf200524.1915 \n") function tprint(t) @@ -14,7 +14,7 @@ ztemp1=20 zhum1=40 ztemp2=20 zhum2=40 cron1=tmr.create() cron1:alarm(10*1000, tmr.ALARM_AUTO, function() if verbose then print("cron1........................") end - if verbose then print("cron1: "..ztime_format(rtctime.get())) end + if verbose then print("cron1: "..ztime_stamp()) 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()) diff --git a/Mesures/humidity/solar-grafana/0_http_post.lua b/Mesures/humidity/solar-grafana/0_http_post.lua index 6c20744..2410d20 100644 --- a/Mesures/humidity/solar-grafana/0_http_post.lua +++ b/Mesures/humidity/solar-grafana/0_http_post.lua @@ -1,13 +1,13 @@ -- Petit script pour envoyer en // es valeurs sur un serveur WEB (InfluxDB) -- via un http POST à travers un FIFO -if verbose then print("\n 0_http_post.lua zf200524.1656 \n") end +if verbose then print("\n 0_http_post.lua zf200524.1915 \n") end t_zurl={} t_zarg={} f_zpost=false function zpost() f_zpost=true zurl=t_zurl[1] zarg=t_zarg[1] - if verbose then print("zpost: "..ztime_format(rtctime.get())) end + if verbose then print("zpost: "..ztime_stamp()) end if verbose then print("zurl: "..zurl) end if verbose then print("zarg: "..zarg) end http.post(zurl, 'Content-Type: application/x-www-form-urlencoded\r\n', zarg, function(code, data) @@ -33,7 +33,7 @@ end function http_post(zurl,zarg) - if verbose then print("http_post: "..ztime_format(rtctime.get())) end + if verbose then print("http_post: "..ztime_stamp()) end table.insert(t_zurl, zurl) table.insert(t_zarg, zarg) print("t_zurl:") tprint(t_zurl) print("t_zarg:") tprint(t_zarg) if f_zpost==false then zpost() end diff --git a/Mesures/humidity/solar-grafana/boot.lua b/Mesures/humidity/solar-grafana/boot.lua index 0b63eff..e5c559c 100644 --- a/Mesures/humidity/solar-grafana/boot.lua +++ b/Mesures/humidity/solar-grafana/boot.lua @@ -1,6 +1,6 @@ -- Scripts à charger après le boot pour démarrer son projet -print("\n boot.lua zf200524.1712 \n") +print("\n boot.lua zf200524.1922 \n") function boot() verbose = true @@ -13,7 +13,7 @@ function boot() --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_cron.lua" if file.exists(f) then dofile(f) end --f = "web_ide2.lua" if file.exists(f) then dofile(f) end diff --git a/Mesures/humidity/solar-grafana/set_time.lua b/Mesures/humidity/solar-grafana/set_time.lua index 4883c25..a3f027c 100644 --- a/Mesures/humidity/solar-grafana/set_time.lua +++ b/Mesures/humidity/solar-grafana/set_time.lua @@ -1,7 +1,7 @@ -- Scripts pour régler l'horloge quand on est connecté en WIFI -- Permet aussi de 'compresser' le unix time afin de prendre moins de place dans les strings -print("\n set_time.lua zf200524.1711 \n") +print("\n set_time.lua zf200524.1914 \n") --source: https://www.freeformatter.com/epoch-timestamp-to-date-converter.html @@ -24,6 +24,12 @@ function ztime_format(ztime) return(string.format("%04d/%02d/%02d %02d:%02d:%02d", tm["year"], tm["mon"], tm["day"], tm["hour"], tm["min"], tm["sec"])) end +function ztime_stamp() + sec, usec = rtctime.get() + return (ztime_format(sec).."."..usec) +end + + set_time() tmr.create():alarm(2*1000, tmr.ALARM_SINGLE, function()