Skip to content

Commit

Permalink
Merge branch 'master' into fix/phases-5
Browse files Browse the repository at this point in the history
  • Loading branch information
naltatis authored Feb 7, 2025
2 parents 649645b + 3516e7b commit 5d5d4c6
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 21 deletions.
2 changes: 1 addition & 1 deletion assets/js/components/Config/DeviceTags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default {
case "chargedEnergy":
return this.fmtWh(value * 1e3);
case "soc":
case "socLimit":
case "vehicleLimitSoc":
return this.fmtPercentage(value, 1);
case "temp":
return this.fmtTemperature(value);
Expand Down
4 changes: 2 additions & 2 deletions i18n/de.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ power = "Leistung"
powerRange = "Leistung"
range = "Reichweite"
singlePhase = "Einphasig"
soc = "SoC"
socLimit = "SoC Begrenzung"
soc = "Ladestand"
temp = "Temperatur"
topic = "Thema"
url = "URL"
vehicleLimitSoc = "Fahrzeuglimit"
yes = "Ja"

[config.deviceValueChargeStatus]
Expand Down
4 changes: 2 additions & 2 deletions i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ power = "Power"
powerRange = "Power"
range = "Range"
singlePhase = "Single phase"
soc = "SoC"
socLimit = "Limit"
soc = "Charge"
temp = "Temperature"
topic = "Topic"
url = "URL"
vehicleLimitSoc = "Vehicle limit"
yes = "yes"

[config.deviceValueChargeStatus]
Expand Down
10 changes: 8 additions & 2 deletions server/http_config_device_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,16 @@ func deviceConfigMap[T any](class templates.Class, dev config.Device[T]) (map[st
dc["id"] = configurable.ID()
dc["config"] = params
} else if title := conf.Other["title"]; title != nil {
// from yaml- add title only
// from yaml
config := make(map[string]any)
if s, ok := title.(string); ok {
dc["config"] = map[string]any{"title": s}
config["title"] = s
}
// add icon if available
if icon, ok := conf.Other["icon"].(string); ok {
config["icon"] = icon
}
dc["config"] = config
}

return dc, nil
Expand Down
6 changes: 3 additions & 3 deletions server/http_config_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ func testInstance(instance any) map[string]testResult {
res["phases1p3p"] = makeResult(true, nil)
}

if cc, ok := instance.(api.PhaseDescriber); ok {
res["singlePhase"] = makeResult(cc.Phases() == 1, nil)
if cc, ok := instance.(api.PhaseDescriber); ok && cc.Phases() == 1 {
res["singlePhase"] = makeResult(true, nil)
}

if dev, ok := instance.(api.VehicleRange); ok {
Expand All @@ -203,7 +203,7 @@ func testInstance(instance any) map[string]testResult {

if dev, ok := instance.(api.SocLimiter); ok {
val, err := dev.GetLimitSoc()
res["socLimit"] = makeResult(val, err)
res["vehicleLimitSoc"] = makeResult(val, err)
}

if dev, ok := instance.(api.Identifier); ok {
Expand Down
25 changes: 14 additions & 11 deletions templates/definition/meter/enphase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ params:
de: "Ab Envoy Firmware D7.x.xxx notwendig. Token ist ein Jahr gültig. Anleitung (Obtaining a token via web UI): https://enphase.com/download/accessing-iq-gateway-local-apis-or-local-ui-token-based-authentication"
- name: capacity
advanced: true
- name: cache
advanced: true
default: 1s
render: |
type: custom
{{- if eq .usage "grid" }}
Expand All @@ -29,7 +32,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
cache: {{ .cache }}
jq: .consumption[] | select(.measurementType == "net-consumption").wNow
currents:
- source: http
Expand All @@ -40,7 +43,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
cache: {{ .cache }}
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 @@ -50,7 +53,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
cache: {{ .cache }}
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 @@ -60,7 +63,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
cache: {{ .cache }}
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 @@ -73,7 +76,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
cache: {{ .cache }}
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 @@ -84,7 +87,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
cache: {{ .cache }}
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 @@ -96,7 +99,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
cache: {{ .cache }}
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 @@ -106,7 +109,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
cache: {{ .cache }}
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 @@ -116,7 +119,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
cache: {{ .cache }}
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 @@ -129,7 +132,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
cache: {{ .cache }}
jq: .storage[] | .wNow
soc:
source: http
Expand All @@ -140,7 +143,7 @@ render: |
password: {{ .token }}
insecure: true
{{- end }}
cache: 5s
cache: {{ .cache }}
jq: '[.[].devices[] | select(.percentFull != null) | .percentFull] | add / length'
capacity: {{ .capacity }} # kWh
{{- end }}
13 changes: 13 additions & 0 deletions templates/definition/meter/vzlogger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,16 @@ params:
description:
de: Die vzlogger Kanal uuid für Spannung in Phase 3 (OBIS Code 72.7.0)
en: The vzlogger channel uuid for voltage on phase 3 (OBIS Code 72.7.0)
- name: cache
advanced: true
default: 1s
render: |
type: custom
power: # power reading
source: http # use http plugin
uri: http://{{ .host }}:{{ .port }}/
jq: .data[] | select(.uuid=={{ quote (trimAll "'" .uuid) }}) | .tuples[0][1] # parse response json
cache: {{ .cache }}
{{- if .scale }}
scale: {{ .scale }}
{{- end }}
Expand All @@ -79,34 +83,43 @@ render: |
- source: http
uri: http://{{ .host }}:{{ .port }}/
jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l1currentuuid) }}) | .tuples[0][1]
cache: {{ .cache }}
- source: http
uri: http://{{ .host }}:{{ .port }}/
jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l2currentuuid) }}) | .tuples[0][1]
cache: {{ .cache }}
- source: http
uri: http://{{ .host }}:{{ .port }}/
jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l3currentuuid) }}) | .tuples[0][1]
cache: {{ .cache }}
{{ end -}}
{{ if and .l1poweruuid .l2poweruuid .l3poweruuid -}}
powers:
- source: http
uri: http://{{ .host }}:{{ .port }}/
jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l1poweruuid) }}) | .tuples[0][1]
cache: {{ .cache }}
- source: http
uri: http://{{ .host }}:{{ .port }}/
jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l2poweruuid) }}) | .tuples[0][1]
cache: {{ .cache }}
- source: http
uri: http://{{ .host }}:{{ .port }}/
jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l3poweruuid) }}) | .tuples[0][1]
cache: {{ .cache }}
{{ end -}}
{{ if and .l1voltageuuid .l2voltageuuid .l3voltageuuid -}}
voltages:
- source: http
uri: http://{{ .host }}:{{ .port }}/
jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l1voltageuuid) }}) | .tuples[0][1]
cache: {{ .cache }}
- source: http
uri: http://{{ .host }}:{{ .port }}/
jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l2voltageuuid) }}) | .tuples[0][1]
cache: {{ .cache }}
- source: http
uri: http://{{ .host }}:{{ .port }}/
jq: .data[] | select(.uuid=={{ quote (trimAll "'" .l3voltageuuid) }}) | .tuples[0][1]
cache: {{ .cache }}
{{ end -}}

0 comments on commit 5d5d4c6

Please sign in to comment.