Skip to content

Commit

Permalink
chore: simplify rendering docs and eebus
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Apr 1, 2023
1 parent c5040d2 commit 83b79ab
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 32 deletions.
5 changes: 3 additions & 2 deletions templates/definition/charger/eebus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ capabilities: ["mA"]
requirements:
evcc: ["eebus"]
params:
- preset: eebus-meter
- preset: eebus
render: |
{{ include "eebus-meter" . }}
{{ include "eebus" . }}
meter: true
4 changes: 2 additions & 2 deletions templates/definition/charger/elli-charger-connect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ requirements:
The support is in beta state and problems can occur!
params:
- preset: eebus-no-meter
- preset: eebus
- name: ip
required: true
render: |
{{ include "eebus-no-meter" . }}
{{ include "eebus" . }}
5 changes: 3 additions & 2 deletions templates/definition/charger/elli-charger-pro.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ requirements:
The support is in beta state and problems can occur!
params:
- preset: eebus-meter
- preset: eebus
- name: ip
required: true
render: |
{{ include "eebus-meter" . }}
{{ include "eebus" . }}
meter: true
chargedEnergy: false
5 changes: 3 additions & 2 deletions templates/definition/charger/porsche-pmcc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ capabilities: ["iso151182", "mA"]
requirements:
evcc: ["eebus"]
params:
- preset: eebus-meter
- preset: eebus
render: |
{{ include "eebus-meter" . }}
{{ include "eebus" . }}
meter: true
5 changes: 3 additions & 2 deletions templates/definition/charger/porsche-pmcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ products:
requirements:
evcc: ["eebus"]
params:
- preset: eebus-meter
- preset: eebus
render: |
{{ include "eebus-meter" . }}
{{ include "eebus" . }}
meter: true
6 changes: 1 addition & 5 deletions util/templates/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,7 @@ presets:
vehicle-language:
params:
- name: language
eebus-meter:
params:
- name: ski
- name: ip
eebus-no-meter:
eebus:
params:
- name: ski
- name: ip
Expand Down
9 changes: 4 additions & 5 deletions util/templates/documentation.tpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{- define "param" }}
{{ .Name }}:
{{- if .Value }} {{ .Value }} {{- end }}
{{ .Name }}:{{ if .Value }} {{ .Value }}{{ end }}
{{- range .Values }}
- {{ . }}
{{- end }}
Expand All @@ -9,7 +8,7 @@

{{- define "header" }}
type: template
template: {{ $.Template }}
template: {{ .Template }}
{{- if hasKey . "Usage" }}
usage: {{ .Usage }}
{{- end }}
Expand All @@ -18,7 +17,7 @@
{{- define "default" }}
{{- include "header" . }}
{{- $usage := "" }}{{ if hasKey . "Usage" }}{{ $usage = .Usage }}{{ end }}
{{- range $.Params }}
{{- range .Params }}
{{- if eq .Name "modbus" }}
{{- $.Modbus | indent 2 }}
{{- else if and (not .IsAdvanced) (or (not $usage) (not .Usages) (has $usage .Usages)) }}
Expand All @@ -30,7 +29,7 @@
{{- define "advanced" }}
{{- include "header" . }}
{{- $usage := "" }}{{ if hasKey . "Usage" }}{{ $usage = .Usage }}{{ end }}
{{- range $.Params }}
{{- range .Params }}
{{- if eq .Name "modbus" }}
{{- $.Modbus | indent 2 }}
{{- else if or (not $usage) (not .Usages) (has $usage .Usages) }}
Expand Down
4 changes: 2 additions & 2 deletions util/templates/documentation_modbus.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ id: {{ .id }}
device: {{ .device }} # USB-RS485 Adapter Adresse
baudrate: {{ .baudrate }} # Prüfe die Geräteeinstellungen, typische Werte sind 9600, 19200, 38400, 57600, 115200
comset: "{{ .comset }}" # Kommunikationsparameter für den Adapter
{{- end -}}
{{- end }}
{{- if .rs485tcpip }}

# RS485 via TCP/IP (Modbus RTU)
modbus: rs485tcpip
id: {{ .id }}
host: {{ .host }} # Hostname
port: {{ .port }} # Port
{{- end -}}
{{- end }}
{{- if .tcpip }}

# Modbus TCP
Expand Down
6 changes: 0 additions & 6 deletions util/templates/includes/eebus-meter.tpl

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ define "eebus-no-meter" }}
{{ define "eebus" }}
type: eebus
ski: {{ .ski }}
{{ if .ip }}ip: {{ .ip }}{{ end }}
Expand Down
2 changes: 1 addition & 1 deletion util/templates/includes/switchsocket.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ define "switchsocket" }}
standbypower: {{ .standbypower }}
{{ if eq .integrateddevice "true" }}features: ["integrateddevice"]{{ end }}
{{ if .integrateddevice }}features: ["integrateddevice"]{{ end }}
{{ if .icon }}icon: {{ .icon }}{{ end }}
{{ end -}}
4 changes: 2 additions & 2 deletions util/templates/includes/vehicle-identify.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ onIdentify:
{{- end }}
{{- if len .identifiers }}
identifiers:
{{- range .identifiers }}
{{- range .identifiers }}
- {{ . }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

0 comments on commit 83b79ab

Please sign in to comment.