pvoutput 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -2
- data/README.md +44 -2
- data/circle.yml +3 -0
- data/lib/pvoutput/client.rb +21 -1
- data/lib/pvoutput/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8eb79d223db909c8c4ecc34f018b3a8d952b5ebb
|
4
|
+
data.tar.gz: 975583f464c918aca3e9d61fe1992a3012d5e404
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db4f626c4f3851d09020c247beccd74e634d0b77a9ebb4d0c3b59f740047efe26d07a9d00cfebcf8fa5995d4113ba42c5f272e4347fe408d1faab82586430127
|
7
|
+
data.tar.gz: f0c80ce60a15525463babc44727a3dc2732216831787f1d3efcab134160a290ee55354a18a1fa108bb6b5536b29db8e9bf41df25d1c21e1d631cf7f4c0346b64
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,16 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
# 0.2.0 (20160227)
|
4
|
+
|
5
|
+
* Fix typo in temperature (@jwillemsen)
|
6
|
+
* Add usage documentation (@jwillemsen)
|
7
|
+
* Add the add_ouput method for end of day reporting (@jwillemsen)
|
8
|
+
* Use latest bundler in CircleCI (@johnf)
|
9
|
+
|
1
10
|
# 0.1.1 (20151122)
|
2
11
|
|
3
|
-
* Convert the system id to a string
|
12
|
+
* Convert the system id to a string (@johnf)
|
4
13
|
|
5
14
|
# 0.1.0 (20151122)
|
6
15
|
|
7
|
-
* Initial Release
|
16
|
+
* Initial Release (@johnf)
|
data/README.md
CHANGED
@@ -23,7 +23,49 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
-
|
26
|
+
In order to use pvoutput in your application you need to use
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require 'pvoutput/client'
|
30
|
+
```
|
31
|
+
|
32
|
+
First step is to create a PVOutput client using your PVOutput assigned system_id and api_key
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
pvoutput = PVOutput::Client.new(system_id, api_key)
|
36
|
+
```
|
37
|
+
|
38
|
+
Now you can report your status to PVOutput using
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
pvoutput.add_status(
|
42
|
+
options
|
43
|
+
)
|
44
|
+
```
|
45
|
+
|
46
|
+
The add_status operation accepts the following options
|
47
|
+
|
48
|
+
| Option | PVOutput Parameter |
|
49
|
+
| ---------------- | ------------------ |
|
50
|
+
| energy_generated |v1 |
|
51
|
+
| power_generated | v2 |
|
52
|
+
| energy_consumed | v3 |
|
53
|
+
| power_consumed | v4 |
|
54
|
+
| temperature | v5 |
|
55
|
+
| voltage | v6 |
|
56
|
+
| cumulative | c1 |
|
57
|
+
| net | n |
|
58
|
+
|
59
|
+
As example
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
client.add_status(
|
63
|
+
:energy_generated => 100,
|
64
|
+
:power_generated => 50,
|
65
|
+
:temperature => 30,
|
66
|
+
:voltage => 200,
|
67
|
+
)
|
68
|
+
```
|
27
69
|
|
28
70
|
## Development
|
29
71
|
|
@@ -33,7 +75,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
33
75
|
|
34
76
|
## Contributing
|
35
77
|
|
36
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/johnf/pvoutput. 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.
|
78
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/johnf/pvoutput. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
37
79
|
|
38
80
|
|
39
81
|
## License
|
data/circle.yml
CHANGED
data/lib/pvoutput/client.rb
CHANGED
@@ -26,7 +26,7 @@ module PVOutput
|
|
26
26
|
params[:v2] = options[:power_generated] if options[:power_generated]
|
27
27
|
params[:v3] = options[:energy_consumed] if options[:energy_consumed]
|
28
28
|
params[:v4] = options[:power_consumed] if options[:power_consumed]
|
29
|
-
params[:v5] = options[:temperature] if options[:
|
29
|
+
params[:v5] = options[:temperature] if options[:temperature]
|
30
30
|
params[:v6] = options[:voltage] if options[:voltage]
|
31
31
|
params[:c1] = 1 if options[:cumulative] == true
|
32
32
|
params[:n] = 1 if options[:net] == true
|
@@ -36,5 +36,25 @@ module PVOutput
|
|
36
36
|
fail('Bad Post') unless response.code == 200
|
37
37
|
end
|
38
38
|
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
39
|
+
|
40
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
41
|
+
def add_output(options)
|
42
|
+
params = {
|
43
|
+
}
|
44
|
+
|
45
|
+
params[:d] = options[:output_date]
|
46
|
+
params[:g] = options[:energy_generated] if options[:energy_generated]
|
47
|
+
params[:pp] = options[:peak_power] if options[:peak_power]
|
48
|
+
params[:pt] = options[:peak_time] if options[:peak_time]
|
49
|
+
params[:cd] = options[:condition] if options[:condition]
|
50
|
+
params[:tm] = options[:min_temp] if options[:min_temp]
|
51
|
+
params[:tx] = options[:max_temp] if options[:max_temp]
|
52
|
+
params[:cm] = options[:comments] if options[:comments]
|
53
|
+
|
54
|
+
response = self.class.post('/service/r2/addoutput.jsp', :body => params)
|
55
|
+
|
56
|
+
fail('Bad Post') unless response.code == 200
|
57
|
+
end
|
58
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
39
59
|
end
|
40
60
|
end
|
data/lib/pvoutput/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pvoutput
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Ferlito
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|