Floppy-currentcostd 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -52,6 +52,7 @@ module CurrentCostDaemon
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def update(reading)
|
55
|
+
return if reading.total_watts == 0
|
55
56
|
# Let's put data into AMEE every minute.
|
56
57
|
if Time.now.min != @last_minute
|
57
58
|
# Store time
|
@@ -62,12 +63,12 @@ module CurrentCostDaemon
|
|
62
63
|
raise "No Data Item UID found!" if @uid.nil?
|
63
64
|
options = {
|
64
65
|
:dataItemUid => @uid,
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
66
|
+
:startDate => Time.now.xmlschema,
|
67
|
+
:endDate => (Time.now + 60).xmlschema,
|
68
|
+
:energyConsumption => kwh,
|
69
|
+
:energyConsumptionUnit => "kWh",
|
70
|
+
:energyConsumptionPerUnit => "h",
|
71
|
+
:name => "currentcost"
|
71
72
|
}
|
72
73
|
puts "Storing in AMEE..."
|
73
74
|
# Post data to AMEE
|
@@ -35,7 +35,11 @@ module CurrentCostDaemon
|
|
35
35
|
|
36
36
|
def update(reading)
|
37
37
|
# Print out measurement
|
38
|
-
|
38
|
+
if reading.total_watts > 0
|
39
|
+
puts "New reading received: #{reading.total_watts} W"
|
40
|
+
else
|
41
|
+
puts "0 reading received: probably history data"
|
42
|
+
end
|
39
43
|
rescue
|
40
44
|
puts "Something went wrong (debug)!"
|
41
45
|
puts $!.inspect
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Floppy-currentcostd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Smith
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-24 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|