From 782db8f9f1a8f6278028725c93675a6e51da09b8 Mon Sep 17 00:00:00 2001 From: Michael Geers Date: Thu, 27 Mar 2025 09:23:58 +0100 Subject: [PATCH] docs: add choice (#20139) --- templates/definition/meter/sonnenbatterie.yaml | 4 ++-- util/templates/documentation.tpl | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/templates/definition/meter/sonnenbatterie.yaml b/templates/definition/meter/sonnenbatterie.yaml index b0322d5cf..00097d64a 100644 --- a/templates/definition/meter/sonnenbatterie.yaml +++ b/templates/definition/meter/sonnenbatterie.yaml @@ -36,8 +36,8 @@ params: default: self-consumption advanced: true help: - de: Standardmodus für die aktive Batteriesteuerung (self-consumption oder time-of-use) - en: Default mode for active battery control (self-consumption or time-of-use) + de: Standardmodus für die aktive Batteriesteuerung + en: Default mode for active battery control usages: ["battery"] - name: chargepower default: 3300 diff --git a/util/templates/documentation.tpl b/util/templates/documentation.tpl index a9a1e51b6..74a0af840 100644 --- a/util/templates/documentation.tpl +++ b/util/templates/documentation.tpl @@ -4,7 +4,14 @@ - {{ . }} {{- end }} {{- $help := localize .Help | replace "\n" " " -}} - {{- if $help }} # {{ $help }}{{- end }}{{- if not .IsRequired }}{{ if not $help }} # {{ else }} ({{ end }}optional{{ if $help }}){{ end }}{{ end }} + {{- $choices := join ", " .Choice -}} + {{- $optional := not .IsRequired -}} + {{- if or $help $choices $optional }} # {{end}} + {{- if $help }}{{ $help }} {{end}} + {{- if $choices }}[{{ $choices }}] {{end}} + {{- if $optional }} + {{- if or $help $choices }}(optional){{ else }}optional{{end }} + {{- end }} {{- end }} {{- define "header" }}