ESP8266 $3, Converter $1, PIR $2 Breadboard $1, 5v PS $3
(some items bought in bulk (x4), haven't figured in an enclosure yet.)
It talks to Indigo via the Cynical Network plugin.
When I figure out the DHT-11 Temp/humidity sensors I have, I am going to stick one on the board. After I've tested the bugger for bit, Im going to make a bunch.
I'm using the nodeMCU variation of the firmware which utilized the LUA language. (which I am now learning)
This is the code for the ESP8266
- Code: Select all
-- Send Alarm status to HomeServer
-- some code taken from ok1cdj
-- 2015 AReResearch (Andy Reischle)
SensorID = "1"
status = "CLEAR"
oldstatus = "CLEAR"
gpio.mode(3,gpio.INPUT,gpio.FLOAT)
tmr.alarm(0, 1000, 1, function() -- Set alarm to one second
if gpio.read(3)==0 then status="ALARM" else status="CLEAR" end
if status ~= oldstatus then sendalarm (SensorID,status) end
oldstatus = status
end)
function sendalarm(SensorID,status)
print("Open connection...")
conn=net.createConnection(net.TCP, 0)
conn:on("receive", function(sck, c) print(c) end )
conn:connect(40001, "192.168.1.10")
conn:send(status)
conn:on("sent", function(conn) print "Closing connection" conn:close() end)
end