Skip to content

udaygin/mqtt2csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WARNING !!! Working code but still under cleanup to generalize. use at your own risk till this notice is removed :) 

Description : 
This a simple nodejs script that can take json sent to a mqtt topic and persist it into a csv file. and this automatically runs as a headless service on system start. It is not really complicated enough to deserve a github project but I found it cumbersome to get all the pieces working as a ubuntu linux service so felt that some one else who might be trying to do the same might benefit from it. 

Here is my setup 
esp8266 -> mqtt server on pi -> this script as service on ubuntu linux -> csv file into any visualization tool 


To start the application with out installing it
node main.js > stdout.txt 2> stderr.txt &

To install the application as a service in ubuntu 
copy mqtt2csv.service to /etc/systemd/system
systemctl start mqtt2csv # to ensure that it starts fine and fix any issues 
systemctl enable mqtt2csv.service

To test 
Run tail -f file.csv to start monitoring the csv file 
Send some events to mqtt server topic to see the output displayed in terminal by tail command (also saved to csv file )

Tag Cloud:
IoT , mqtt, json , parse , csv , flat file.

About

Simple nodejs script that saves json data that received by a mqtt server into a csv file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published