node.js and mqtt to parse log file
Posted: Sun Feb 16, 2014 11:06 pm
Hi,
After the blog domoticaforum.eu/viewtopic.php?f=23& ... amp;t=9446 post of Pieter, I like how node.js and mqtt works, the realtime data.
I'm using fhem for my software, and all the hardware logs everything in files. So for my outdoor oregon sensor gives this output
tail -f /var/log/fhem/buiten-2014.log
2014-02-16_21:54:45 Buitentemp temperature: 5.8
2014-02-16_21:54:45 Buitentemp humidity: 31
2014-02-16_21:54:45 Buitentemp battery: ok
2014-02-16_21:54:45 Buitentemp T: 5.8 H: 31 BAT: ok
2014-02-16_21:55:26 Buitentemp temperature: 5.8
2014-02-16_21:55:26 Buitentemp humidity: 31
2014-02-16_21:55:26 Buitentemp battery: ok
2014-02-16_21:55:26 Buitentemp T: 5.8 H: 31 BAT: ok
Now I thought that it should be possible to create a node.js file that check this log and publish the change values to the mqtt broker and than create a server.js and and an html file to publish it.
I don't know how to start, because te smart meter example of Pieter reads serial and here i want to read output of a file.
Any help would be fine
regards Richard
After the blog domoticaforum.eu/viewtopic.php?f=23& ... amp;t=9446 post of Pieter, I like how node.js and mqtt works, the realtime data.
I'm using fhem for my software, and all the hardware logs everything in files. So for my outdoor oregon sensor gives this output
tail -f /var/log/fhem/buiten-2014.log
2014-02-16_21:54:45 Buitentemp temperature: 5.8
2014-02-16_21:54:45 Buitentemp humidity: 31
2014-02-16_21:54:45 Buitentemp battery: ok
2014-02-16_21:54:45 Buitentemp T: 5.8 H: 31 BAT: ok
2014-02-16_21:55:26 Buitentemp temperature: 5.8
2014-02-16_21:55:26 Buitentemp humidity: 31
2014-02-16_21:55:26 Buitentemp battery: ok
2014-02-16_21:55:26 Buitentemp T: 5.8 H: 31 BAT: ok
Now I thought that it should be possible to create a node.js file that check this log and publish the change values to the mqtt broker and than create a server.js and and an html file to publish it.
I don't know how to start, because te smart meter example of Pieter reads serial and here i want to read output of a file.
Any help would be fine
regards Richard