Skip to content

Commit

Permalink
chore: simplify templates (#8304)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored and naltatis committed Jun 14, 2023
1 parent 069c32d commit 3951e6d
Show file tree
Hide file tree
Showing 48 changed files with 88 additions and 76 deletions.
8 changes: 4 additions & 4 deletions templates/definition/charger/homematic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ render: |
type: homematic
uri: {{ .host }}:{{ .port }}
device: {{ .device }}
{{ if ne .user "" }}
{{- if .user }}
user: {{ .user }}
{{ end }}
{{ if ne .password "" }}
{{- end }}
{{- if .password }}
password: {{ .password }}
{{ end }}
{{- end }}
meterchannel: {{ .meterchannel }}
switchchannel: {{ .switchchannel }}
{{ include "switchsocket" . }}
8 changes: 4 additions & 4 deletions templates/definition/charger/keba-udp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ params:
render: |
type: keba-udp
uri: {{ .host }}
{{ if ne .rfid "" }}
{{- if .rfid }}
rfid:
tag: {{ .rfid }}
{{ end }}
{{ if ne .serial "" }}
{{- end }}
{{- if .serial }}
serial: {{ .serial }}
{{ end }}
{{- end }}
8 changes: 6 additions & 2 deletions templates/definition/charger/shelly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ params:
render: |
type: shelly
uri: http://{{ .host }}
{{ if ne .user "" }}user: {{ .user }}{{ end }}
{{ if ne .password "" }}password: {{ .password }}{{ end }}
{{- if .user }}
user: {{ .user }}
{{- end }}
{{- if .password }}
password: {{ .password }}
{{- end }}
channel: {{ .channel }} # shelly device relay channel
{{ include "switchsocket" . }}
8 changes: 4 additions & 4 deletions templates/definition/charger/tasmota.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ params:
render: |
type: tasmota
uri: http://{{ .host }}
{{ if ne .user "" }}
{{- if .user }}
user: {{ .user }}
{{ end }}
{{ if ne .password "" }}
{{- end }}
{{- if .password }}
password: {{ .password }}
{{ end }}
{{- end }}
channel: {{ .channel }} # relay channel (allowed range: 1-8)
{{ include "switchsocket" . }}
2 changes: 1 addition & 1 deletion templates/definition/meter/alpha-ess-smile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ render: |
type: holding
decode: uint16
scale: 0.1
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
10 changes: 5 additions & 5 deletions templates/definition/meter/deye-hybrid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ render: |
source: modbus
{{- include "modbus" . | indent 2 }}
register: # manual non-sunspec register configuration
address: 625 # Grid side total power
address: 625 # Grid side total power
type: holding
decode: int16
energy:
Expand All @@ -41,21 +41,21 @@ render: |
address: 613 # "Out-of-grid - current A"
type: holding
decode: int16
scale: 0.01
scale: 0.01
- source: modbus
{{- include "modbus" . | indent 4 }}
register: # manual non-sunspec register configuration
address: 614 # "Out-of-grid - current B"
type: holding
decode: int16
scale: 0.01
scale: 0.01
- source: modbus
{{- include "modbus" . | indent 4 }}
register: # manual non-sunspec register configuration
address: 615 # "Out-of-grid - current C"
type: holding
decode: int16
scale: 0.01
scale: 0.01
{{- end }}
{{- if eq .usage "pv" }}
power:
Expand Down Expand Up @@ -109,7 +109,7 @@ render: |
address: 588 # "battery capacity"
type: holding
decode: int16
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
energy:
Expand Down
2 changes: 1 addition & 1 deletion templates/definition/meter/e3dc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ render: |
address: 40082 # Batterie-SOC in %
type: holding
decode: uint16
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/fronius-gen24.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ render: |
id: 1
model: sunspec
value: ChargeState
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/fronius-solarapi-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ render: |
source: http
uri: http://{{ .host }}/solar_api/v1/GetPowerFlowRealtimeData.fcgi
jq: .Body.Data.Inverters."1".SOC
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/goodwe-hybrid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ render: |
address: 37007 # SOC First group battery capacity
type: holding
decode: uint16
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
energy:
Expand Down
2 changes: 1 addition & 1 deletion templates/definition/meter/growatt-hybrid-tlxh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ render: |
address: 3171 # SOC
type: input
decode: uint16
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
energy:
Expand Down
2 changes: 1 addition & 1 deletion templates/definition/meter/growatt-hybrid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ render: |
address: 1014 # SOC
type: input
decode: uint16
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
energy:
Expand Down
12 changes: 6 additions & 6 deletions templates/definition/meter/homematic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ params:
render: |
type: homematic
usage: {{ .usage }}
uri: {{ .host }}:{{- if (eq .usage "grid")}}2001{{ else }}2010{{end}}
uri: {{ .host }}:{{- if (eq .usage "grid") }}2001{{ else }}2010{{ end }}
device: {{ .device }}
meterchannel: {{ if (eq .usage "grid")}}1{{ else }}{{ .meterchannel }}{{end}}
{{ if ne .user "" }}
meterchannel: {{ if (eq .usage "grid") }}1{{ else }}{{ .meterchannel }}{{ end }}
{{- if .user }}
user: {{ .user }}
{{ end }}
{{ if ne .password "" }}
{{- end }}
{{- if .password }}
password: {{ .password }}
{{ end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ render: |
type: holding
decode: uint32
scale: 0.01
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/huawei-sun2000-rs485.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ render: |
type: holding
decode: uint32
scale: 0.01
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/kostal-piko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ render: |
uri: http://{{ .host }}/api/dxs.json?dxsEntries=33556229 # Battery SOC
# | ----------------------------- Bat SOC% --------- |
jq: (.dxsEntries[] | select(.dxsId==33556229) | .value )
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end -}}
2 changes: 1 addition & 1 deletion templates/definition/meter/kostal-plenticore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ render: |
model: sunspec
power: 802:W # sunspec model 802 battery
soc: 802:SoC # sunspec model 802 battery
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/lg-ess-home-8-10.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ render: |
# uri and password are only required once if multiple lgess usages are defined
uri: https://{{ .host }}
password: {{ .registration }}
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/openems.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ render: |
user: x
password: {{ .password }}
jq: .value
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/rct-power.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ render: |
uri: {{ .host }}
usage: {{ .usage }}
cache: 2s
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/senec-home.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ render: |
jq: .ENERGY.GUI_BAT_DATA_FUEL_CHARGE | sub("fl_"; "")
unpack: hex
decode: float32
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
8 changes: 6 additions & 2 deletions templates/definition/meter/shelly-1pm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ params:
render: |
type: shelly
uri: http://{{ .host }} # shelly device ip address (local)
{{ if ne .user "" }}user: {{ .user }}{{ end }}
{{ if ne .password "" }}password: {{ .password }}{{ end }}
{{- if .user }}
user: {{ .user }}
{{- end }}
{{- if .password }}
password: {{ .password }}
{{- end }}
channel: {{ .channel }} # shelly device relay channel
8 changes: 6 additions & 2 deletions templates/definition/meter/shelly-pro-3em.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ params:
render: |
type: shelly-energymeter
uri: http://{{ .host }} # shelly device ip address (local)
{{ if ne .user "" }}user: {{ .user }}{{ end }}
{{ if ne .password "" }}password: {{ .password }}{{ end }}
{{- if .user }}
user: {{ .user }}
{{- end }}
{{- if .password }}
password: {{ .password }}
{{- end }}
channel: 0 # shelly device relay channel
2 changes: 1 addition & 1 deletion templates/definition/meter/sma-datamanager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ render: |
address: 30845 # Battery Soc, %
type: holding
decode: uint32nan
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/sma-energymeter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ params:
render: |
type: sma
uri: {{ .host }}
{{- if ne .interface "" }}
{{- if .interface }}
interface: {{ .interface }}
{{- end }}
{{- if eq .usage "pv" }}
Expand Down
2 changes: 1 addition & 1 deletion templates/definition/meter/sma-homemanager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ params:
render: |
type: sma
uri: {{ .host }}
{{- if ne .interface "" }}
{{- if .interface }}
interface: {{ .interface }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/sma-hybrid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ render: |
address: 30845 # SMA Modbus Profile: Battery state of charge
type: holding
decode: uint32nan
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions templates/definition/meter/sma-inverter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ params:
render: |
type: sma
uri: {{ .host }} # IP address or hostname
{{- if ne .password "" }}
{{- if .password }}
password: {{ .password }} # optional
{{- end }}
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/sofarsolar-g3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ render: |
type: holding
decode: uint32
scale: 0.1
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/sofarsolar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ render: |
address: 0x0210 # The residual capacity of battery
type: holding
decode: uint16
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/solaredge-hybrid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ render: |
address: 62852 # Battery 1 State of Energy (SOE)
type: holding
decode: float32s
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/solarmax-maxstorage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ render: |
address: 122 # Batterie Soc
type: input
decode: int16
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/solarwatt-myreserve-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ render: |
source: http
uri: http://{{ .host }}:{{ .port }}/
jq: .SData.SoC
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/solarwatt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ render: |
source: http
uri: http://{{ .host }}/rest/kiwigrid/wizard/devices # EnergyManager
jq: .result.items[] | select(.deviceModel[].deviceClass == "com.kiwigrid.devices.location.Location" ) | .tagValues.WorkReleased.value / 1000
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/definition/meter/solax-hybrid-cloud.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ render: |
uri: https://www.solaxcloud.com/proxyApp/proxy/api/getRealtimeInfo.do?tokenId={{.tokenid}}&sn={{.serial}}
jq: .result.soc # Solax API inverter.DC.battery.energy.SOC
cache: 2m30s
{{- if ne .capacity "" }}
{{- if .capacity }}
capacity: {{ .capacity }} # kWh
{{- end }}
{{- end }}
Loading

0 comments on commit 3951e6d

Please sign in to comment.