Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 47 additions & 47 deletions docs/tariffs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -650,24 +650,24 @@ Daher musst du ggf. das Update-Intervall (`interval`) erhöhen.

<DeviceConfig code={`tariffs:
solar:
type: template
template: forecast-solar
lat: 55.7351
lon: 9.1275
dec: 25 # 0 = horizontal, 90 = vertikal
kwp: 9.8
az: 180 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden`} advanced={`tariffs:
- type: template
template: forecast-solar
lat: 55.7351
lon: 9.1275
dec: 25 # 0 = horizontal, 90 = vertikal
kwp: 9.8
az: 180 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden`} advanced={`tariffs:
solar:
type: template
template: forecast-solar
lat: 55.7351
lon: 9.1275
dec: 25 # 0 = horizontal, 90 = vertikal
kwp: 9.8
az: 180 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden
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)
apikey: # optional
interval: 1h # optional`} />
- type: template
template: forecast-solar
lat: 55.7351
lon: 9.1275
dec: 25 # 0 = horizontal, 90 = vertikal
kwp: 9.8
az: 180 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden
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)
apikey: # optional
interval: 1h # optional`} />



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

<DeviceConfig code={`tariffs:
solar:
type: template
template: open-meteo
lat: 55.7351
lon: 9.1275
dec: 25 # 0 = horizontal, 90 = vertikal
kwp: 9.8
az: 0 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden`} advanced={`tariffs:
- type: template
template: open-meteo
lat: 55.7351
lon: 9.1275
dec: 25 # 0 = horizontal, 90 = vertikal
kwp: 9.8
az: 0 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden`} advanced={`tariffs:
solar:
type: template
template: open-meteo
lat: 55.7351
lon: 9.1275
dec: 25 # 0 = horizontal, 90 = vertikal
kwp: 9.8
az: 0 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden
ac: 1000 # optional
dm: 0 # optional
de: 0 # optional
efficiency: 100 # optional
alphatemp: -0.004 # optional
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)
interval: 1h # optional`} />
- type: template
template: open-meteo
lat: 55.7351
lon: 9.1275
dec: 25 # 0 = horizontal, 90 = vertikal
kwp: 9.8
az: 0 # -180 = Norden, -90 = Osten, 0 = Süden, 90 = Westen, 180 = Norden
ac: 1000 # optional
dm: 0 # optional
de: 0 # optional
efficiency: 100 # optional
alphatemp: -0.004 # optional
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)
interval: 1h # optional`} />



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

<DeviceConfig code={`tariffs:
solar:
type: template
template: solcast
site: # Ressource ID deiner Anlage
token: # Solcast API Token`} advanced={`tariffs:
- type: template
template: solcast
site: # Ressource ID deiner Anlage
token: # Solcast API Token`} advanced={`tariffs:
solar:
type: template
template: solcast
site: # Ressource ID deiner Anlage
token: # Solcast API Token
interval: 3h # optional`} />
- type: template
template: solcast
site: # Ressource ID deiner Anlage
token: # Solcast API Token
interval: 3h # optional`} />



94 changes: 47 additions & 47 deletions i18n/en/docusaurus-plugin-content-docs/current/tariffs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -658,24 +658,24 @@ Therefore, you may need to increase the update `interval`.

<DeviceConfig code={`tariffs:
solar:
type: template
template: forecast-solar
lat: 55.7351
lon: 9.1275
dec: 25 # 0 = horizontal, 90 = vertical
kwp: 9.8
az: 180 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north`} advanced={`tariffs:
- type: template
template: forecast-solar
lat: 55.7351
lon: 9.1275
dec: 25 # 0 = horizontal, 90 = vertical
kwp: 9.8
az: 180 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north`} advanced={`tariffs:
solar:
type: template
template: forecast-solar
lat: 55.7351
lon: 9.1275
dec: 25 # 0 = horizontal, 90 = vertical
kwp: 9.8
az: 180 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north
horizon: '0,0,15,30,45,60,60,60,45,30,15,0' # Simulates terrain shadows, [more information](https://doc.forecast.solar/horizon) (optional)
apikey: # optional
interval: 1h # optional`} />
- type: template
template: forecast-solar
lat: 55.7351
lon: 9.1275
dec: 25 # 0 = horizontal, 90 = vertical
kwp: 9.8
az: 180 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north
horizon: '0,0,15,30,45,60,60,60,45,30,15,0' # Simulates terrain shadows, [more information](https://doc.forecast.solar/horizon) (optional)
apikey: # optional
interval: 1h # optional`} />



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

<DeviceConfig code={`tariffs:
solar:
type: template
template: open-meteo
lat: 55.7351
lon: 9.1275
dec: 25 # 0 = horizontal, 90 = vertical
kwp: 9.8
az: 0 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north`} advanced={`tariffs:
- type: template
template: open-meteo
lat: 55.7351
lon: 9.1275
dec: 25 # 0 = horizontal, 90 = vertical
kwp: 9.8
az: 0 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north`} advanced={`tariffs:
solar:
type: template
template: open-meteo
lat: 55.7351
lon: 9.1275
dec: 25 # 0 = horizontal, 90 = vertical
kwp: 9.8
az: 0 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north
ac: 1000 # optional
dm: 0 # optional
de: 0 # optional
efficiency: 100 # optional
alphatemp: -0.004 # optional
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)
interval: 1h # optional`} />
- type: template
template: open-meteo
lat: 55.7351
lon: 9.1275
dec: 25 # 0 = horizontal, 90 = vertical
kwp: 9.8
az: 0 # -180 = north, -90 = east, 0 = south, 90 = west, 180 = north
ac: 1000 # optional
dm: 0 # optional
de: 0 # optional
efficiency: 100 # optional
alphatemp: -0.004 # optional
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)
interval: 1h # optional`} />



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

<DeviceConfig code={`tariffs:
solar:
type: template
template: solcast
site: # ressource ID of your site
token: # Solcast API Token`} advanced={`tariffs:
- type: template
template: solcast
site: # ressource ID of your site
token: # Solcast API Token`} advanced={`tariffs:
solar:
type: template
template: solcast
site: # ressource ID of your site
token: # Solcast API Token
interval: 3h # optional`} />
- type: template
template: solcast
site: # ressource ID of your site
token: # Solcast API Token
interval: 3h # optional`} />



26 changes: 20 additions & 6 deletions src/generateFromTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,25 +97,39 @@ function readTemplates(path) {
.map((file) => yaml.load(fs.readFileSync(`${path}/${file}`, "utf8")));
}

function indent(code) {
function indent(code, list = false) {
// escape backticks
result = code.replace(/`/g, "\\`");
// indent
return result.replace(/^/gm, " ");
let result = code.replace(/`/g, "\\`");

if (list) {
// indent first line with 6 spaces and dash
result = result.replace(/^/, " - ");
// indent remaining lines 8 spaces
return result.replace(/\n/gm, "\n ");
} else {
// indent all lines 6 spaces
result = result.replace(/^/gm, " ");
}

return result;
}

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

const codeBlocks = entry.render.map((render) => {
let preamble = render.usage || type;
let list = false;
if (type === "tariff") {
preamble = TARIFF_GROUPS[entry.product.group];
if (preamble === "solar") {
list = true;
}
}
const code = `${CODE_PREAMBLES[preamble]}\n${indent(render.default).trimEnd()}`;
const code = `${CODE_PREAMBLES[preamble]}\n${indent(render.default, list).trimEnd()}`;
const advanced =
render.advanced && render.advanced !== render.default
? `${CODE_PREAMBLES[preamble]}\n${indent(render.advanced).trimEnd()}`
? `${CODE_PREAMBLES[preamble]}\n${indent(render.advanced, list).trimEnd()}`
: null;
return {
usage: render.usage,
Expand Down