diff --git a/Temp_DS18B20/temp_zf/0_send_web_temp.lua b/Temp_DS18B20/temp_zf/0_send_web_temp.lua new file mode 100644 index 0000000..aa2e1b7 --- /dev/null +++ b/Temp_DS18B20/temp_zf/0_send_web_temp.lua @@ -0,0 +1,35 @@ +-- 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/README.md b/Temp_DS18B20/temp_zf/README.md index 2166cd9..aaf1199 100644 --- a/Temp_DS18B20/temp_zf/README.md +++ b/Temp_DS18B20/temp_zf/README.md @@ -36,4 +36,4 @@ node ow pcm rtctime sntp spi tmr uart wifi ws2812 https://thingspeak.com/channels/817940 -zf190709.2135 +zf190726.1917 diff --git a/Temp_DS18B20/temp_zf/a3.lua b/Temp_DS18B20/temp_zf/a3.lua deleted file mode 100644 index 188dfa6..0000000 --- a/Temp_DS18B20/temp_zf/a3.lua +++ /dev/null @@ -1,43 +0,0 @@ --- programme pour faire un test depuis de le webide - -function a3() - print("\n a3.lua zf190617.1135 \n") - -end - -a3() - - - - --- Petit script pour envoyer quelque chose sur un serveur WEB -print("\n web_cli.lua zf190616.1519 \n") - -function disp_send() - print("web_cli: ") --- ztemp1=11 ztemp2=12 ztemp3=13 - - zurl=thingspeak_url_update.."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() - - ---[[ -disp_send() - - - -]] diff --git a/Temp_DS18B20/temp_zf/boot.lua b/Temp_DS18B20/temp_zf/boot.lua index 7d5eea0..6e0bc79 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 zf190709.2150 \n") +print("\n boot.lua zf190726.1913 \n") function heartbeat() f= "flash_led_xfois.lua" if file.exists(f) then dofile(f) end @@ -13,6 +13,11 @@ function heartbeat() end) end +--ses propres secrets +f= "secrets_temp_zf_int_1er.lua" if file.exists(f) then dofile(f) end +f= "secrets_temp_zf_out_nord.lua" if file.exists(f) then dofile(f) end +f= "secrets_temp_zf_out_sud.lua" if file.exists(f) then dofile(f) end + --f= "led_rgb.lua" if file.exists(f) then dofile(f) end --f= "wifi_ap_start.lua" if file.exists(f) then dofile(f) end f= "wifi_ap_stop.lua" if file.exists(f) then dofile(f) end diff --git a/Temp_DS18B20/temp_zf/initz.lua b/Temp_DS18B20/temp_zf/initz.lua index 4b1b29f..ab33e85 100644 --- a/Temp_DS18B20/temp_zf/initz.lua +++ b/Temp_DS18B20/temp_zf/initz.lua @@ -3,7 +3,7 @@ -- le script repair.lua pendant xx secondes avant de continuer --Source: https://nodemcu.readthedocs.io/en/master/en/modules/node/#nodebootreason -print("\n init.lua zf190601.1612 \n") +print("\n init.lua zf190621.1612 \n") zswitch=3 --switch flash gpio.mode(zswitch, gpio.INT, gpio.PULLUP) diff --git a/Temp_DS18B20/temp_zf/wifi_cli_conf.lua b/Temp_DS18B20/temp_zf/wifi_cli_conf.lua index 07d6293..559916b 100644 --- a/Temp_DS18B20/temp_zf/wifi_cli_conf.lua +++ b/Temp_DS18B20/temp_zf/wifi_cli_conf.lua @@ -1,22 +1,11 @@ -- Petit script pour configurer le client WIFI du NodeMCU function wifi_cli_conf() - print("\n wifi_cli_conf.lua zf190709.2147 \n") - - --secrets par défaut - --cli_ssid="3g-s7" - cli_ssid="3G-zf" - cli_pwd="12234567" - - --ses propres secrets - f= "secrets_temp_zf_int_1er.lua" if file.exists(f) then dofile(f) end - f= "secrets_temp_zf_out_nord.lua" if file.exists(f) then dofile(f) end - f= "secrets_temp_zf_out_sud.lua" if file.exists(f) then dofile(f) end + print("\n wifi_cli_conf.lua zf190726.1912 \n") + -- les secrets sont maintenant initialisés par boot.lua ! wifi.sta.config{ssid=cli_ssid, pwd=cli_pwd, save=true} end wifi_cli_conf() wifi_cli_conf=nil -cli_ssid=nil -cli_pwd=nil diff --git a/Temp_DS18B20/temp_zf/z_index.html b/Temp_DS18B20/temp_zf/z_index.html index 88e772a..fbc8521 100644 --- a/Temp_DS18B20/temp_zf/z_index.html +++ b/Temp_DS18B20/temp_zf/z_index.html @@ -7,13 +7,13 @@ -

ESP8266 home page 190709.2214

+

ESP8266 home page 190726.1953

Différentes pages HTML:

Page 1, affichage de la température dynamique en code Lua inline.
Page 2, tableau dynamique écrit en Lua inline.
Page 3, affichage du capteur non linéaire corrigé.
- Page 4, web service concentrateur de mesures de température.
+ Page 4, web service concentrateur de mesures de température.
Page qui n'existe pas !

diff --git a/Temp_DS18B20/temp_zf/z_page4.html b/Temp_DS18B20/temp_zf/z_page4.html index a024d83..49f7086 100644 --- a/Temp_DS18B20/temp_zf/z_page4.html +++ b/Temp_DS18B20/temp_zf/z_page4.html @@ -7,7 +7,7 @@ -

ESP8266 page 4 190709.2221

+

ESP8266 page 4 190726.1955


Web service concentrateur de mesures de température !
Retour à la home page...


@@ -24,17 +24,26 @@ Les arguments du web service (GET) sont:

<% if (vars ~= nil) then + zout("
vars: "..vars.."
") for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do _GET[k] = v zout(k..": "..v.."
") + if k == "field1" then + ztemp1_conc = v + elseif k == "field2" then + ztemp2_conc = v + elseif k == "field3" then + ztemp3_conc = v + end end end + zout("
Les températures récupérées sont: "..ztemp1_conc..", "..ztemp2_conc..", "..ztemp3_conc) %> -
Yeah... cela fonctionne vachement bien !

+

Yeah... cela fonctionne vachement bien !

<% zout("Il reste: "..node.heap().." de RAM !

\n")