Skip to content

mysmartgrid/flukso4r

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flukso4r

This is the Flukso4R library, available from

gonium.net/md/flukso4r

You can use it to query the Flukso webservice. Have a look at the bin/flukso_query script. It allows you to query the Flukso API and retrieve the latest readings from your Flukso meter. A simple call to retrieve the readings of the last day is:

$ flukso_query -t day -u watt -c <CONFIG_FILE>

In addition, the library includes scripts that can be used to archive your Flukso readings at the highest resolution. The values are stored in an sqlite3 database.

Installation

Please install SQLite3 first, as the gem uses an embedded database for storing the readings. For most cases installation can be done using gems:

$ gem install flukso4r

After installation you need to copy the flukso4rrc template file to a destination of your liking:

$ cp <GEM_LOCATION>/etc/flukso4rrc $HOME/.flukso4rrc

Then, edit the file and specify the database file and your API key. Please note that the library uses the value in BASE_URL for communicating with the webservice. Please use HTTPS so that your API key is not sent unencrypted over the net.

Then, create an empty database:

$ flukso_create_db -c <CONFIG_FILE>

After the DB has been created, you can add new data with the command

$ flukso_archive_watts -c <CONFIG_FILE>

This command will download all values of the last hour and add the new ones to the database. It is intended to be run as a cronjob. You can then export the data with

$ flukso_export_db -c <CONFIG_FILE>

All commands support additional options which are displayed with the parameter “-h”. For verbose output, use “-v” in addition to your other commandline switches.

The code in lib is a cheap knockoff of the twitter ruby gem - many thanks to John Nunemaker! You can find the twitter ruby gem here:

twitter.rubyforge.org/

TODO

  • Tests of the internals are needed.

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2010 Mathias Dalheimer (md.AT.gonium.net). See LICENSE for details.