Ajouté une WEB API pour le SonOff qui permet d'allumer la LED ou le RELAIS ;-)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Quelques commandes remote (luatool) à envoyer avec le plugin Atom-IDE-terminal de l'éditeur Atom
|
||||
# zf200101.1304
|
||||
# zf200101.1823
|
||||
|
||||
Todo à faire pour ce projet !
|
||||
|
||||
@@ -18,11 +18,6 @@ v- ajouter le web_srv2 dans boot au lieu de boot2
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# si luatool ne marche pas sur le MAC, il faut lire ceci:
|
||||
# https://docs.google.com/document/d/1q64uK3IMOgEDdKaIAttbYuFt4GuLQ06k3FLeyfCsWLg/edit#heading=h.bmefcu67uwj0
|
||||
|
||||
@@ -32,36 +27,11 @@ v- ajouter le web_srv2 dans boot au lieu de boot2
|
||||
# ALT+CMD+F bascule entre le terminal et l'éditeur
|
||||
|
||||
# définitions à faire AVANT !
|
||||
cd /Users/zuzu/Desktop/NodeMCU/NodeMCU_Lua/WIFI_sniffer/cret_project
|
||||
export luatool_tty="/dev/cu.wchusbserial1410"
|
||||
export zIP="192.168.0.113"
|
||||
|
||||
#th0 dev mobile
|
||||
192.168.0.118
|
||||
#th1
|
||||
192.168.0.143 192.168.8.102
|
||||
#th2
|
||||
192.168.0.132 192.168.8.105
|
||||
#th3
|
||||
192.168.0.145 192.168.8.104
|
||||
#th4
|
||||
192.168.0.117 192.168.8.103
|
||||
#th5 chambre à coucher
|
||||
192.168.0.178
|
||||
#th6 buanderie
|
||||
192.168.0.162
|
||||
#th7 cave
|
||||
192.168.0.199
|
||||
#th8 salon
|
||||
192.168.0.124
|
||||
|
||||
|
||||
|
||||
export zIP="192.168.0.156"
|
||||
export zport="23"
|
||||
|
||||
cd '/Users/zuzu/Google Drive/FamilleZ Share/FamilleZ/Papa/LUA/NodeMCU ESP8266/NodeMCU_Lua/Mesures/humidity/bolo
|
||||
'
|
||||
export zIP="localhost"
|
||||
export zport="2323"
|
||||
ATTENTION: voir les tunnels tout à la fin !
|
||||
@@ -77,7 +47,13 @@ for k,v in pairs(_G) do print(k,v) end
|
||||
|
||||
|
||||
# commandes lua pour ce projet
|
||||
export zIP="192.168.0.162"
|
||||
export zIP="192.168.0.156"
|
||||
export zport="23"
|
||||
./luatool.py --ip $zIP:$zport -f z_index.html
|
||||
./luatool.py --ip $zIP:$zport -f api_sonoff.html
|
||||
http://192.168.0.156
|
||||
|
||||
|
||||
telnet -rN $zIP $zport
|
||||
verbose=false
|
||||
dofile("dir.lua")
|
||||
|
||||
40
SonOff/SonOff_2/api_sonoff.html
Normal file
40
SonOff/SonOff_2/api_sonoff.html
Normal file
@@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr" dir="ltr">
|
||||
|
||||
<head>
|
||||
<meta charset='utf-8' name='viewport' content='width=device-width, initial-scale=1.0'>
|
||||
<title>API SonOff</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>API SonOff 200101.1843</h1>
|
||||
<br>
|
||||
|
||||
<%
|
||||
if (vars ~= nil) then
|
||||
zout("<br>vars: "..vars.."<br>")
|
||||
for k, v in string.gmatch(vars, "(%w+)=(%w+%p+%w+)&*") do
|
||||
_GET[k] = v
|
||||
zout(k..": "..v.."<br>")
|
||||
end
|
||||
end
|
||||
if (_GET.LED == "on") then
|
||||
zLED=7 -- SonOff
|
||||
gpio.write(zLED, gpio.LOW) gpio.mode(zLED, gpio.OUTPUT)
|
||||
end
|
||||
if (_GET.LED == "off") then
|
||||
zLED=7 -- SonOff
|
||||
gpio.write(zLED, gpio.HIGH) gpio.mode(zLED, gpio.OUTPUT)
|
||||
end
|
||||
if (_GET.RELAY == "on") then
|
||||
zRELAY=6
|
||||
gpio.mode(zRELAY, gpio.OUTPUT) gpio.write(zRELAY, gpio.HIGH)
|
||||
end
|
||||
if (_GET.RELAY == "off") then
|
||||
zRELAY=6
|
||||
gpio.mode(zRELAY, gpio.OUTPUT) gpio.write(zRELAY, gpio.LOW)
|
||||
end
|
||||
%>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,29 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr" dir="ltr">
|
||||
|
||||
<head>
|
||||
<meta charset='utf-8' name='viewport' content='width=device-width, initial-scale=1.0'>
|
||||
<title>ESP8266 home page</title>
|
||||
<title>SonOff home page</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>ESP8266 home page 191222.2346</h1>
|
||||
<h1>SonOff home page 200101.1845</h1>
|
||||
<h2>Menu:</h2>
|
||||
<h3>
|
||||
<a href="wifi_clear.html?field1=11&field2=12&field3=13">Wifi clear, effacement configuration WIFI.</a><br>
|
||||
<a href="disp_temp.html">Affichage des températures, affiche les températures mesurées.</a><br>
|
||||
<a href="api_sonoff.html?LED=on">SonOff API LED On</a><br>
|
||||
<a href="api_sonoff.html?LED=off">SonOff API LED OFF</a><br>
|
||||
<a href="api_sonoff.html?RELAY=on">SonOff API RELAY On</a><br>
|
||||
<a href="api_sonoff.html?RELAY=off">SonOff API RELAY OFF</a><br>
|
||||
<br>
|
||||
<a href="wifi_clear.html?field1=11&field2=12&field3=13">Wifi clear, effacement configuration WIFI</a><br>
|
||||
<a href="disp_temp.html">Affichage des températures, affiche les températures mesurées</a><br>
|
||||
</h3>
|
||||
|
||||
|
||||
<%
|
||||
a,b,c = wifi.sta.getip()
|
||||
zout("IP: "..a.." MASK: "..b.." GATEWAY: "..c.."<br>")
|
||||
|
||||
%>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user