Ouf enfin cela commence à fonctionner, j'ai eu des problèmes de lancement en // de http.post qui ne pouvaient pas être lancés en //
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
-- 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 zf200523.1642 \n") end
|
||||
if verbose then print("\n 0_1_htu21d.lua zf200523.1816 \n") end
|
||||
|
||||
id = 0 sda = 5 scl = 6 addr = 0x40
|
||||
HUMIDITY = 0xE5 TEMPERATURE = 0xE3
|
||||
@@ -35,9 +35,9 @@ function readHTU21D()
|
||||
|
||||
id=nil addr=nil HUMIDITY=nil TEMPERATURE=nil r=nil
|
||||
read_HTU21D=nil readTemp=nil readHumi=nil readHTU21D=nil
|
||||
if verbose then print(node.heap()) end
|
||||
if verbose then print("End 1_htu21d:\n"..node.heap()) end
|
||||
collectgarbage()
|
||||
if verbose then print(node.heap()) end
|
||||
end
|
||||
|
||||
--readHTU21D()
|
||||
readHTU21D()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
-- 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 zf200523.1643 \n") end
|
||||
if verbose then print("\n 0_2_htu21d.lua zf200523.1816 \n") end
|
||||
|
||||
id = 0 sda = 5 scl = 4 addr = 0x40
|
||||
HUMIDITY = 0xE5 TEMPERATURE = 0xE3
|
||||
@@ -29,15 +29,15 @@ function readHTU21D()
|
||||
return tonumber(string.format("%.1f", tostring(r/100)))
|
||||
end
|
||||
|
||||
ztemp1=readTemp() zhum1=readHumi()
|
||||
if verbose then print("Temperature: "..ztemp1.." °C") end
|
||||
if verbose then print("Humidity: "..zhum1.." %") end
|
||||
ztemp2=readTemp() zhum2=readHumi()
|
||||
if verbose then print("Temperature: "..ztemp2.." °C") end
|
||||
if verbose then print("Humidity: "..zhum2.." %") end
|
||||
|
||||
id=nil addr=nil HUMIDITY=nil TEMPERATURE=nil r=nil
|
||||
read_HTU21D=nil readTemp=nil readHumi=nil readHTU21D=nil
|
||||
if verbose then print(node.heap()) end
|
||||
if verbose then print("End 2_htu21d:\n"..node.heap()) end
|
||||
collectgarbage()
|
||||
if verbose then print(node.heap()) end
|
||||
end
|
||||
|
||||
--readHTU21D()
|
||||
readHTU21D()
|
||||
|
||||
@@ -1,39 +1,32 @@
|
||||
-- Petit script pour faire office de crontab pour les mesures
|
||||
print("\n 0_cron.lua zf200523.1644 \n")
|
||||
print("\n 0_cron.lua zf200523.1816 \n")
|
||||
|
||||
cron1=tmr.create()
|
||||
cron1:alarm(5*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
|
||||
|
||||
f = "0_zdyndns.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
print("toto0")
|
||||
th_id=1
|
||||
print("toto1")
|
||||
f = "0_1_htu21d.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
print("toto2")
|
||||
readHTU21D()
|
||||
f = "0_2_htu21d.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
print("toto3")
|
||||
f = "0_send_data.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
print("toto4")
|
||||
send_data()
|
||||
|
||||
ztemp1=nil zhum1=nil ztemp2=nil zhum2=nil
|
||||
f = "0_zdyndns.lua" if file.exists(f) then dofile(f) end
|
||||
|
||||
print("toto5")
|
||||
th_id=2
|
||||
print("toto6")
|
||||
f = "0_2_htu21d.lua" if file.exists(f) then dofile(f) end
|
||||
print("toto7")
|
||||
readHTU21D()
|
||||
print("toto8")
|
||||
f = "0_send_data.lua" if file.exists(f) then dofile(f) end
|
||||
print("toto9")
|
||||
send_data()
|
||||
print("toto10")
|
||||
|
||||
th_id=nil ztemp1=nil zhum1=nil
|
||||
|
||||
if verbose then print(node.heap()) end
|
||||
if verbose then print("End cron:\n"..node.heap()) end
|
||||
collectgarbage()
|
||||
if verbose then print(node.heap()) end
|
||||
end)
|
||||
|
||||
--[[
|
||||
cron1:stop()
|
||||
cron1:start()
|
||||
]]
|
||||
@@ -2,7 +2,7 @@
|
||||
-- via un http GET
|
||||
|
||||
function send_data()
|
||||
if verbose then print("\n 0_send_data.lua zf200523.1643 \n") end
|
||||
if verbose then print("\n 0_send_data.lua zf200523.1816 \n") end
|
||||
|
||||
function zpost(zarg)
|
||||
if verbose then print("influxdb_url: "..influxdb_url) end
|
||||
@@ -15,18 +15,24 @@ function send_data()
|
||||
else
|
||||
if verbose then print(code, data) end
|
||||
end
|
||||
zarg=nil code=nil data=nil zpost=nil send_data=nil
|
||||
if verbose then print("End send_data:\n"..node.heap()) end
|
||||
collectgarbage()
|
||||
if verbose then print(node.heap()) end
|
||||
|
||||
-- print("tutu")
|
||||
end)
|
||||
end
|
||||
|
||||
zpost("energy,capteur=th"..th_id.." humidity="..zhum1)
|
||||
zpost("energy,capteur=th"..th_id.." temperature="..ztemp1)
|
||||
|
||||
zarg=nil code=nil data=nil zpost=nil send_data=nil
|
||||
zarg= "energy,capteur=th1 humidity="..zhum1.."\n"
|
||||
zarg=zarg.."energy,capteur=th1 temperature="..ztemp1.."\n"
|
||||
zarg=zarg.."energy,capteur=th2 humidity="..zhum2.."\n"
|
||||
zarg=zarg.."energy,capteur=th2 temperature="..ztemp2
|
||||
zpost(zarg)
|
||||
-- print("titi")
|
||||
end
|
||||
|
||||
--send_data()
|
||||
send_data()
|
||||
|
||||
--[[
|
||||
verbose=true
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-- Petit script pour s'inregistrer sur zdyndns
|
||||
|
||||
function send_zdyndns()
|
||||
if verbose then print("\n 0_zdyndns.lua zf200229.1553 \n") end
|
||||
if verbose then print("\n 0_zdyndns.lua zf200229.1816 \n") end
|
||||
|
||||
zip = wifi.sta.getip()
|
||||
zdyndns_str = "s "..node_id..","..console_host..":"..tostring(console_port).." "..zip.."\n"
|
||||
@@ -20,7 +20,7 @@ function send_zdyndns()
|
||||
sk:close()
|
||||
if verbose then print("close...") end
|
||||
zdyndns_str=nil zip=nil srv_zdyndns=nil send_zdyndns=nil
|
||||
if verbose then print(node.heap()) end
|
||||
if verbose then print("End zdyndns:\n"..node.heap()) end
|
||||
collectgarbage()
|
||||
if verbose then print(node.heap()) end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user