diff --git a/Temp_DS18B20/temp_zf/0_get_temp.lua b/Temp_DS18B20/temp_zf/0_get_temp.lua
new file mode 100644
index 0000000..b9812e7
--- /dev/null
+++ b/Temp_DS18B20/temp_zf/0_get_temp.lua
@@ -0,0 +1,32 @@
+-- Lit le capteur de température solaire en fonction de son field qui se trouve dans les secrets !
+print("\n 0_get_temp.lua zf190617.1252 \n")
+
+-- lecture: https://thingspeak.com/channels/802784/private_show
+-- source: https://nodemcu.readthedocs.io/en/master/modules/ds18b20/
+
+local ow_pin = 3
+ds18b20.setup(ow_pin)
+
+function get_temp()
+ ds18b20.read(
+ function(ind,rom,res,temp,tdec,par)
+ print(ind, temp, zfield)
+ if zfield == 1 then
+ ztemp1 = temp
+ elseif zfield == 2 then
+ ztemp2 = temp
+ elseif zfield == 3 then
+ ztemp3 = temp
+ zurl=hub_url.."field3="..tostring(ztemp3)
+ send_temp()
+ end
+ print(ztemp1, ztemp2, ztemp3)
+ end,{})
+end
+
+--[[
+
+get_temp()
+
+]]
+
diff --git a/Temp_DS18B20/temp_zf/0_send_temp.lua b/Temp_DS18B20/temp_zf/0_send_temp.lua
new file mode 100644
index 0000000..3b38c03
--- /dev/null
+++ b/Temp_DS18B20/temp_zf/0_send_temp.lua
@@ -0,0 +1,25 @@
+-- Petit script pour envoyer les valeurs de température sur un serveur WEB via un HTTP GET
+print("\n 0_send_temp.lua zf190727.1331 \n")
+
+function send_temp()
+ print("send_web_temp: ")
+ print(zurl)
+
+ http.get(zurl, nil, function(code, data)
+-- print("toto")
+ if (code < 0) then
+ print("HTTP request failed")
+ print("zuzu", code, data)
+ else
+ print(code, data)
+ end
+-- print("tutu")
+ end)
+-- print("titi")
+end
+
+--[[
+
+send_temp()
+
+]]
diff --git a/Temp_DS18B20/temp_zf/0_send_web_temp.lua b/Temp_DS18B20/temp_zf/0_send_web_temp.lua
deleted file mode 100644
index aa2e1b7..0000000
--- a/Temp_DS18B20/temp_zf/0_send_web_temp.lua
+++ /dev/null
@@ -1,35 +0,0 @@
--- Petit script pour envoyer les valeurs de température sur un serveur WEB via un HTTP GET
-print("\n send_web_temp.lua zf190726.1931 \n")
-
-function send_temp(zserver)
- print("send_web_temp: ")
-
- ztemp1=11 ztemp2=12 ztemp3=13
-
- zurl=zserver.."field1="..tostring(ztemp1).."&field2="..tostring(ztemp2).."&field3="..tostring(ztemp3)
- print(zurl)
-
---[[
-http.get(zurl, nil, function(code, data)
- print("toto")
- if (code < 0) then
- print("tutu")
- print("HTTP request failed")
- print("zuzu", code, data)
- else
- print("titi")
- print(code, data)
- end
- end)
-]]
-
-end
-
---disp_send()
-
-
---[[
-
-send_temp(concentrator_url)
-
-]]
diff --git a/Temp_DS18B20/temp_zf/a2.lua b/Temp_DS18B20/temp_zf/a2.lua
deleted file mode 100644
index 29bd5b0..0000000
--- a/Temp_DS18B20/temp_zf/a2.lua
+++ /dev/null
@@ -1,43 +0,0 @@
--- programme pour faire un test depuis de le webide
-
-function a2()
- print("\n a2.lua zf190617.1128 \n")
-
-end
-
-a2()
-
--- Lit les capteurs de température solaire et envoie les mesures sur ThingSpeak
--- zf190617.1134
-
--- lecture: https://thingspeak.com/channels/802784/private_show
-
--- source: https://nodemcu.readthedocs.io/en/master/modules/ds18b20/
-
-
-local ow_pin = 3
-ds18b20.setup(ow_pin)
-
-print("toto182538")
-
- ztemp1=0 ztemp2=0 ztemp3=0
-
--- read all sensors and print all measurement results
-ds18b20.read(
- function(ind,rom,res,temp,tdec,par)
--- print(ind,string.format("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",string.match(rom,"(%d+):(%d+):(%d+):(%d+):(%d+):(%d+):(%d+):(%d+)")),res,temp,tdec,par)
- print(ind,temp)
- if ind == 1 then
- ztemp1 = temp
--- elseif ind == 2 then
--- ztemp2 = temp
--- elseif ind == 3 then
--- ztemp3 = temp
- --C'est la fin de lecture, on envoie les mesures à ThingSpeak
- print(ztemp1,ztemp2,ztemp3)
- disp_send()
- end
- end,{})
-
-print("tutu152603")
-
diff --git a/Temp_DS18B20/temp_zf/api_hub_temp.html b/Temp_DS18B20/temp_zf/api_hub_temp.html
index 2d9bdee..cb7c57e 100644
--- a/Temp_DS18B20/temp_zf/api_hub_temp.html
+++ b/Temp_DS18B20/temp_zf/api_hub_temp.html
@@ -7,12 +7,18 @@
- API HUB Temp 190727.0948
+ API HUB Temp 190727.1321
<%
- --ztemp1 = 0 ztemp2 = 0 ztemp3 = 0
-
+ if (vars ~= nil) then
+ zout("
vars: "..vars.."
")
+ for k, v in string.gmatch(vars, "(%w+)=(%w+%p+%w+)&*") do
+ _GET[k] = v
+ zout(k..": "..v.."
")
+ end
+ end
+
if (_GET.field1 ~= nil) then
ztemp1 = _GET.field1
zout("
temp1: "..ztemp1.."°C")
diff --git a/Temp_DS18B20/temp_zf/boot.lua b/Temp_DS18B20/temp_zf/boot.lua
index 1e3a0a1..949ff95 100644
--- a/Temp_DS18B20/temp_zf/boot.lua
+++ b/Temp_DS18B20/temp_zf/boot.lua
@@ -1,6 +1,6 @@
-- Scripts à charger après le boot pour démarrer son appli
-print("\n boot.lua zf190727.0902 \n")
+print("\n boot.lua zf190727.1329 \n")
function heartbeat()
f= "flash_led_xfois.lua" if file.exists(f) then dofile(f) end
@@ -26,12 +26,8 @@ f= "telnet_srv2.lua" if file.exists(f) then dofile(f) end
f= "web_ide2.lua" if file.exists(f) then dofile(f) end
f= "web_srv2.lua" if file.exists(f) then dofile(f) end
---f= "a3.lua" if file.exists(f) then dofile(f) end
---f= "a4.lua" if file.exists(f) then dofile(f) end
-
---f= "set_time.lua" if file.exists(f) then dofile(f) end
---f= "dsleep.lua" if file.exists(f) then dofile(f) end
---f= "a_no_linear.lua" if file.exists(f) then dofile(f) end
+f= "0_get_temp.lua" if file.exists(f) then dofile(f) end
+f= "0_send_temp.lua" if file.exists(f) then dofile(f) end
f=nil
--heartbeat=nil
diff --git a/Temp_DS18B20/temp_zf/a6.lua b/Temp_DS18B20/temp_zf/goodies/a6.lua
similarity index 100%
rename from Temp_DS18B20/temp_zf/a6.lua
rename to Temp_DS18B20/temp_zf/goodies/a6.lua
diff --git a/Temp_DS18B20/temp_zf/a7.lua b/Temp_DS18B20/temp_zf/goodies/a7.lua
similarity index 100%
rename from Temp_DS18B20/temp_zf/a7.lua
rename to Temp_DS18B20/temp_zf/goodies/a7.lua
diff --git a/Temp_DS18B20/temp_zf/a8.lua b/Temp_DS18B20/temp_zf/goodies/a8.lua
similarity index 100%
rename from Temp_DS18B20/temp_zf/a8.lua
rename to Temp_DS18B20/temp_zf/goodies/a8.lua
diff --git a/Temp_DS18B20/temp_zf/a9.lua b/Temp_DS18B20/temp_zf/goodies/a9.lua
similarity index 100%
rename from Temp_DS18B20/temp_zf/a9.lua
rename to Temp_DS18B20/temp_zf/goodies/a9.lua
diff --git a/Temp_DS18B20/temp_zf/wifi_info.lua b/Temp_DS18B20/temp_zf/wifi_info.lua
index 5062fcf..1bc5c41 100644
--- a/Temp_DS18B20/temp_zf/wifi_info.lua
+++ b/Temp_DS18B20/temp_zf/wifi_info.lua
@@ -1,5 +1,5 @@
-- Petit script pour afficher les infos actuel du WIFI
-print("\n wifi_info.lua zf181119.0014 \n")
+print("\n wifi_info.lua zf190727.1220 \n")
local zmodewifi=wifi.getmode()
@@ -10,10 +10,11 @@ if zmodewifi == wifi.NULLMODE then
elseif zmodewifi == wifi.STATION then
print("WIFI mode CLI")
print("Connected IP:\n",wifi.sta.getip())
- do
- local sta_config=wifi.sta.getconfig(true)
- print(string.format("Current client config:\n\tssid:\"%s\"\tpassword:\"%s\"\n\tbssid:\"%s\"\tbssid_set:%s", sta_config.ssid, sta_config.pwd, sta_config.bssid, (sta_config.bssid_set and "true" or "false")))
- end
+ local sta_config=wifi.sta.getconfig(true)
+ print("Current client config:")
+ print("\tssid:", sta_config.ssid)
+ print("\tpassword:", sta_config.pwd)
+ print("\tbssid:", sta_config.bssid)
elseif zmodewifi == wifi.SOFTAP then
print("WIFI mode AP")
print("AP MAC:\n",wifi.ap.getmac())
@@ -22,10 +23,11 @@ elseif zmodewifi == wifi.SOFTAP then
elseif zmodewifi == wifi.STATIONAP then
print("WIFI mode CLI+AP")
print("Connected IP:\n",wifi.sta.getip())
- do
- local sta_config=wifi.sta.getconfig(true)
- print(string.format("Current client config:\n\tssid:\"%s\"\tpassword:\"%s\"\n\tbssid:\"%s\"\tbssid_set:%s", sta_config.ssid, sta_config.pwd, sta_config.bssid, (sta_config.bssid_set and "true" or "false")))
- end
- print("AP MAC: "..wifi.ap.getmac())
- print("AP IP: "..wifi.ap.getip())
+ local sta_config=wifi.sta.getconfig(true)
+ print("Current client config:")
+ print("\tssid:", sta_config.ssid)
+ print("\tpassword:", sta_config.pwd)
+ print("\tbssid:", sta_config.bssid)
+ print("AP MAC: ", wifi.ap.getmac())
+ print("AP IP: ", wifi.ap.getip())
end