Skip to content

Commit

Permalink
chore: Add cache to enphase template
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenart12 committed Feb 4, 2025
1 parent 3997e75 commit fee937a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions templates/definition/meter/enphase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
jq: .consumption[] | select(.measurementType == "net-consumption").wNow
currents:
- source: http
Expand All @@ -39,6 +40,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
jq: if (( .consumption[] | select(.measurementType == "net-consumption").activeCount >= 1 ) and ( .consumption[] | select(.measurementType == "net-consumption").lines | length >= 1 )) then .consumption[] | select(.measurementType == "net-consumption").lines[0].rmsCurrent else 0 end
- source: http
uri: http://{{ .host }}/production.json?details=1
Expand All @@ -48,6 +50,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
jq: if (( .consumption[] | select(.measurementType == "net-consumption").activeCount >= 1 ) and ( .consumption[] | select(.measurementType == "net-consumption").lines | length >= 2 )) then .consumption[] | select(.measurementType == "net-consumption").lines[1].rmsCurrent else 0 end
- source: http
uri: http://{{ .host }}/production.json?details=1
Expand All @@ -57,6 +60,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
jq: if (( .consumption[] | select(.measurementType == "net-consumption").activeCount >= 1 ) and ( .consumption[] | select(.measurementType == "net-consumption").lines | length >= 3 )) then .consumption[] | select(.measurementType == "net-consumption").lines[2].rmsCurrent else 0 end
{{- end }}
{{- if eq .usage "pv" }}
Expand All @@ -69,6 +73,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
jq: if (.production | length) > 1 and (.production[] | select(.measurementType == "production").activeCount >= 1) then .production[] | select(.measurementType == "production").wNow else .production[] | select(.type == "inverters").wNow end
energy:
source: http
Expand All @@ -79,6 +84,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
jq: if (.production | length) > 1 and (.production[] | select(.measurementType == "production").activeCount >= 1) then .production[] | select(.measurementType == "production").whLifetime else .production[] | select(.type == "inverters").whLifetime end
scale: 0.001
currents:
Expand All @@ -90,6 +96,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
jq: if (( .production[] | select(.measurementType == "production").activeCount >= 1 ) and ( .production[] | select(.measurementType == "production").lines | length >= 1 )) then .production[] | select(.measurementType == "production").lines[0].rmsCurrent else 0 end
- source: http
uri: http://{{ .host }}/production.json?details=1
Expand All @@ -99,6 +106,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
jq: if (( .production[] | select(.measurementType == "production").activeCount >= 1 ) and ( .production[] | select(.measurementType == "production").lines | length >= 2 )) then .production[] | select(.measurementType == "production").lines[1].rmsCurrent else 0 end
- source: http
uri: http://{{ .host }}/production.json?details=1
Expand All @@ -108,6 +116,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
jq: if (( .production[] | select(.measurementType == "production").activeCount >= 1 ) and ( .production[] | select(.measurementType == "production").lines | length >= 3 )) then .production[] | select(.measurementType == "production").lines[2].rmsCurrent else 0 end
{{- end }}
{{- if eq .usage "battery" }}
Expand All @@ -120,6 +129,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
jq: .storage[] | .wNow
soc:
source: http
Expand All @@ -130,6 +140,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
jq: '[.[].devices[] | select(.percentFull != null) | .percentFull] | add / length'
capacity: {{ .capacity }} # kWh
{{- end }}

0 comments on commit fee937a

Please sign in to comment.