saj_collector 0.5.7 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +12 -0
- data/.github/workflows/ruby.yml +16 -26
- data/.rubocop.yml +6 -1
- data/Gemfile +2 -0
- data/README.md +9 -10
- data/Rakefile +2 -0
- data/exe/saj_collector +14 -13
- data/exe/saj_output_collector +7 -5
- data/lib/saj_collector/version.rb +3 -1
- data/lib/say_collector.rb +2 -0
- data/saj_collector.gemspec +7 -3
- metadata +15 -16
- data/.travis.yml +0 -35
- data/circle.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a85c0d0e7e941a3f6089fa7714f85ba53d1497f8a2c04b000497c9cf0b20fe35
|
4
|
+
data.tar.gz: c949ccb9562e0dca93a1b6ff5826b5e1df4fc9ee2208d9d253df1c5cb448dbf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 693cdb0965d8e6c62705e5b793f85e09e569435cfb0df3e4bb1112b4b67f2b828dcec66cf58b9c1397e4a7a7450d332cbd2778c985766ca2019b341325a44d08
|
7
|
+
data.tar.gz: 56a40d75b2272e38da1983c55b1488ecf1da96f98c863ef9885d5730b08a92a79523bf36ddd99393ae45a44177cf99a4b974a8302064a3900facd5532ea373a8
|
data/.github/workflows/ruby.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
name:
|
1
|
+
name: ruby
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
@@ -6,36 +6,26 @@ on:
|
|
6
6
|
branches:
|
7
7
|
- master
|
8
8
|
schedule:
|
9
|
-
- cron: '0
|
9
|
+
- cron: '0 1 * * SUN'
|
10
10
|
|
11
11
|
jobs:
|
12
12
|
build:
|
13
13
|
runs-on: ubuntu-latest
|
14
14
|
strategy:
|
15
15
|
matrix:
|
16
|
-
|
17
|
-
|
18
|
-
Ruby25,
|
19
|
-
Ruby26,
|
20
|
-
Ruby27
|
21
|
-
]
|
22
|
-
include:
|
23
|
-
- name: Ruby24
|
24
|
-
RubyVersion: 2.4
|
25
|
-
- name: Ruby25
|
26
|
-
RubyVersion: 2.5
|
27
|
-
- name: Ruby26
|
28
|
-
RubyVersion: 2.6
|
29
|
-
- name: Ruby27
|
30
|
-
RubyVersion: 2.7
|
16
|
+
ruby-version: [ '2.5', '2.6', '2.7', '3.0', 'ruby-head' ]
|
17
|
+
name: ruby ${{ matrix.ruby-version }}
|
31
18
|
steps:
|
32
|
-
- uses: actions/checkout@
|
33
|
-
-
|
34
|
-
uses: actions/setup-ruby@v1
|
19
|
+
- uses: actions/checkout@v2
|
20
|
+
- uses: ruby/setup-ruby@v1
|
35
21
|
with:
|
36
|
-
ruby-version: ${{ matrix.
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
22
|
+
ruby-version: ${{ matrix.ruby-version }}
|
23
|
+
bundler-cache: true
|
24
|
+
- name: Install dependencies
|
25
|
+
run: bundle install
|
26
|
+
- name: Lint files
|
27
|
+
run: bundle exec rubocop
|
28
|
+
- name: Test with Rake
|
29
|
+
run: bundle exec rake
|
30
|
+
|
31
|
+
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
# SAJ Collector
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Actions Status](https://github.com/jwillemsen/saj_collector/workflows/ruby/badge.svg)](https://github.com/jwillemsen/saj_collector/actions)
|
4
4
|
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/fdb313b9a4b24614867b91e45a5505f9)](https://www.codacy.com/app/jwillemsen/saj_collector?utm_source=github.com&utm_medium=referral&utm_content=jwillemsen/saj_collector&utm_campaign=badger)
|
5
|
-
[![Gem Version](https://badge.fury.io/rb/saj_collector.svg)](
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/saj_collector.svg)](https://rubygems.org/gems/saj_collector)
|
6
6
|
|
7
|
-
Pull
|
7
|
+
Pull statistics from [SAJ Solar Inverter](https://www.saj-electric.com/) and push them to [PVOutput](https://pvoutput.org/). This
|
8
8
|
ruby gem is based on https://github.com/johnf/jfy_collector
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
12
12
|
First install [ruby](https://www.ruby-lang.org) on your system through your favorite package manager. On Windows download and install ruby from [Rubyinstaller](http://www.rubyinstaller.org).
|
13
13
|
|
14
|
-
Install
|
14
|
+
Install saj_collector by running the following command from a linux shell or windows command prompt
|
15
15
|
|
16
16
|
gem install saj_collector
|
17
17
|
|
@@ -25,7 +25,8 @@ system id and API key can be found on your
|
|
25
25
|
|
26
26
|
Some SAJ Solar Inverters provide the generation of each day with a granularity of 0.1kWh and some with
|
27
27
|
a granularity of 0.01kWh. In case of the last you have to change the ```day_trend_multiplication_factor```
|
28
|
-
within your ```saj_collector.yaml``` to 10.
|
28
|
+
within your ```saj_collector.yaml``` to 10. An incorrect ```day_trend_multiplication_factor``` triggers
|
29
|
+
a `Bad Post` exception when running the `saj_output_collector` script.
|
29
30
|
|
30
31
|
``` yaml
|
31
32
|
:saj: a.b.c.d
|
@@ -39,16 +40,14 @@ Run the SAJ Collector from the command prompt or shell
|
|
39
40
|
saj_collector
|
40
41
|
|
41
42
|
This will run the current power generation frm the SAJ Collector and push the
|
42
|
-
data
|
43
|
+
data to PVOutput.
|
43
44
|
|
44
45
|
The SAJ Output Collector will retrieve the generation of each day of the current month and
|
45
|
-
push the data
|
46
|
-
|
47
|
-
Run the SAJ Output Collector from the command prompt or shell
|
46
|
+
push the data to PVOutput. Run the SAJ Output Collector from the command prompt or shell
|
48
47
|
|
49
48
|
saj_output_collector
|
50
49
|
|
51
|
-
## Scheduling the
|
50
|
+
## Scheduling the collector
|
52
51
|
|
53
52
|
On Linux you can add ``saj_collector`` and ``saj_output_collector`` to your crontab to let it automatically push with
|
54
53
|
a certain frequency.
|
data/Rakefile
CHANGED
data/exe/saj_collector
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'rexml/document'
|
4
5
|
require 'net/http'
|
@@ -16,22 +17,22 @@ sajcollector_config = YAML.load_file(yaml_file)
|
|
16
17
|
pvoutput = PVOutput::Client.new(sajcollector_config[:system_id], sajcollector_config[:api_key])
|
17
18
|
|
18
19
|
unless IPAddress.valid?(sajcollector_config[:saj])
|
19
|
-
raise
|
20
|
+
raise("[#{sajcollector_config[:saj]}] is not a valid IP address, please correct your #{yaml_file} file")
|
20
21
|
end
|
21
22
|
|
22
23
|
# Get the current realtime data from the SAJ device
|
23
24
|
c = Net::HTTP.get(sajcollector_config[:saj], '/real_time_data.xml')
|
24
25
|
|
25
26
|
options = {
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
temperature: 0, # Temperature in celcius
|
28
|
+
energy_generated: 0, # Energy generation in watt hours
|
29
|
+
power_generated: 0, # Power generation in watts
|
30
|
+
voltage: 0, # Voltage in volts
|
31
|
+
amperage: 0, # Amperage
|
32
|
+
power_today: 0,
|
33
|
+
power_all_time: 0,
|
34
|
+
runtime_today: 0,
|
35
|
+
runtime_all_time: 0
|
35
36
|
}
|
36
37
|
|
37
38
|
# Let REXML parse the XML site
|
@@ -96,7 +97,7 @@ puts " Run Time: #{options[:runtime_all_time]} Hours"
|
|
96
97
|
|
97
98
|
pvoutput.add_status(
|
98
99
|
energy_generated: options[:energy_generated],
|
99
|
-
power_generated:
|
100
|
-
temperature:
|
101
|
-
voltage:
|
100
|
+
power_generated: options[:power_generated],
|
101
|
+
temperature: options[:temperature],
|
102
|
+
voltage: options[:voltage]
|
102
103
|
)
|
data/exe/saj_output_collector
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'rexml/document'
|
4
5
|
require 'net/http'
|
@@ -16,7 +17,7 @@ sajcollector_config = YAML.load_file(yaml_file)
|
|
16
17
|
pvoutput = PVOutput::Client.new(sajcollector_config[:system_id], sajcollector_config[:api_key])
|
17
18
|
|
18
19
|
unless IPAddress.valid?(sajcollector_config[:saj])
|
19
|
-
raise
|
20
|
+
raise("[#{sajcollector_config[:saj]}] is not a valid IP address, please correct your #{yaml_file} file")
|
20
21
|
end
|
21
22
|
|
22
23
|
# Get the current day trend data from the SAJ device
|
@@ -36,7 +37,7 @@ options = {
|
|
36
37
|
}
|
37
38
|
|
38
39
|
counter = 0
|
39
|
-
current_day =
|
40
|
+
current_day = 1
|
40
41
|
day_trend_multiplication = 100
|
41
42
|
|
42
43
|
# Some SAJ Inverters provide they energy_generated in granularity of 0.1kWh and
|
@@ -53,13 +54,14 @@ while counter < days
|
|
53
54
|
doc.elements.each("day_trend/d#{counter}") do |e|
|
54
55
|
value[:energy_generated] = (e.text.to_i * day_trend_multiplication).to_s
|
55
56
|
end
|
56
|
-
options[:"#{m}#{current_day.
|
57
|
-
|
57
|
+
options[:"#{m}#{current_day.to_s.rjust(2, '0')}"] = value
|
58
58
|
counter += 1
|
59
|
+
current_day += 1
|
59
60
|
end
|
60
61
|
|
61
62
|
options.each do |date, values|
|
62
|
-
|
63
|
+
energy_generated = values[:energy_generated].to_i / 1000.0
|
64
|
+
puts "Energy generated #{date}: #{energy_generated} kWh"
|
63
65
|
end
|
64
66
|
|
65
67
|
pvoutput.add_batch_output(options)
|
data/lib/say_collector.rb
CHANGED
data/saj_collector.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
require 'saj_collector/version'
|
@@ -8,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
8
10
|
spec.authors = ['Johnny Willemsen']
|
9
11
|
spec.email = ['jwillemsen@remedy.nl']
|
10
12
|
|
11
|
-
spec.summary = 'Pull
|
13
|
+
spec.summary = 'Pull statistics from SAJ Solar Inverter and push them to PVOutput'
|
12
14
|
spec.homepage = 'https://github.com/jwillemsen/saj_collector'
|
13
15
|
spec.license = 'MIT'
|
14
16
|
|
@@ -17,12 +19,14 @@ Gem::Specification.new do |spec|
|
|
17
19
|
spec.require_paths = ['lib']
|
18
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
21
|
|
22
|
+
spec.required_ruby_version = '>= 2.5'
|
23
|
+
|
20
24
|
spec.add_dependency 'ipaddress'
|
21
|
-
spec.add_dependency 'pvoutput', '
|
25
|
+
spec.add_dependency 'pvoutput', '>= 1.0'
|
22
26
|
|
23
27
|
spec.add_development_dependency 'bundler'
|
24
28
|
spec.add_development_dependency 'rake', '>= 12.3.3'
|
25
29
|
spec.add_development_dependency 'rspec'
|
26
|
-
spec.add_development_dependency 'rubocop', '~>
|
30
|
+
spec.add_development_dependency 'rubocop', '~> 1.12.0'
|
27
31
|
spec.add_development_dependency 'rubocop-rspec'
|
28
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: saj_collector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johnny Willemsen
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ipaddress
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: pvoutput
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '1.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 1.12.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 1.12.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rubocop-rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
description:
|
111
|
+
description:
|
112
112
|
email:
|
113
113
|
- jwillemsen@remedy.nl
|
114
114
|
executables:
|
@@ -118,16 +118,15 @@ extensions: []
|
|
118
118
|
extra_rdoc_files: []
|
119
119
|
files:
|
120
120
|
- ".github/FUNDING.yml"
|
121
|
+
- ".github/dependabot.yml"
|
121
122
|
- ".github/workflows/ruby.yml"
|
122
123
|
- ".rubocop.yml"
|
123
|
-
- ".travis.yml"
|
124
124
|
- CODE_OF_CONDUCT.md
|
125
125
|
- Gemfile
|
126
126
|
- LICENSE.txt
|
127
127
|
- README.md
|
128
128
|
- Rakefile
|
129
129
|
- bin/setup
|
130
|
-
- circle.yml
|
131
130
|
- exe/saj_collector
|
132
131
|
- exe/saj_output_collector
|
133
132
|
- lib/saj_collector/version.rb
|
@@ -137,7 +136,7 @@ homepage: https://github.com/jwillemsen/saj_collector
|
|
137
136
|
licenses:
|
138
137
|
- MIT
|
139
138
|
metadata: {}
|
140
|
-
post_install_message:
|
139
|
+
post_install_message:
|
141
140
|
rdoc_options: []
|
142
141
|
require_paths:
|
143
142
|
- lib
|
@@ -145,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
144
|
requirements:
|
146
145
|
- - ">="
|
147
146
|
- !ruby/object:Gem::Version
|
148
|
-
version: '
|
147
|
+
version: '2.5'
|
149
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
149
|
requirements:
|
151
150
|
- - ">="
|
@@ -153,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
152
|
version: '0'
|
154
153
|
requirements: []
|
155
154
|
rubygems_version: 3.0.8
|
156
|
-
signing_key:
|
155
|
+
signing_key:
|
157
156
|
specification_version: 4
|
158
|
-
summary: Pull
|
157
|
+
summary: Pull statistics from SAJ Solar Inverter and push them to PVOutput
|
159
158
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
before_install:
|
2
|
-
- gem install bundler
|
3
|
-
bundler_args: "--verbose"
|
4
|
-
script:
|
5
|
-
- bundle exec rake build
|
6
|
-
rvm:
|
7
|
-
- 2.3.1
|
8
|
-
- 2.4
|
9
|
-
- 2.5
|
10
|
-
- 2.6
|
11
|
-
- 2.7
|
12
|
-
- ruby-head
|
13
|
-
gemfile:
|
14
|
-
- Gemfile
|
15
|
-
matrix:
|
16
|
-
allow_failures:
|
17
|
-
- rvm: ruby-head
|
18
|
-
env:
|
19
|
-
matrix:
|
20
|
-
- CODECLIMATE_REPO_TOKEN=2b46019558c79326fc3cc87f2e4261610256aee236063c4b62b8ed8d2c2ce21d
|
21
|
-
global:
|
22
|
-
secure: pIBdjy8REKRp9GPVeR22JYu0GrCmS2d1rz7Yyxo9lV7yMKUQK2lQw5PQ1fQizxK1NryiNx5nrYJol/EC9a/MTp8rGAOVwEYv5C7gO/Ede/ADuOo7OUjCvI+a88hWNQqp04cZAeYLaX0Avdz/odbkXKHAH8HTt028f1REMKXH3CUm7CmqTEPlB96xXk8nSH8IAQZZlSw1Yu2bIP18h4m73USh9JM/nZbfY7lz2jCxLeinFFJl3ELkfAtvuuo6ptyuu7uZTpZd/9H6N0ddEFUFUcimZbXCcF21S3BdTX6eSyB1h66q17Tx6fi7/rQh+Jah8yhOrgjr+LLZoIAXosgBt/LnfN2V1MqJVqd/ajN9TBVp+mB/NV7z+nqcUNSEbleOpE9tTb4DHa3izA2cL17wuA0sxxNuvaUVbu1u4iFQNfEtiVmCdqZwAp9cXeD0x1RSLWUofn413xAzQBNiH/UxXwVFvZzUwtrlkzEUyYWtprm9RWyJEaEr1a4Tv5LhjmeaB2e9gwDzIT/RZaTfTswZzpbBsN3/dOeLhZkH4hCbN7Um2OBymQlVTNpZp/jRM/pEepMUdJjQ2SUU26/9B5Xqp3M01zUr2Z65djmyAkK3DkdLAzGo9FdWZW7VdDKLaO17TeDWizkQLD9pZUr1QfniYJzUxqYb7oqfekhtcDCMOag=
|
23
|
-
addons:
|
24
|
-
code_climate:
|
25
|
-
repo_token: 2b46019558c79326fc3cc87f2e4261610256aee236063c4b62b8ed8d2c2ce21d
|
26
|
-
after_success:
|
27
|
-
- bundle exec codeclimate-test-reporter
|
28
|
-
deploy:
|
29
|
-
provider: rubygems
|
30
|
-
api_key:
|
31
|
-
secure: YnibTFYFBn8XvyocId6wfKm3qCrVOprorIkKHEok4g8AOo3VHea9YxChmp2E/yvVqDdT9G7yKg3hn+JwuolYOIyGVSlS7AXOHguzHLcOI7iYwAd+RWFXDmn1MMFIX/tVV0oeRu8mNGbxNIbofI6DtExH0RHRHN0FTIqxPzH8Se0TbkHzznKkouwu55CU8ss7kh/CYPeFJOEyfCxZ+NNm1cdWocNkMbhPxT2FgsXGRlIMsABc/UpTMUR2mtmGqFUiwnIKvxkhI9qUEePfqHYU/IVGubwUjSE5LJRvOtAOdglj4QH4UZKlI2TJI6kq4a/1q7lZuAnONyqdlROrmBIjm9K9g9l0XvCBeReNpZoXRxIS+78F0H1GSCvxajaRfJYk0Po4RZ6JE2N8hhxSpqyMRHy2mVQiu5fBMXaZXcH7buIgiPY7KH+JFBgyGUqFR8a+8d0kKuX0Fz/sM1YmO2iATtP+CXqSotDWmU4nn8dMoEyvzvHlG5O49ZIlhG+ze6SlryWOlgiewEk8Gf+Nn3q5En1jgxAZTSPy5eyzQdT4RR4dysMy8p1BGCxIXyaKDDZVtk3n+00kG4VMLmrLehfrjalNY6NDAkOEO5Fc1OrQEYXKT/CHlA3R7iaZDqsblRgfpEDYTsXAffMobyggnrrWZRxrJppvITGCFOb6FFvYjKI=
|
32
|
-
gemspec: saj_collector.gemspec
|
33
|
-
on:
|
34
|
-
tags: true
|
35
|
-
repo: jwillemsen/saj_collector
|