emu_power 1.1 → 1.2
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 +4 -4
- data/lib/emu_power/types.rb +72 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d6c6e6d6a64f468e6444fadddc097273e53c3d9ac39137e5aa98b9572f880fe
|
4
|
+
data.tar.gz: 975a4a0af9508b812694a3cfcb79feba1cf342f4751042d3d64b9bf34a87d423
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98bd516022ccc746b236943c64e6dacb2cde05e96936a21f9e45b762d35bb0833df82542c260586f3bdf20dc74506abc7dce7842656820484a1c8be03fe5f418
|
7
|
+
data.tar.gz: d2175b774449b338d3ce38317551ab70ae2a6ca969ba2e43f8a26f9adc5eb05818dfc4785f6517b38c60137f33cbe25cc51dfee7b6453442467989e2e5cefdd1
|
data/lib/emu_power/types.rb
CHANGED
@@ -26,9 +26,13 @@ class EmuPower::Types
|
|
26
26
|
# these into more standard Unix epoch timestamps by adding the
|
27
27
|
# appropriate offset.
|
28
28
|
def timestamp
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
parse_timestamp('TimeStamp')
|
30
|
+
end
|
31
|
+
|
32
|
+
def parse_timestamp(prop)
|
33
|
+
v = @raw[prop]
|
34
|
+
return nil if v == nil
|
35
|
+
return Integer(v) + 946684800
|
32
36
|
end
|
33
37
|
|
34
38
|
def parse_hex(prop)
|
@@ -56,30 +60,59 @@ class EmuPower::Types
|
|
56
60
|
|
57
61
|
end
|
58
62
|
|
63
|
+
# TODO
|
59
64
|
class ConnectionStatus < Notification
|
60
65
|
end
|
61
66
|
|
67
|
+
# TODO
|
62
68
|
class DeviceInfo < Notification
|
63
69
|
end
|
64
70
|
|
65
71
|
class ScheduleInfo < Notification
|
72
|
+
|
73
|
+
attr_accessor :mode
|
74
|
+
attr_accessor :event
|
75
|
+
attr_accessor :frequency
|
76
|
+
attr_accessor :enabled
|
77
|
+
|
78
|
+
def build(hash)
|
79
|
+
self.mode = hash['Mode']
|
80
|
+
self.event = hash['Event']
|
81
|
+
self.frequency = parse_hex('Frequency')
|
82
|
+
self.enabled = parse_bool('Enabled')
|
83
|
+
end
|
84
|
+
|
66
85
|
end
|
67
86
|
|
87
|
+
# TODO
|
68
88
|
class MeterList < Notification
|
69
89
|
end
|
70
90
|
|
91
|
+
# TODO
|
71
92
|
class MeterInfo < Notification
|
72
93
|
end
|
73
94
|
|
95
|
+
# TODO
|
74
96
|
class NetworkInfo < Notification
|
75
97
|
end
|
76
98
|
|
77
99
|
class TimeCluster < Notification
|
100
|
+
|
101
|
+
attr_accessor :utc_time
|
102
|
+
attr_accessor :local_time
|
103
|
+
|
104
|
+
def build(hash)
|
105
|
+
self.utc_time = parse_timestamp('UTCTime')
|
106
|
+
self.local_time = parse_timestamp('LocalTime')
|
107
|
+
end
|
108
|
+
|
78
109
|
end
|
79
110
|
|
111
|
+
# TODO
|
80
112
|
class MessageCluster < Notification
|
81
113
|
end
|
82
114
|
|
115
|
+
# TODO
|
83
116
|
class PriceCluster < Notification
|
84
117
|
end
|
85
118
|
|
@@ -111,14 +144,50 @@ class EmuPower::Types
|
|
111
144
|
end
|
112
145
|
|
113
146
|
class CurrentSummationDelivered < Notification
|
147
|
+
|
148
|
+
attr_accessor :raw_delivered
|
149
|
+
attr_accessor :raw_received
|
150
|
+
attr_accessor :multiplier
|
151
|
+
attr_accessor :divisor
|
152
|
+
attr_accessor :digits_right
|
153
|
+
attr_accessor :digits_left
|
154
|
+
attr_accessor :suppress_leading_zeroes
|
155
|
+
|
156
|
+
def build(hash)
|
157
|
+
|
158
|
+
self.raw_delivered = parse_hex('SummationDelivered')
|
159
|
+
self.raw_received = parse_hex('SummationReceived')
|
160
|
+
self.multiplier = parse_hex('Multiplier')
|
161
|
+
self.divisor = parse_hex('Divisor')
|
162
|
+
self.digits_right = parse_hex('DigitsRight')
|
163
|
+
self.digits_left = parse_hex('DigitsLeft')
|
164
|
+
self.suppress_leading_zeroes = parse_bool('SuppressLeadingZero')
|
165
|
+
|
166
|
+
end
|
167
|
+
|
168
|
+
def delivered
|
169
|
+
return 0 if self.raw_delivered == 0
|
170
|
+
return nil if self.multiplier.nil? || self.raw_delivered.nil? || self.divisor.nil?
|
171
|
+
return self.multiplier * self.raw_delivered / Float(self.divisor)
|
172
|
+
end
|
173
|
+
|
174
|
+
def received
|
175
|
+
return 0 if self.divisor == 0
|
176
|
+
return nil if self.multiplier.nil? || self.raw_received.nil? || self.divisor.nil?
|
177
|
+
return self.multiplier * self.raw_received / Float(self.divisor)
|
178
|
+
end
|
179
|
+
|
114
180
|
end
|
115
181
|
|
182
|
+
# TODO
|
116
183
|
class CurrentPeriodUsage < Notification
|
117
184
|
end
|
118
185
|
|
186
|
+
# TODO
|
119
187
|
class LastPeriodUsage < Notification
|
120
188
|
end
|
121
189
|
|
190
|
+
# TODO
|
122
191
|
class ProfileData < Notification
|
123
192
|
end
|
124
193
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: emu_power
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Bertolucci
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|