green_eye_monitor_collector 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cc4ac855d811d78e9fed5d1ad8099ed314f2869a
4
+ data.tar.gz: 77eb1027a5a091561dc7453d26f1d9c6ac96bb18
5
+ SHA512:
6
+ metadata.gz: 05ab6b23d0c1e67c775af746060e48b9d354e0dfa049f0dd38fb9cf12e2b3f2184dd5b1d7d5c1c834bc0c9223d77c6622464848ed3ad2af35b205d870676c06f
7
+ data.tar.gz: 036bbe1caa68a28dd987bc45160570c6822d47d62e2dc5cf2f7a51de9a1bdabac92bb5ee8569d6ddb8941cb1188f3d89cec96bd23098256415c1b35f51258046
@@ -0,0 +1,6 @@
1
+ /.bundle/
2
+ /Gemfile.lock
3
+ /coverage/
4
+ /pkg/
5
+ /spec/reports/
6
+ /tmp/
@@ -0,0 +1,22 @@
1
+ require: rubocop-rspec
2
+
3
+ HashSyntax:
4
+ EnforcedStyle: hash_rockets
5
+
6
+ Style/Documentation:
7
+ Enabled: false
8
+
9
+ Style/Lambda:
10
+ Enabled: false
11
+
12
+ Style/TrailingComma:
13
+ EnforcedStyleForMultiline: comma
14
+
15
+ Metrics/LineLength:
16
+ Max: 120
17
+
18
+ Style/ModuleFunction:
19
+ Enabled: false
20
+
21
+ AlignHash:
22
+ EnforcedHashRocketStyle: table
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 0.0.1 (20160514)
4
+
5
+ * Initial Release (@johnf)
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behaviour by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behaviour may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 John Ferlito
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,37 @@
1
+ # Green Eye Monitor Collector
2
+
3
+ Pull stats from Brultech GEM energy consumption monitor and push them to Smart
4
+ Energy Groups
5
+
6
+ ## Installation
7
+
8
+ Install it:
9
+
10
+ $ gem install green_eye_monitor_collector
11
+
12
+ ## Usage
13
+
14
+ Create a config file for PVOutput in ```/etc/green_eye_monitor_collector/seg.yaml```.
15
+
16
+ ``` yaml
17
+ ---
18
+ :site_id: 123456
19
+ ```
20
+
21
+ Run the GEM Collector in a screen or via init of some sort
22
+
23
+ $ green_eye_monitor_collector
24
+
25
+ ## Development
26
+
27
+ 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.
28
+
29
+ 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).
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/johnf/jfy_collector. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
34
+
35
+ ## License
36
+
37
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,4 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rubocop/rake_task'
3
+
4
+ RuboCop::RakeTask.new
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+
3
+ set -euo pipefail
4
+ IFS=$'\n\t'
5
+
6
+ bundle install
@@ -0,0 +1,6 @@
1
+ test:
2
+ post:
3
+ - bundle exec rubocop
4
+ machine:
5
+ ruby:
6
+ version: 2.3.1
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'green_eye_monitor/client'
4
+ require 'smart_energy_group/client'
5
+ require 'awesome_print'
6
+ require 'yaml'
7
+
8
+ seg_config = YAML.load_file('/etc/green_eye_monitor_collector/seg.yaml')
9
+ seg_config[:channels] ||= {}
10
+
11
+ gem = GreenEyeMonitor::Client.new(:serial_port => '/dev/ttyUSB1', :debug => false)
12
+
13
+ seg = SmartEnergyGroup::Client.new(seg_config[:site_id])
14
+
15
+ puts "Gem Serial: #{gem.serial}"
16
+ puts
17
+
18
+ gem.packet_format = :bin32_net
19
+
20
+ old_data = gem.send_one_packet
21
+ sleep(10)
22
+
23
+ loop do
24
+ data = gem.send_one_packet(old_data)
25
+
26
+ options = {
27
+ :temperature => data.temperature,
28
+ :power => data.abs_watts,
29
+ :amps => data.current,
30
+ :voltage => [data.voltage]
31
+ }
32
+
33
+ seg_config[:channels].each do |type, channels|
34
+ options[type] = Hash[channels.map { |i| [i, options[type][i - 1]] }]
35
+ end
36
+
37
+ seg.send_data('gem', options)
38
+
39
+ puts
40
+ puts '-------------------------'
41
+ puts
42
+ puts "Time: #{Time.now}"
43
+ puts
44
+ puts 'Realtime:'
45
+ puts " Voltage: #{options[:voltage].first}"
46
+ puts " Temp: #{options[:temperature].values.join(', ')}"
47
+ puts " Power: #{options[:power].values.join(', ')}"
48
+ puts " Current: #{options[:amps].values.join(', ')}"
49
+ puts
50
+
51
+ old_data = data
52
+
53
+ sleep(60)
54
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'green_eye_monitor_collector/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'green_eye_monitor_collector'
8
+ spec.version = GreenEyeMonitorCollector::VERSION
9
+ spec.authors = ['John Ferlito']
10
+ spec.email = ['johnf@inodes.org']
11
+
12
+ spec.summary = 'Pull stats from Brultech GEM energy consumption monitor and push them to Smart Energy Groups'
13
+ spec.homepage = 'https://github.com/johnf/green_eye_monitor_collector'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = 'exe'
18
+ spec.require_paths = ['lib']
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+
21
+ spec.add_dependency 'green_eye_monitor'
22
+ spec.add_dependency 'smart_energy_group'
23
+ spec.add_dependency 'awesome_print'
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.10'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'rubocop'
28
+ end
@@ -0,0 +1,4 @@
1
+ require 'green_eye_monitor_collector/version'
2
+
3
+ module GreenEyeMonitorCollector
4
+ end
@@ -0,0 +1,3 @@
1
+ module GreenEyeMonitorCollector
2
+ VERSION = '0.1.0'.freeze
3
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: green_eye_monitor_collector
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - John Ferlito
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-06-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: green_eye_monitor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: smart_energy_group
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: awesome_print
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.10'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.10'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description:
98
+ email:
99
+ - johnf@inodes.org
100
+ executables:
101
+ - green_eye_monitor_collector
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - ".rubocop.yml"
107
+ - CHANGELOG.md
108
+ - CODE_OF_CONDUCT.md
109
+ - Gemfile
110
+ - LICENSE.txt
111
+ - README.md
112
+ - Rakefile
113
+ - bin/setup
114
+ - circle.yml
115
+ - exe/green_eye_monitor_collector
116
+ - green_eye_monitor_collector.gemspec
117
+ - lib/green_eye_monitor_collector.rb
118
+ - lib/green_eye_monitor_collector/version.rb
119
+ homepage: https://github.com/johnf/green_eye_monitor_collector
120
+ licenses:
121
+ - MIT
122
+ metadata: {}
123
+ post_install_message:
124
+ rdoc_options: []
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubyforge_project:
139
+ rubygems_version: 2.5.1
140
+ signing_key:
141
+ specification_version: 4
142
+ summary: Pull stats from Brultech GEM energy consumption monitor and push them to
143
+ Smart Energy Groups
144
+ test_files: []