saj_collector 0.1.0 → 0.1.1

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
2
  SHA1:
3
- metadata.gz: 6539a7bc0a1c18db6461405bf2c6a304aa01f23c
4
- data.tar.gz: 2b0fbc3ff726288947e0dc1bbe1252bcd050ca6b
3
+ metadata.gz: 0eeb1399288bf51e9f24aad907907e2b295b3cb6
4
+ data.tar.gz: c34f8b43d78a78b3bad34d2ea2b0e43f336989f4
5
5
  SHA512:
6
- metadata.gz: e865e4bfdfb131960fd742e8262243fe031f3858285f25dd7ae4d8fa97ba8539c82fdabcf32314597df3e4e01e5b9621b3b252f1a16659bb3ec31dae08f588e4
7
- data.tar.gz: f795f23be35fd57d38254a790840ea83484804fc7d439c84fa08e2aae5439d3dce78edd5682347bbf7ea478898c1d0701b187b7271f0f9b100432436b50b65de
6
+ metadata.gz: d3a11b8aa022396dc7f7af848a6f6b58b12e3d73cf1fb60b4c0616761db79a123561c64cf41e5526634fbf035dadf5aad41b0641195916d41fd2b9fef69b0f88
7
+ data.tar.gz: 6320e71fed30d7137e074cf041df8976567b35144c043131026c618be98de0f97609b0968465d05d4827a0d3dceac3bb9a18a3709d23afc87b93d4471d8c3e55
data/README.md CHANGED
@@ -26,11 +26,13 @@ Run the SAJ Collector in a screen or via init of some sort
26
26
 
27
27
  $ saj_collector
28
28
 
29
+ This will run the SAJ Collector and push the data once to PVOutput. You can add
30
+ saj_collector to your crontab or a custom script to let it automatically push with
31
+ a certain frequency.
32
+
29
33
  ## Development
30
34
 
31
35
  After checking out the repo, run `bin/setup` to install dependencies.
32
- Then, run `rake rspec` to run the tests. You can also
33
- run `bin/console` for an interactive prompt that will allow you to experiment.
34
36
 
35
37
  To install this gem onto your local machine, run `bundle exec rake install`. To
36
38
  release a new version, update the version number
@@ -45,7 +47,6 @@ This project is intended to be a safe, welcoming space for
45
47
  collaboration, and contributors are expected to adhere
46
48
  to the [Contributor Covenant](contributor-covenant.org) code of conduct.
47
49
 
48
-
49
50
  ## License
50
51
 
51
52
  The gem is available as open source under the terms
data/exe/saj_collector CHANGED
@@ -24,73 +24,68 @@ options = {
24
24
  'runtime_all_time' => 0
25
25
  }
26
26
 
27
- loop do
28
- # Get the current realtime data from the SAJ device
29
- c = Net::HTTP.get(sajcollector_config[:saj], '/real_time_data.xml')
27
+ # Get the current realtime data from the SAJ device
28
+ c = Net::HTTP.get(sajcollector_config[:saj], '/real_time_data.xml')
30
29
 
31
- # Let REXML parse the XML site
32
- doc = REXML::Document.new c
30
+ # Let REXML parse the XML site
31
+ doc = REXML::Document.new c
33
32
 
34
- # Get the temperature
35
- doc.elements.each("real_time_data/temp"){
36
- |e| options[:temperature] = e.text
37
- }
33
+ # Get the temperature
34
+ doc.elements.each("real_time_data/temp"){
35
+ |e| options[:temperature] = e.text
36
+ }
38
37
 
39
- # e-today is in kWh where pvoutput is Wh
40
- doc.elements.each("real_time_data/e-today"){
41
- |e| options[:energy_generated] = e.text.to_f * 1000
42
- }
38
+ # e-today is in kWh where pvoutput is Wh
39
+ doc.elements.each("real_time_data/e-today"){
40
+ |e| options[:energy_generated] = e.text.to_f * 1000
41
+ }
43
42
 
44
- # Get the power generated
45
- doc.elements.each("real_time_data/p-ac"){
46
- |e| options[:power_generated] = e.text
47
- }
43
+ # Get the power generated
44
+ doc.elements.each("real_time_data/p-ac"){
45
+ |e| options[:power_generated] = e.text
46
+ }
48
47
 
49
- # Get the current amperage
50
- doc.elements.each("real_time_data/i-grid"){
51
- |e| options[:amperage] = e.text
52
- }
48
+ # Get the current amperage
49
+ doc.elements.each("real_time_data/i-grid"){
50
+ |e| options[:amperage] = e.text
51
+ }
53
52
 
54
- # Get the voltage
55
- doc.elements.each("real_time_data/v-grid"){
56
- |e| options[:voltage] = e.text
57
- }
58
- doc.elements.each("real_time_data/e-today"){
59
- |e| options[:power_today] = e.text
60
- }
61
- doc.elements.each("real_time_data/e-total"){
62
- |e| options[:power_all_time] = e.text
63
- }
64
- doc.elements.each("real_time_data/t-today"){
65
- |e| options[:runtime_today] = e.text
66
- }
67
- doc.elements.each("real_time_data/t-total"){
68
- |e| options[:runtime_all_time] = e.text
69
- }
53
+ # Get the voltage
54
+ doc.elements.each("real_time_data/v-grid"){
55
+ |e| options[:voltage] = e.text
56
+ }
57
+ doc.elements.each("real_time_data/e-today"){
58
+ |e| options[:power_today] = e.text
59
+ }
60
+ doc.elements.each("real_time_data/e-total"){
61
+ |e| options[:power_all_time] = e.text
62
+ }
63
+ doc.elements.each("real_time_data/t-today"){
64
+ |e| options[:runtime_today] = e.text
65
+ }
66
+ doc.elements.each("real_time_data/t-total"){
67
+ |e| options[:runtime_all_time] = e.text
68
+ }
70
69
 
71
- puts
72
- puts '-------------------------'
73
- puts
74
- puts "Time: #{Time.now}"
75
- puts
76
- puts 'Realtime:'
77
- puts " Temp: #{options[:temperature]} C"
78
- puts " V: #{options[:voltage]} V"
79
- puts " I: #{options[:amperage]} A"
80
- puts " P: #{options[:power_generated]} W"
81
- puts
82
- puts 'Total:'
83
- puts " Power (today): #{options[:power_today]} kWH"
84
- puts " Power (all time): #{options[:power_all_time]} kWH"
85
- puts " Run Time: #{options[:runtime_today]} Hours"
86
- puts " Run Time: #{options[:runtime_all_time]} Hours"
87
- puts
70
+ puts '-------------------------'
71
+ puts
72
+ puts "Time: #{Time.now}"
73
+ puts
74
+ puts 'Realtime:'
75
+ puts " Temp: #{options[:temperature]} C"
76
+ puts " V: #{options[:voltage]} V"
77
+ puts " I: #{options[:amperage]} A"
78
+ puts " P: #{options[:power_generated]} W"
79
+ puts
80
+ puts 'Total:'
81
+ puts " Power (today): #{options[:power_today]} kWH"
82
+ puts " Power (all time): #{options[:power_all_time]} kWH"
83
+ puts " Run Time: #{options[:runtime_today]} Hours"
84
+ puts " Run Time: #{options[:runtime_all_time]} Hours"
88
85
 
89
- pvoutput.add_status(
90
- :energy_generated => options[:energy_generated],
91
- :power_generated => options[:power_generated],
92
- :temperature => options[:temperature],
93
- :voltage => options[:voltage],
94
- )
95
- sleep(60 * 5)
96
- end
86
+ pvoutput.add_status(
87
+ :energy_generated => options[:energy_generated],
88
+ :power_generated => options[:power_generated],
89
+ :temperature => options[:temperature],
90
+ :voltage => options[:voltage],
91
+ )
@@ -1,3 +1,3 @@
1
1
  module SAJCollector
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saj_collector
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johnny Willemsen