Hello, Can you share your gateway.js file? When I added the 2 lines of code
var fs = require('fs'); // reqire fileSystem node module
fs.writeFile("/home/pi/gateway/LOG_FILE", data );
to the end of the section of the gateway.js file
var entry = {_id:id, updated:existingNode.updated, type:existingNode.type||undefined, label:existingNode.label||undefined, descr:existingNode.descr||undefined, hidden:existingNode.hidden||undefined, rssi:existingNode.rssi, metrics:Object.keys(existingNode.metrics).length > 0 ? existingNode.metrics : {}, events: existingNode.events, settings: existingNode.settings};
I get the following errors in the gateway.sys.log
fs.js:133
throw new ERR_INVALID_CALLBACK();
^
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at maybeCallback (fs.js:133:9)
at Object.writeFile (fs.js:1179:14)
at /home/pi/gateway/gateway.js:731:6
at newArguments.(anonymous function) (/home/pi/gateway/node_modules/nedb/lib/executor.js:29:17)
at Cursor.execFn (/home/pi/gateway/node_modules/nedb/lib/datastore.js:484:12)
at callback (/home/pi/gateway/node_modules/nedb/lib/cursor.js:126:19)
at /home/pi/gateway/node_modules/nedb/lib/cursor.js:193:12
at /home/pi/gateway/node_modules/nedb/lib/datastore.js:329:14
at Object.async.eachSeries (/home/pi/gateway/node_modules/nedb/node_modules/async/lib/async.js:130:20)
at /home/pi/gateway/node_modules/nedb/lib/datastore.js:323:11
It also breaks my pigateway's functionality (until I remove those lines of code).
My code looks like this:
var entry = {
_id:id,
updated:existingNode.updated,
type:existingNode.type||undefined,
label:existingNode.label||undefined,
descr:existingNode.descr||undefined,
hidden:existingNode.hidden||undefined,
rssi:existingNode.rssi,
metrics:Object.keys(existingNode.metrics).length > 0 ? existingNode.metrics : {},
events:existingNode.events,
settings:existingNode.settings,
multiGraphs:existingNode.multiGraphs,
icon:existingNode.icon||undefined
};
var fs = require('fs'); // reqire fileSystem node module
fs.writeFile("/home/pi/gateway/LOG_FILE", data );
I assume that the LOG_FILE file must be created prior to use. What type of file should the LOG_FILE be? What file extension should it have?
Thanks much for your work on this.