https://github.com/johnf/smart_energy_group
Ruby Library for Smart Energy Group API
https://github.com/johnf/smart_energy_group
solar
Last synced: about 1 year ago
JSON representation
Ruby Library for Smart Energy Group API
- Host: GitHub
- URL: https://github.com/johnf/smart_energy_group
- Owner: johnf
- License: mit
- Created: 2016-05-14T00:27:31.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-16T04:18:35.000Z (about 10 years ago)
- Last Synced: 2025-02-25T14:54:39.693Z (over 1 year ago)
- Topics: solar
- Language: Ruby
- Size: 13.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Smart Energy Group
[](https://circleci.com/gh/johnf/smart_energy_group)
[](https://coveralls.io/github/johnf/smart_energy_group?branch=master)
Ruby library for talking to the Smart Energy Group API.
Documentation for the API can be found at https://smartenergygroups.com/api
## Installation
Add this line to your application's Gemfile:
``` ruby
gem 'smart_energy_group'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install smart_energy_group
## Usage
In order to use smart_energy_group in your application you need to use
``` ruby
require 'smart_energy_group/client'
```
First step is to create a Smart Energy Group client using your Smart Energy Group assigned site_token
``` ruby
seg = SmartEnergyGroup::Client.new(site_token)
```
You can then push data points
``` ruby
seg.send_data(
'home',
:temperature => [20.5, 60.0],
:power => [1023.6, 500.9]
)
```
If you don't have consecutive channels that you want to send you can pass an
array like so
``` ruby
seg.send_data(
'home',
:power => { 1 => 1023.6, 5 => 500.9 }
)
```
The send_data operation accepts the following options
| Option | Description |
| ----------- | ----------- |
| power | Power stream with the unit of watts |
| energy | Energy stream with the unit prefixed to kilowatt hours |
| amps | Current stream with the unit of amps |
| channel | Power stream identified with the Phase based on the channel number, with the same settings as a normal power stream |
| temperature | Temperature stream with default units of Celcius |
| voltage | Voltage stream with the units being volts |
| state | Switch state stream to determine if a switch is on or off |
| seconds | Seconds stream representitive of an elapsed time in seconds |
| heartbeat | Boot Event stream to determine if your device has booted and also records a heartbeat to check things are still ticking |
| pule | Count of pulses output from a device |
**Note::** The above will raise an error until you put the site into Discovery mode on the SEG website.
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/johnf/pvoutput. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).