Ajouté des photos pour le projet energy et filtré les mesures fausses sur le compteur électrique (rebonds de la LED)

This commit is contained in:
Christian Zufferey
2019-08-08 08:41:12 +02:00
parent 8916e021f4
commit ded56555f4
7 changed files with 29 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
-- Lit le capteur LDR pour mesurer la consommation électrique du compteur de la maison
print("\n 0_get_energy.lua zf190805.1038 \n")
print("\n 0_get_energy.lua zf190807.0923 \n")
-- lecture: https://thingspeak.com/channels/802784/private_show
@@ -21,12 +21,14 @@ function get_energy()
gpio.write(zledbleue, gpio.LOW)
zt2_energy = tmr.now()
zt_energy = (zt2_energy-zt1_energy)/1000000
print("Durée ".. zt_energy)
zpuissance = math.floor(3600/zt_energy)/1000
print("Puissance ".. zpuissance.."kW")
if zt_energy >= 0.3 and zt_energy <= 100 then
print("Durée ".. zt_energy)
zpuissance = math.floor(3600/zt_energy)/1000
print("Puissance ".. zpuissance.."kW")
send_temp()
end
end
print("btn_led: "..zled_state)
-- disp_send()
end
gpio.trig(ldr_pin, "both", get_energy)
@@ -37,4 +39,3 @@ get_energy()
]]

View File

@@ -1,11 +1,18 @@
-- 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")
-- Petit script pour envoyer les valeurs de température sur un serveur WEB via un http GET
print("\n 0_send_temp.lua zf190806.1541 \n")
function send_temp()
print("send_web_temp: ")
print(zurl)
http.get(zurl, nil, function(code, data)
zurl="http://www.xxx.ml:8086/write?db=xxx&u=admin&p=xxx"
print("zurl: "..zurl)
zarg="energy,compteur=1 puissance="..zpuissance
print("zarg: "..zarg)
http.post(zurl, 'Content-Type: application/x-www-form-urlencoded\r\n', zarg, function(code, data)
-- print("toto")
if (code < 0) then
print("HTTP request failed")
@@ -14,7 +21,7 @@ function send_temp()
print(code, data)
end
-- print("tutu")
end)
end)
-- print("titi")
end

View File

@@ -116,3 +116,13 @@ https://thingspeak.com/apps/plugins/300559
zf190803.1917
pense bête:
```
file.open("hello.lua","w+")
file.writeline([[print("hello nodemcu")]])
file.writeline([[print(node.heap())]])
file.close()
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB