diff options
Diffstat (limited to '')
-rw-r--r-- | node.d/fronius.node.js | 11 | ||||
-rw-r--r-- | node.d/stiebeleltron.node.js | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/node.d/fronius.node.js b/node.d/fronius.node.js index 7aa2c13b7..fc49e5d38 100644 --- a/node.d/fronius.node.js +++ b/node.d/fronius.node.js @@ -24,6 +24,7 @@ var fronius = { consumptionLoadId: "p_load", autonomyId: "rel_autonomy", consumptionSelfId: "rel_selfconsumption", + solarConsumptionId: "solar_consumption", energyTodayId: "e_day", energyYearId: "e_year", @@ -101,6 +102,7 @@ var fronius = { var dim = {}; dim[fronius.autonomyId] = this.createBasicDimension(fronius.autonomyId, "autonomy", 1); dim[fronius.consumptionSelfId] = this.createBasicDimension(fronius.consumptionSelfId, "self_consumption", 1); + dim[fronius.solarConsumptionId] = this.createBasicDimension(fronius.solarConsumptionId, "solar_consumption", 1); chart = { id: id, // the unique id of the chart @@ -255,10 +257,17 @@ var fronius = { parseAutonomyChart: function (service, site) { var selfConsumption = site.rel_SelfConsumption; + var solarConsumption = 0; + var load = Math.abs(site.P_Load); + var power = Math.max(site.P_PV, 0); + if (power <= 0) solarConsumption = 0; + else if (load >= power) solarConsumption = 100; + else solarConsumption = 100 / power * load; return this.getChart(this.getSiteAutonomyChart(service, "autonomy"), [ this.getDimension(this.autonomyId, Math.round(site.rel_Autonomy)), - this.getDimension(this.consumptionSelfId, Math.round(selfConsumption === null ? 100 : selfConsumption)) + this.getDimension(this.consumptionSelfId, Math.round(selfConsumption === null ? 100 : selfConsumption)), + this.getDimension(this.solarConsumptionId, Math.round(solarConsumption)) ] ); }, diff --git a/node.d/stiebeleltron.node.js b/node.d/stiebeleltron.node.js index b0eb0aba7..77317f2fb 100644 --- a/node.d/stiebeleltron.node.js +++ b/node.d/stiebeleltron.node.js @@ -116,7 +116,7 @@ var stiebeleltron = { title: chartDefinition.title, units: chartDefinition.unit, family: context.category.name, - context: 'stiebeleltron.' + context.page.id + "." + context.category.id, + context: 'stiebeleltron.' + context.category.id + '.' + chartDefinition.id, type: chartDefinition.type, priority: stiebeleltron.base_priority + chartDefinition.prio,// the priority relative to others in the same family update_every: service.update_every, // the expected update frequency of the chart |