@cryptotaxi247 / netdata-1 / commits / 45a8c0707

Removing const's because of strict mode.

BrainDoctor committed Jul 5, 2017 at 21:01 UTC 45a8c0707bb7d43c9f7c257216ba9fce34993931
1 file changed +19 -19
node.d/fronius.node.js
+19 -19
@@ -11,13 +11,6 @@ var netdata = require('netdata');
11
12 netdata.debug('loaded ' + __filename + ' plugin');
13
14 -const powerGridId = 'p_grid';
15 -const powerPvId = 'p_pv';
16 -const powerAccuId = 'p_akku'; // not my typo! Using the ID from the API
17 -const consumptionLoadId = 'p_load';
18 -const autonomyId = 'rel_autonomy';
19 -const consumptionSelfId = 'rel_selfconsumption';
20 -
14 var fronius = {
15 name: "Fronius",
16 enable_autodetect: false,
@@ -25,6 +18,13 @@ var fronius = {
18 base_priority: 60000,
19 charts: {},
20
21 + powerGridId: "p_grid",
22 + powerPvId: 'p_pv',
23 + powerAccuId: 'p_akku', // not my typo! Using the ID from the AP
24 + consumptionLoadId: 'p_load',
25 + autonomyId: 'rel_autonomy',
26 + consumptionSelfId: 'rel_selfconsumption',
27 +
28 createBasicDimension(id, name) {
29 return {
30 id: id, // the unique id of the dimension
@@ -43,9 +43,9 @@ var fronius = {
43 if (fronius.isDefined(chart)) return chart;
44
45 var dim = {};
46 - dim[powerGridId] = this.createBasicDimension(powerGridId, "Grid");
47 - dim[powerPvId] = this.createBasicDimension(powerPvId, "Photovoltaics");
48 - dim[powerAccuId] = this.createBasicDimension(powerAccuId, "Accumulator");
46 + dim[fronius.powerGridId] = this.createBasicDimension(fronius.powerGridId, "Grid");
47 + dim[fronius.powerPvId] = this.createBasicDimension(fronius.powerPvId, "Photovoltaics");
48 + dim[fronius.powerAccuId] = this.createBasicDimension(fronius.powerAccuId, "Accumulator");
49
50 chart = {
51 id: id, // the unique id of the chart
@@ -71,7 +71,7 @@ var fronius = {
71 var chart = fronius.charts[id];
72 if (fronius.isDefined(chart)) return chart;
73 var dim = {};
74 - dim[consumptionLoadId] = this.createBasicDimension(consumptionLoadId, "Load");
74 + dim[fronius.consumptionLoadId] = this.createBasicDimension(fronius.consumptionLoadId, "Load");
75
76 chart = {
77 id: id, // the unique id of the chart
@@ -97,8 +97,8 @@ var fronius = {
97 var chart = fronius.charts[id];
98 if (fronius.isDefined(chart)) return chart;
99 var dim = {};
100 - dim[autonomyId] = this.createBasicDimension(autonomyId, "Autonomy");
101 - dim[consumptionSelfId] = this.createBasicDimension(consumptionSelfId, "Self Consumption");
100 + dim[fronius.autonomyId] = this.createBasicDimension(fronius.autonomyId, "Autonomy");
101 + dim[fronius.consumptionSelfId] = this.createBasicDimension(fronius.consumptionSelfId, "Self Consumption");
102
103 chart = {
104 id: id, // the unique id of the chart
@@ -220,9 +220,9 @@ var fronius = {
220
221 // Site Current Power Chart
222 service.begin(fronius.getSitePowerChart(service, 'fronius_' + service.name + '.power'));
223 - service.set(powerGridId, Math.round(site.P_Grid));
224 - service.set(powerPvId, Math.round(site.P_PV));
225 - service.set(powerAccuId, Math.round(site.P_Akku));
223 + service.set(fronius.powerGridId, Math.round(site.P_Grid));
224 + service.set(fronius.powerPvId, Math.round(site.P_PV));
225 + service.set(fronius.powerAccuId, Math.round(site.P_Akku));
226 service.end();
227
228 // Site Consumption Chart
@@ -231,13 +231,13 @@ var fronius = {
231 consumption *= -1;
232
233 service.begin(fronius.getSiteConsumptionChart(service, 'fronius_' + service.name + '.consumption'));
234 - service.set(consumptionLoadId, Math.round(consumption));
234 + service.set(fronius.consumptionLoadId, Math.round(consumption));
235 service.end();
236
237 // Site Autonomy Chart
238 service.begin(fronius.getSiteAutonomyChart(service, 'fronius_' + service.name + '.autonomy'));
239 - service.set(autonomyId, Math.round(site.rel_Autonomy));
240 - service.set(consumptionSelfId, Math.round(site.rel_SelfConsumption));
239 + service.set(fronius.autonomyId, Math.round(site.rel_Autonomy));
240 + service.set(fronius.consumptionSelfId, Math.round(site.rel_SelfConsumption));
241 service.end();
242
243 // Inverters