diff --git a/Mesures/humidity/bolo/0_cron.lua b/Mesures/humidity/bolo/0_cron.lua index 073c089..2b2bdda 100644 --- a/Mesures/humidity/bolo/0_cron.lua +++ b/Mesures/humidity/bolo/0_cron.lua @@ -1,6 +1,6 @@ -- Petit script pour faire office de crontab pour les --mesures -print("\n 0_cron.lua zf190917.0033 \n") +print("\n 0_cron.lua zf191217.2222 \n") f= "flash_led_xfois.lua" if file.exists(f) then dofile(f) end flash_led_xfois() diff --git a/Mesures/humidity/bolo/0_send_data.lua b/Mesures/humidity/bolo/0_send_data.lua index 38f119b..e78c622 100644 --- a/Mesures/humidity/bolo/0_send_data.lua +++ b/Mesures/humidity/bolo/0_send_data.lua @@ -1,13 +1,9 @@ -- Petit script pour envoyer les valeurs sur un serveur WEB (InfluxDB) -- via un http GET -print("\n 0_send_data.lua zf190924.1043 \n") +print("\n 0_send_data.lua zf191217.2217 \n") -function send_data() - if verbose then print("send_data: ") end - - zarg="energy,compteur=2 puissance="..zpower/1000 +function zpost(zarg) if verbose then print("zarg: "..zarg) end - http.post(influxdb_url, 'Content-Type: application/x-www-form-urlencoded\r\n', zarg, function(code, data) -- print("toto") if (code < 0) then @@ -18,10 +14,21 @@ function send_data() end -- print("tutu") end) +end + +function send_data() + if verbose then print("send_data: ") end + ztemp = readTemp() zhumd = readHumi() + if verbose then print("Temperature: "..ztemp.." °C") end + if verbose then print("Humidity: "..zhumd.." %") end + + zpost("bolo_ruru,capteur="..th_id.." humidity="..zhumd) + zpost("bolo_ruru,capteur="..th_id.." temperature="..ztemp) + -- print("titi") end --[[ -zpower=450 +verbose=true send_data() ]] diff --git a/Mesures/humidity/bolo/boot2.lua b/Mesures/humidity/bolo/boot2.lua index 15d36ec..8092121 100644 --- a/Mesures/humidity/bolo/boot2.lua +++ b/Mesures/humidity/bolo/boot2.lua @@ -1,6 +1,6 @@ -- Scripts à charger après le boot pour démarrer son projet -print("\n boot2.lua zf191124.2124 \n") +print("\n boot2.lua zf191217.2224 \n") function boot2() second_chance=nil initz=nil boot=nil @@ -27,13 +27,15 @@ function boot2() f= "secrets_project.lua" if file.exists(f) then dofile(f) end f= "set_time.lua" if file.exists(f) then dofile(f) end collectgarbage() --- f= "0_htu21d.lua" if file.exists(f) then dofile(f) end --- f= "0_send_data.lua" if file.exists(f) then dofile(f) end --- f= "0_cron.lua" if file.exists(f) then dofile(f) end + f= "0_htu21d.lua" if file.exists(f) then dofile(f) end + f= "0_send_data.lua" if file.exists(f) then dofile(f) end + f= "0_cron.lua" if file.exists(f) then dofile(f) end f= "web_srv2.lua" if file.exists(f) then dofile(f) end f=nil + verbose = true + tmr.create():alarm(3*1000, tmr.ALARM_SINGLE, function() print("BOOOOUM, y'a plus de boot2 !") wifi_info=nil boot2=nil