Skip to content

Commit a9f3f61

Browse files
cschlipfnaltatis
andauthored
Doc: PV Forecast provider examples use list syntax. (#772)
Co-authored-by: Michael Geers <michael@geers.tv>
1 parent 03002a6 commit a9f3f61

File tree

3 files changed

+114
-100
lines changed

3 files changed

+114
-100
lines changed

docs/tariffs.mdx

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -650,24 +650,24 @@ Daher musst du ggf. das Update-Intervall (`interval`) erhöhen.
650650

651651
<DeviceConfig code={`tariffs:
652652
solar:
653-
type: template
654-
template: forecast-solar
655-
lat: 55.7351
656-
lon: 9.1275
657-
dec: 25 # 0 = horizontal, 90 = vertikal
658-
kwp: 9.8
659-
az: 180 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden`} advanced={`tariffs:
653+
- type: template
654+
template: forecast-solar
655+
lat: 55.7351
656+
lon: 9.1275
657+
dec: 25 # 0 = horizontal, 90 = vertikal
658+
kwp: 9.8
659+
az: 180 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden`} advanced={`tariffs:
660660
solar:
661-
type: template
662-
template: forecast-solar
663-
lat: 55.7351
664-
lon: 9.1275
665-
dec: 25 # 0 = horizontal, 90 = vertikal
666-
kwp: 9.8
667-
az: 180 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden
668-
horizon: '0,0,15,30,45,60,60,60,45,30,15,0' # Simuliert Verschattung durch Gelände, [mehr Informationen](https://doc.forecast.solar/horizon) (optional)
669-
apikey: # optional
670-
interval: 1h # optional`} />
661+
- type: template
662+
template: forecast-solar
663+
lat: 55.7351
664+
lon: 9.1275
665+
dec: 25 # 0 = horizontal, 90 = vertikal
666+
kwp: 9.8
667+
az: 180 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden
668+
horizon: '0,0,15,30,45,60,60,60,45,30,15,0' # Simuliert Verschattung durch Gelände, [mehr Informationen](https://doc.forecast.solar/horizon) (optional)
669+
apikey: # optional
670+
interval: 1h # optional`} />
671671

672672

673673

@@ -681,28 +681,28 @@ Freie Wetter API [open-meteo.com](https://open-meteo.com) Open-Meteo ist eine Op
681681

682682
<DeviceConfig code={`tariffs:
683683
solar:
684-
type: template
685-
template: open-meteo
686-
lat: 55.7351
687-
lon: 9.1275
688-
dec: 25 # 0 = horizontal, 90 = vertikal
689-
kwp: 9.8
690-
az: 0 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden`} advanced={`tariffs:
684+
- type: template
685+
template: open-meteo
686+
lat: 55.7351
687+
lon: 9.1275
688+
dec: 25 # 0 = horizontal, 90 = vertikal
689+
kwp: 9.8
690+
az: 0 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden`} advanced={`tariffs:
691691
solar:
692-
type: template
693-
template: open-meteo
694-
lat: 55.7351
695-
lon: 9.1275
696-
dec: 25 # 0 = horizontal, 90 = vertikal
697-
kwp: 9.8
698-
az: 0 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden
699-
ac: 1000 # optional
700-
dm: 0 # optional
701-
de: 0 # optional
702-
efficiency: 100 # optional
703-
alphatemp: -0.004 # optional
704-
rossmodel: 0.0342 # Gut Gekühlt (0.0200), Freistehend (0.0208), Flach auf Dach (0.0260), Nicht So Gut Gekühlt (0.0342), Transparentes PV (0.0455), Fassadenintegriert (0.0538), Auf Schrägdach (0.0563) [Paper](https://www.sciencedirect.com/science/article/pii/S0038092X20309107) (optional)
705-
interval: 1h # optional`} />
692+
- type: template
693+
template: open-meteo
694+
lat: 55.7351
695+
lon: 9.1275
696+
dec: 25 # 0 = horizontal, 90 = vertikal
697+
kwp: 9.8
698+
az: 0 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden
699+
ac: 1000 # optional
700+
dm: 0 # optional
701+
de: 0 # optional
702+
efficiency: 100 # optional
703+
alphatemp: -0.004 # optional
704+
rossmodel: 0.0342 # Gut Gekühlt (0.0200), Freistehend (0.0208), Flach auf Dach (0.0260), Nicht So Gut Gekühlt (0.0342), Transparentes PV (0.0455), Fassadenintegriert (0.0538), Auf Schrägdach (0.0563) [Paper](https://www.sciencedirect.com/science/article/pii/S0038092X20309107) (optional)
705+
interval: 1h # optional`} />
706706

707707

708708

@@ -716,16 +716,16 @@ Benötigt einen [solcast.com](https://solcast.com/free-rooftop-solar-forecasting
716716

717717
<DeviceConfig code={`tariffs:
718718
solar:
719-
type: template
720-
template: solcast
721-
site: # Ressource ID deiner Anlage
722-
token: # Solcast API Token`} advanced={`tariffs:
719+
- type: template
720+
template: solcast
721+
site: # Ressource ID deiner Anlage
722+
token: # Solcast API Token`} advanced={`tariffs:
723723
solar:
724-
type: template
725-
template: solcast
726-
site: # Ressource ID deiner Anlage
727-
token: # Solcast API Token
728-
interval: 3h # optional`} />
724+
- type: template
725+
template: solcast
726+
site: # Ressource ID deiner Anlage
727+
token: # Solcast API Token
728+
interval: 3h # optional`} />
729729

730730

731731

i18n/en/docusaurus-plugin-content-docs/current/tariffs.mdx

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -658,24 +658,24 @@ Therefore, you may need to increase the update `interval`.
658658

659659
<DeviceConfig code={`tariffs:
660660
solar:
661-
type: template
662-
template: forecast-solar
663-
lat: 55.7351
664-
lon: 9.1275
665-
dec: 25 # 0 = horizontal, 90 = vertical
666-
kwp: 9.8
667-
az: 180 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north`} advanced={`tariffs:
661+
- type: template
662+
template: forecast-solar
663+
lat: 55.7351
664+
lon: 9.1275
665+
dec: 25 # 0 = horizontal, 90 = vertical
666+
kwp: 9.8
667+
az: 180 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north`} advanced={`tariffs:
668668
solar:
669-
type: template
670-
template: forecast-solar
671-
lat: 55.7351
672-
lon: 9.1275
673-
dec: 25 # 0 = horizontal, 90 = vertical
674-
kwp: 9.8
675-
az: 180 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north
676-
horizon: '0,0,15,30,45,60,60,60,45,30,15,0' # Simulates terrain shadows, [more information](https://doc.forecast.solar/horizon) (optional)
677-
apikey: # optional
678-
interval: 1h # optional`} />
669+
- type: template
670+
template: forecast-solar
671+
lat: 55.7351
672+
lon: 9.1275
673+
dec: 25 # 0 = horizontal, 90 = vertical
674+
kwp: 9.8
675+
az: 180 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north
676+
horizon: '0,0,15,30,45,60,60,60,45,30,15,0' # Simulates terrain shadows, [more information](https://doc.forecast.solar/horizon) (optional)
677+
apikey: # optional
678+
interval: 1h # optional`} />
679679

680680

681681

@@ -689,28 +689,28 @@ Free Weather API [open-meteo.com](https://open-meteo.com) Open-Meteo is an open-
689689

690690
<DeviceConfig code={`tariffs:
691691
solar:
692-
type: template
693-
template: open-meteo
694-
lat: 55.7351
695-
lon: 9.1275
696-
dec: 25 # 0 = horizontal, 90 = vertical
697-
kwp: 9.8
698-
az: 0 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north`} advanced={`tariffs:
692+
- type: template
693+
template: open-meteo
694+
lat: 55.7351
695+
lon: 9.1275
696+
dec: 25 # 0 = horizontal, 90 = vertical
697+
kwp: 9.8
698+
az: 0 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north`} advanced={`tariffs:
699699
solar:
700-
type: template
701-
template: open-meteo
702-
lat: 55.7351
703-
lon: 9.1275
704-
dec: 25 # 0 = horizontal, 90 = vertical
705-
kwp: 9.8
706-
az: 0 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north
707-
ac: 1000 # optional
708-
dm: 0 # optional
709-
de: 0 # optional
710-
efficiency: 100 # optional
711-
alphatemp: -0.004 # optional
712-
rossmodel: 0.0342 # Well Cooled (0.0200), Free Standing (0.0208), Flat on Roof (0.0260), Not So Well Cooled (0.0342), Transparent PV (0.0455), Facade Integrated (0.0538), On Sloped Roof (0.0563) [Paper](https://www.sciencedirect.com/science/article/pii/S0038092X20309107) (optional)
713-
interval: 1h # optional`} />
700+
- type: template
701+
template: open-meteo
702+
lat: 55.7351
703+
lon: 9.1275
704+
dec: 25 # 0 = horizontal, 90 = vertical
705+
kwp: 9.8
706+
az: 0 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north
707+
ac: 1000 # optional
708+
dm: 0 # optional
709+
de: 0 # optional
710+
efficiency: 100 # optional
711+
alphatemp: -0.004 # optional
712+
rossmodel: 0.0342 # Well Cooled (0.0200), Free Standing (0.0208), Flat on Roof (0.0260), Not So Well Cooled (0.0342), Transparent PV (0.0455), Facade Integrated (0.0538), On Sloped Roof (0.0563) [Paper](https://www.sciencedirect.com/science/article/pii/S0038092X20309107) (optional)
713+
interval: 1h # optional`} />
714714

715715

716716

@@ -724,16 +724,16 @@ Requires a [solcast.com](https://solcast.com/free-rooftop-solar-forecasting) acc
724724

725725
<DeviceConfig code={`tariffs:
726726
solar:
727-
type: template
728-
template: solcast
729-
site: # ressource ID of your site
730-
token: # Solcast API Token`} advanced={`tariffs:
727+
- type: template
728+
template: solcast
729+
site: # ressource ID of your site
730+
token: # Solcast API Token`} advanced={`tariffs:
731731
solar:
732-
type: template
733-
template: solcast
734-
site: # ressource ID of your site
735-
token: # Solcast API Token
736-
interval: 3h # optional`} />
732+
- type: template
733+
template: solcast
734+
site: # ressource ID of your site
735+
token: # Solcast API Token
736+
interval: 3h # optional`} />
737737

738738

739739

src/generateFromTemplate.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,25 +97,39 @@ function readTemplates(path) {
9797
.map((file) => yaml.load(fs.readFileSync(`${path}/${file}`, "utf8")));
9898
}
9999

100-
function indent(code) {
100+
function indent(code, list = false) {
101101
// escape backticks
102-
result = code.replace(/`/g, "\\`");
103-
// indent
104-
return result.replace(/^/gm, " ");
102+
let result = code.replace(/`/g, "\\`");
103+
104+
if (list) {
105+
// indent first line with 6 spaces and dash
106+
result = result.replace(/^/, " - ");
107+
// indent remaining lines 8 spaces
108+
return result.replace(/\n/gm, "\n ");
109+
} else {
110+
// indent all lines 6 spaces
111+
result = result.replace(/^/gm, " ");
112+
}
113+
114+
return result;
105115
}
106116

107117
function templateContent(entry, type, translate) {
108118
const description = entry.description ? entry.description + "\n" : "";
109119

110120
const codeBlocks = entry.render.map((render) => {
111121
let preamble = render.usage || type;
122+
let list = false;
112123
if (type === "tariff") {
113124
preamble = TARIFF_GROUPS[entry.product.group];
125+
if (preamble === "solar") {
126+
list = true;
127+
}
114128
}
115-
const code = `${CODE_PREAMBLES[preamble]}\n${indent(render.default).trimEnd()}`;
129+
const code = `${CODE_PREAMBLES[preamble]}\n${indent(render.default, list).trimEnd()}`;
116130
const advanced =
117131
render.advanced && render.advanced !== render.default
118-
? `${CODE_PREAMBLES[preamble]}\n${indent(render.advanced).trimEnd()}`
132+
? `${CODE_PREAMBLES[preamble]}\n${indent(render.advanced, list).trimEnd()}`
119133
: null;
120134
return {
121135
usage: render.usage,

0 commit comments

Comments
 (0)