emoncms/raspberrypi — pull request #11 by Jerome-github (2013-03-18 12:57:25+00:00)
Title: RFM2Pi Gateway port to emonCMS dev branch

Hi.

I reworked the gataway to make it compliant with the new emonCMS dev branch.

The new API (thanks for that !) allowed me to get access to the parameters in a more elegant fashion and I got rid of the rfm2pigateway_interface.php stub.

Note that I had to extend that API to allow a write access to the "running" attribute :

API modifications :
- running becomes getrunning
- creation of setrunning

The other modifications are mentionned in the commit messages :
- [bugfix] Make path to generated files (logfile, PID file) relative to the script, so that it can be called from any directory
- Respect 'remoteprotocol' parameter.
- I modified the RFM2PiGateway class so that logging is optional and no PID is written (this is done in the calling script). The idea is to make the classe reusable : design the whole thing so that anyone can import the file as a python module in his own script and use it according to his needs.
- I also added command line arguments to the scripts :
- --show-settings is a debug options that just displays the settings read in database
- --no-log options means "don't write to a file, show me the logs on STDERR", this is useful, at least for the first runs

If there's anything you'd like me to rework, please let me know.

I'm not aware or the release cycle you want for emonCMS, and where the dev branch is expected to go, but since this is new development, it makes sense to integrate the python gateway only in dev branch. I've been using it for a while now, and I believe it is functionnal, but I probably did not test all the use cases. We may find bugs in corner cases and we'll be happy not to have to correct them in both dev and master branch.

Feel free to close the pull request I opened for the integration in master branch (https://github.com/emoncms/raspberrypi/pull/10).