parse_p1 0.0.5 → 0.0.6
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.
- data/.gitignore +0 -1
- data/.rvmrc +1 -0
- data/CHANGELOG +3 -1
- data/README.md +7 -1
- data/lib/parse_p1/electricity.rb +20 -0
- data/lib/parse_p1/version.rb +1 -1
- data/test/parse_p1_test.rb +9 -4
- metadata +5 -4
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.3@parse_p1 --create
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
* 0.0.6
|
2
|
+
Added so called direct methods electra_import_normal, electra_import_low, electra_export_normal and electra_export_low
|
3
|
+
|
1
4
|
* 0.0.5
|
2
5
|
Bug fix: normal and low tariffs for electricity were changed!
|
3
6
|
|
@@ -11,5 +14,4 @@
|
|
11
14
|
Parsing of electricity and gas values
|
12
15
|
|
13
16
|
* 0.0.1
|
14
|
-
|
15
17
|
Initial release
|
data/README.md
CHANGED
@@ -37,10 +37,16 @@ Usage
|
|
37
37
|
=====
|
38
38
|
|
39
39
|
<pre>
|
40
|
-
p1 = ParseP1::Base.new(p1_string)
|
40
|
+
p1 = ParseP1::Base.new(p1_string)
|
41
|
+
|
41
42
|
p1.electra_meter_id #-> 1A123456789012345678901234567890
|
42
43
|
p1.electricity(:type => :import, :tariff => :normal) #-> 116.34 (kWH)
|
43
44
|
p1.electricity(:type => :import, :actual => :true) #-> 1245 (watt)
|
45
|
+
|
46
|
+
or with the direct methods: electra_import_normal, electra_import_low, electra_export_normal and electra_export_low
|
47
|
+
|
48
|
+
and for gas:
|
49
|
+
|
44
50
|
p1.gas_usage #-> 91.224 (m3)
|
45
51
|
</pre>
|
46
52
|
|
data/lib/parse_p1/electricity.rb
CHANGED
@@ -15,6 +15,26 @@ module ParseP1
|
|
15
15
|
electricity('0-0:17.0.0')
|
16
16
|
end
|
17
17
|
|
18
|
+
def electra_import_low
|
19
|
+
electricity(:type => :import, :tariff => :low)
|
20
|
+
end
|
21
|
+
|
22
|
+
def electra_import_normal
|
23
|
+
electricity(:type => :import, :tariff => :normal)
|
24
|
+
end
|
25
|
+
|
26
|
+
def electra_export_low
|
27
|
+
electricity(:type => :export, :tariff => :low)
|
28
|
+
end
|
29
|
+
|
30
|
+
def electra_export_normal
|
31
|
+
electricity(:type => :export, :tariff => :normal)
|
32
|
+
end
|
33
|
+
|
34
|
+
def actual_electra
|
35
|
+
electricity(:type => :import, :actual => true)
|
36
|
+
end
|
37
|
+
|
18
38
|
def electricity(options)
|
19
39
|
if options.is_a?(Hash)
|
20
40
|
if options[:actual] == true
|
data/lib/parse_p1/version.rb
CHANGED
data/test/parse_p1_test.rb
CHANGED
@@ -52,23 +52,27 @@ class TestParseP1 < Test::Unit::TestCase
|
|
52
52
|
end
|
53
53
|
|
54
54
|
#F9 (3,3)
|
55
|
-
should 'return imported electricty with
|
55
|
+
should 'return imported electricty with low tarif' do
|
56
56
|
assert_equal 136.787, @p1.electricity(:type => :import, :tariff => :low)
|
57
|
+
assert_equal 136.787, @p1.electra_import_low
|
57
58
|
end
|
58
59
|
|
59
60
|
#F9 (3,3)
|
60
|
-
should 'return imported electricty with
|
61
|
+
should 'return imported electricty with normal tarif' do
|
61
62
|
assert_equal 131.849, @p1.electricity(:type => :import, :tariff => :normal)
|
63
|
+
assert_equal 131.849, @p1.electra_import_normal
|
62
64
|
end
|
63
65
|
|
64
66
|
#F9 (3,3)
|
65
|
-
should 'return electricty produced by client
|
67
|
+
should 'return electricty produced by client low tarif' do
|
66
68
|
assert_equal 2.345, @p1.electricity(:type => :export, :tariff => :low)
|
69
|
+
assert_equal 2.345, @p1.electra_export_low
|
67
70
|
end
|
68
71
|
|
69
72
|
#F9 (3,3)
|
70
|
-
should 'return electricty produced by client
|
73
|
+
should 'return electricty produced by client normal tarif' do
|
71
74
|
assert_equal 54.976, @p1.electricity(:type => :export, :tariff => :normal)
|
75
|
+
assert_equal 54.976, @p1.electra_export_normal
|
72
76
|
end
|
73
77
|
|
74
78
|
context 'Actual data' do
|
@@ -76,6 +80,7 @@ class TestParseP1 < Test::Unit::TestCase
|
|
76
80
|
#F5 (3,3)
|
77
81
|
should 'return actual power imported' do
|
78
82
|
assert_equal 3200, @p1.electricity(:type => :import, :actual => true)
|
83
|
+
assert_equal 3200, @p1.actual_electra
|
79
84
|
end
|
80
85
|
|
81
86
|
#F5 (3,3)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parse_p1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shoulda
|
@@ -71,6 +71,7 @@ extra_rdoc_files:
|
|
71
71
|
- README.md
|
72
72
|
files:
|
73
73
|
- .gitignore
|
74
|
+
- .rvmrc
|
74
75
|
- .travis.yml
|
75
76
|
- CHANGELOG
|
76
77
|
- Gemfile
|
@@ -105,7 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
106
|
version: '0'
|
106
107
|
segments:
|
107
108
|
- 0
|
108
|
-
hash:
|
109
|
+
hash: 2211038779225675190
|
109
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
111
|
none: false
|
111
112
|
requirements:
|
@@ -114,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
115
|
version: '0'
|
115
116
|
segments:
|
116
117
|
- 0
|
117
|
-
hash:
|
118
|
+
hash: 2211038779225675190
|
118
119
|
requirements: []
|
119
120
|
rubyforge_project: parse_p1
|
120
121
|
rubygems_version: 1.8.24
|