Ajouté le time stamp à la micro seconde, mais je n'ai pas encore les zéros significatifs :-(
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user