saj_collector 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/exe/saj_collector +57 -62
- data/lib/saj_collector/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0eeb1399288bf51e9f24aad907907e2b295b3cb6
|
4
|
+
data.tar.gz: c34f8b43d78a78b3bad34d2ea2b0e43f336989f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
28
|
-
|
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
|
-
|
32
|
-
|
30
|
+
# Let REXML parse the XML site
|
31
|
+
doc = REXML::Document.new c
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
# Get the temperature
|
34
|
+
doc.elements.each("real_time_data/temp"){
|
35
|
+
|e| options[:temperature] = e.text
|
36
|
+
}
|
38
37
|
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|
-
|
45
|
-
|
46
|
-
|
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
|
-
|
50
|
-
|
51
|
-
|
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
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
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
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
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
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
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
|
+
)
|