Skip to content

Commit

Permalink
Graphs are limited to maximum power (max)
Browse files Browse the repository at this point in the history
  • Loading branch information
klein0r committed Sep 16, 2023
1 parent 321bf8c commit ef7000f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ Provides forecast data from [forecast.solar](https://forecast.solar), [Solcast](
Placeholder for the next version (at the beginning of the line):
### **WORK IN PROGRESS**
-->
### **WORK IN PROGRESS**
* (klein0r) Graphs are limited to maximum power (max)
* (klein0r) Installed power is Wp or kWp (as configured)

### 2.7.1 (2023-05-10)
* (klein0r) Summary channel should not be deleted

Expand Down
22 changes: 11 additions & 11 deletions admin/jsonConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -314,17 +314,17 @@
"attr": "peakpower",
"width": "20%",
"title": {
"en": "Peak power",
"de": "Spitzenleistung",
"ru": "Пик власть",
"pt": "Potência de pico",
"nl": "Peak",
"fr": "Puissance nominale",
"it": "Potenza massima",
"es": "Potencia de pico",
"pl": "Peak power",
"uk": "Потужність Піка",
"zh-cn": "佩克权力"
"en": "Peak power (kW)",
"de": "Spitzenleistung (kW)",
"ru": "Пик власть (kW)",
"pt": "Potência de pico (kW)",
"nl": "Peak (kW)",
"fr": "Puissance nominale (kW)",
"it": "Potenza massima (kW)",
"es": "Potencia de pico (kW)",
"pl": "Peak power (kW)",
"uk": "Потужність Піка (kW)",
"zh-cn": "佩克权力 (kW)"
},
"filter": false,
"sort": false,
Expand Down
16 changes: 14 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,13 @@ class Pvforecast extends utils.Adapter {
.pop() || 0;

totalPowerNow += powerNow;
totalPowerInstalled += plant.peakpower;
totalPowerInstalled += this.config.watt_kw ? plant.peakpower * 1000 : plant.peakpower;
totalEnergyNow += energyNow;
totalEnergyToday += energyToday;
totalEnergyTomorrow += energyTomorrow;

await this.setStateChangedAsync(`plants.${cleanPlantId}.power.now`, { val: Number(powerNow / globalunit), ack: true });
await this.setStateChangedAsync(`plants.${cleanPlantId}.power.installed`, { val: plant.peakpower, ack: true });
await this.setStateChangedAsync(`plants.${cleanPlantId}.power.installed`, { val: this.config.watt_kw ? plant.peakpower * 1000 : plant.peakpower, ack: true });
await this.setStateChangedAsync(`plants.${cleanPlantId}.energy.now`, { val: Number(energyNow / globalunit), ack: true });
await this.setStateChangedAsync(`plants.${cleanPlantId}.energy.today`, { val: Number(energyToday / globalunit), ack: true });
await this.setStateChangedAsync(`plants.${cleanPlantId}.energy.tomorrow`, { val: Number(energyTomorrow / globalunit), ack: true });
Expand Down Expand Up @@ -475,6 +475,7 @@ class Pvforecast extends utils.Adapter {
yAxis_show: true,
yAxis_appendix: this.config.watt_kw ? 'W' : 'kW',
yAxis_step: this.config.chartingAxisStepY,
yAxis_max: this.config.watt_kw ? plant.peakpower * 1000 : plant.peakpower,
};

jsonGraphSummary.push(jsonGraph);
Expand Down Expand Up @@ -560,6 +561,7 @@ class Pvforecast extends utils.Adapter {
yAxis_show: true,
yAxis_appendix: this.config.watt_kw ? 'W' : 'kW',
yAxis_step: this.config.chartingAxisStepY,
yAxis_max: totalPowerInstalled,
};

await this.setStateAsync('summary.JSONGraph', { val: JSON.stringify({ 'graphs': [jsonGraphSummaryTotal], 'axisLabels': jsonGraphLabelSummary }), ack: true });
Expand Down Expand Up @@ -1623,6 +1625,11 @@ class Pvforecast extends utils.Adapter {
unit: this.config.watt_kw ? 'Wh' : 'kWh'
}
});
await this.extendObjectAsync(`plants.${cleanPlantId}.power.installed`, {
common: {
unit: this.config.watt_kw ? 'Wp' : 'kWp'
}
});
await this.extendObjectAsync(`plants.${cleanPlantId}.energy.today`, {
common: {
unit: this.config.watt_kw ? 'Wh' : 'kWh'
Expand Down Expand Up @@ -1656,6 +1663,11 @@ class Pvforecast extends utils.Adapter {
unit: this.config.watt_kw ? 'W' : 'kW'
}
});
await this.extendObjectAsync('summary.power.installed', {
common: {
unit: this.config.watt_kw ? 'Wp' : 'kWp'
}
});
await this.extendObjectAsync('summary.energy.now', {
common: {
unit: this.config.watt_kw ? 'Wh' : 'kWh'
Expand Down

0 comments on commit ef7000f

Please sign in to comment.