Skip to content

Commit ff4ca5a

Browse files
authored
Simplified to report 3+1 power inputs (3 x channels and current export).
1 parent 14e5492 commit ff4ca5a

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

emonowl.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,23 @@ owl.on('electricity', function( event ) {
4646
power1: data.channels['0'][0].current,
4747
power2: data.channels['1'][0].current,
4848
power3: data.channels['2'][0].current,
49-
day1: data.channels['0'][1].day,
50-
day2: data.channels['1'][1].day,
51-
day3: data.channels['2'][1].day
5249
}
5350
reportToEmon(nodes.electricity, packet);
5451
});
5552

5653
// Handle the solar event
5754
//
5855
// A simplified version of the electricity event with just the PV generation and
59-
// consumption data. Zero out negative day generated values (Network OWL bug).
56+
// consumption data, export reported as power4 input.
6057
owl.on('solar', function( event ) {
6158
data = JSON.parse(event);
6259
log( "solar = " + util.inspect(data, {"depth": null}) );
63-
if (data.day[0].generated < 0) {
64-
data.day[0].generated = 0
65-
}
6660
packet = {
6761
power2: data.current[0].generating,
68-
day2: data.day[0].generated,
62+
power4: data.current[1].exporting,
63+
}
64+
if (data.current[1].exporting > 0) {
65+
packet["power1"] = data.current[0].generating - data.current[1].exporting
6966
}
7067
reportToEmon(nodes.solar, packet);
7168
});

0 commit comments

Comments
 (0)