Project

egauge

0.0
No commit activity in last 3 years
No release in over 3 years
Allows accepting and parsing eGauge Energy monitor xml data as native Ruby objects.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.6

Runtime

 Project Readme

GEM: egauge¶ ↑

Written by Rob Morris @ Irongaze Consulting LLC (irongaze.com)

Funding for development provided by Sustainable Industrial Solutions LLC (sustainableis.com)

DESCRIPTION¶ ↑

A set of classes to enable parsing and using data from eGauge meters as native Ruby objects.

SYNOPSIS¶ ↑

This gem facilitates interpreting incoming monitoring data and converting it into Ruby objects for easier manipulation. It handles parsing the xml data posted by eGauge devices, converting them into Ruby objects that can be manipulated more easily.

To use:

# Require the library (not needed if using Rails/bundler)
>> require 'egauge'

# Parse a posted xml chunk to extract the contained data, passing in
# the data posted to your server from the eGauge device
>> data = EGauge::Data.parse(request.body.read)

# What's the configuration serial number?
>> data.serial
=> '0x37cdd096'

# How many registers do we have data coming in from?
>> data.register_count
=> 2

# How many rows of data?
>> data.row_count
=> 3

# Inspect one of the registers
>> reg = data.registers.first
>> reg.label
=> 'Solar'
>> reg.type_code
=> 'P'

# Get the data points from a given register, with timestamps
>> reg.each_row do |ts, val|
>>   puts "#{ts}: #{val}"
>> end
2012-10-09 13:50:00 -0400: 51140761685
2012-10-09 13:51:00 -0400: 51140761792
2012-10-09 13:52:00 -0400: 51140761880

REQUIREMENTS¶ ↑

  • Ruby 1.9

  • Nokogiri for XML parsing

  • Rspec to build and test the gem

INSTALL¶ ↑

To install, simply run:

sudo gem install egauge

RVM users can skip the sudo:

gem install egauge