Post your best Lua script examples here

User avatar
By kniazio
#29200 Big, big thanks

How to configure Thingspeak to work with the Notify My Android.
Some examples?

I already did.
Here's an example Thinghttp:
URL - https://www.notifymyandroid.com/publicapi/notify
Method - POST
Content type - application/x-www-form-urlencoded
Host - notifymyandroid.com

Body - apikey=your_api_key&application=your_aplikation_name&event=your_message&description=your_mesage_description&priority=0
User avatar
By toyorg
#29737 Can someone help me? What's wrong with this code? I always got this "Got disconnection...", WiFi connection is OK.

Code: Select allapiKey = "xXx" -- Add thingspeak api key
conn=net.createConnection(net.TCP, 0)
conn:on("receive", function(conn, payload) print(payload) end)
-- api.thingspeak.com 184.106.153.149
conn:connect(80,"184.106.153.149")
conn:send("GET /update?key="..apiKey.."&field1="..tempin.."&field2="..hum.."&field3="..tempout.."")
conn:send("Host: api.thingspeak.com\r\n")
conn:send("Accept: */*\r\n")
conn:send("User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n")
conn:send("\r\n")
conn:on("sent",function(conn)
print("Closing connection")
conn:close()
end)
conn:on("disconnection", function(conn)
print("Got disconnection...")
end)