9 os.execute(string.format("rrdtool update /home/sensordata.rrd -t temp:light:movement N:%f:%d:%d", last_temp, last_light, last_movement))
14 function parse_value(str)
15 if string.find(str,"Temp C:") then
16 last_temp = tonumber(string.sub(str,8))
17 --print(string.format("t: %f Grad Celsius",last_temp))
19 if string.find(str,"Photo:") then
20 last_light = tonumber(string.sub(str,7))
21 --print(string.format("p: %d",last_light))
23 if string.find(str,"movement") then
25 --print "something moved"
33 local socket = require("socket")
34 local client = assert(socket.connect("127.0.0.1",2010))
35 --socket.unix = require("socket.unix")
36 --local socket = assert(socket.unix())
37 --local client = assert(socket:connect("/var/run/power_sensor.socket"))
44 local line, err = client:receive()
49 line, err = client:receive()
54 line, err = client:receive()