Skip to content
Ruby gem for Neurio
Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
spec
.gitignore
.yardopts
CHANGELOG.md
Gemfile
Gemfile.lock
Guardfile
README.md
neurio.gemspec

README.md

neurio

This gem provides a lightweight wrapper for the API of the Neurio energy monitoring device.

Examples

Basic usage example to return sensor readings in 15-second batches.

n = Neurio.new(:client_id => YOUR_CLIENT_ID, :client_secret => YOUR_CLIENT_SECRET)

last_time = Time.now - 60 # Start with 60 seconds of history

while true do
  readings = n.live(last_time)
  last_time = readings.first.timestamp
  readings.reverse! # API returns results in reverse order
  (0..(readings.size-1)).each do |i|
    puts "#{readings[i].timestamp} - #{readings[i].consumption_power}"
  end
  sleep(15)
end
You can’t perform that action at this time.