Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions outputs.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[Print]
filename=print
enabled=on
[Log]
filename=log
enabled=on

[Xively]
filename=xively
Expand Down
23 changes: 23 additions & 0 deletions outputs/log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import output
import datetime

class Log(output.Output):
requiredData = []
optionalData = []
def __init__(self,data):
pass
def outputData(self,dataPoints):
f = open('sensors.log', 'a')
logline = '{"time":"'
logline += str(datetime.datetime.now())
logline += '",'
for i in dataPoints:
logline += '"' + i["name"] + '"' + ":" + '"' + str(i["value"]) + '"'

logline += "}\n"

print(logline)
f.write(logline)
f.close()

return True