saj_collector 0.4.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 669e9d65767c5457376d5c97928fe67af2a70e00
4
- data.tar.gz: 973475c0af31b95f8396ed858a3c5f156f34c37b
2
+ SHA256:
3
+ metadata.gz: 3cd6cde289ad4c8172d81fe8328aaed9d80739b034e373e76b2a84e3d7378fad
4
+ data.tar.gz: c6c71fc42fe81350dcbf3edaf7f9e26c02f90b07f412340702d3ecaa830d2806
5
5
  SHA512:
6
- metadata.gz: 13c34bad146027c732bea6831e990a23030539363415ad371fb8a05c3c9083391c0fc9a99b3309d00c35e5790bac1ab386e52e2d6bafc2be11dca37de9f32a39
7
- data.tar.gz: 9fcb9531181d277488c1a4cac41461aa1f2b8bf7d7c9f0b212bde089a87f5dec39060d4995975311ea7fcd201d26afce804ecf01411ac95502f671297280f291
6
+ metadata.gz: ba424ce76bf030ff3afb5ba7a4e300e8934ae8086f237e1f933ffbd92a449c953e594c31a374ddd45dd3e232b6001069ef42199f2b03adb3604ccf176203bd26
7
+ data.tar.gz: f3a2a0145efc2ea370e73353907b59e59a32f3d4caec503b005d322ffa92141e5b855d6459679cbe5eeaeccd8a615ccacab351da8613ae596e119358f50f65b7
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # SAJ Collector
2
2
 
3
+ [![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)
4
+
3
5
  Pull stats from SAJ Solar Inverter and push them to PVOutput. This
4
6
  ruby gem is based on https://github.com/johnf/jfy_collector
5
7
 
@@ -12,14 +14,15 @@ Install it:
12
14
  ## Usage
13
15
 
14
16
  Create a config file for PVOutput in ```saj_collector.yaml```.
15
- This should contain the IP address of your SAJ Solar Invertor, and your
16
- PVOutput system id and API key
17
+ This should contain the IP address of your SAJ Solar Invertor (```saj```), your
18
+ PVOutput system id (```system_id```) and API key (```api_key```).
17
19
 
18
20
  ``` yaml
19
21
  ---
20
22
  :saj: a.b.c.d
21
23
  :system_id: 123456
22
24
  :api_key: fb6a2e3
25
+ :day_trend_multiplication_factor: 100
23
26
  ```
24
27
 
25
28
  Run the SAJ Collector in a screen or via init of some sort
@@ -31,16 +34,19 @@ data once to PVOutput. You can add
31
34
  ``saj_collector`` to your crontab or a custom script to let it automatically push with
32
35
  a certain frequency.
33
36
 
37
+ The SAJ Output Collector will retrieve the generation of each day of the current month and
38
+ push the data once to PVOutput.
34
39
  Run the SAJ Output Collector in a screen or via init of some sort
35
40
 
36
41
  $ saj_output_collector
37
42
 
38
- This will retrieve the generation of each day of the current month and
39
- push the data once to PVOutput.
40
- You can add
41
- ``saj_output_collector`` to your crontab or a custom script to let it automatically push with
43
+ You can add ``saj_output_collector`` to your crontab or a custom script to let it automatically push with
42
44
  a certain frequency.
43
45
 
46
+ Some SAJ Solar Inverters provide the generation of each day with a granularity of 0.1kWh and some with
47
+ a granularity of 0.01kWh. In case of the last you have to change the ```day_trend_multiplication_factor```
48
+ within your ```saj_collector.yaml``` to 10.
49
+
44
50
  At the moment you add any of these to your crontab you have to make sure
45
51
  that the ``saj_collector.yaml`` file can be found. For example when you put the ``saj_collector.yaml`` file
46
52
  in /usr/local/bin (and also the gem) and want to run it each 5 minutes between 6AM and 10PM you should
@@ -30,13 +30,20 @@ options = {
30
30
 
31
31
  counter = 0
32
32
  current_day = '00'
33
+ day_trend_multiplication = 100
34
+
35
+ # Some SAJ Inverters provide they energy_generated in granularity of 0.1kWh and
36
+ # others in 0.01kWh.
37
+ if !sajcollector_config[:day_trend_multiplication_factor].nil?
38
+ day_trend_multiplication = sajcollector_config[:day_trend_multiplication_factor].to_i
39
+ end
33
40
 
34
41
  while counter < days
35
42
  value = {
36
43
  :energy_generated => 0 }
37
44
  # Get the power output of the day,
38
45
  doc.elements.each("day_trend/d#{counter}"){
39
- |e| value[:energy_generated] = (e.text.to_i * 100).to_s
46
+ |e| value[:energy_generated] = (e.text.to_i * day_trend_multiplication).to_s
40
47
  }
41
48
  options[:"#{m}#{current_day.next!}"] = value
42
49
 
@@ -44,7 +51,7 @@ while counter < days
44
51
  end
45
52
 
46
53
  options.each do |date, values|
47
- puts "Energy generated #{date}: #{values[:energy_generated]} WH"
54
+ puts "Energy generated #{date}: #{values[:energy_generated]} Wh"
48
55
  end
49
56
 
50
57
  pvoutput.add_batch_output(options)
@@ -1,3 +1,3 @@
1
1
  module SAJCollector
2
- VERSION = '0.4.3'.freeze
2
+ VERSION = '0.5.0'.freeze
3
3
  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.3
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johnny Willemsen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-31 00:00:00.000000000 Z
11
+ date: 2017-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pvoutput
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  version: '0'
136
136
  requirements: []
137
137
  rubyforge_project:
138
- rubygems_version: 2.5.1
138
+ rubygems_version: 2.7.3
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Pull stats from SAJ Solar Inverter and push them to PVOutput