diff --git a/assets/js/components/Config/DeviceTags.vue b/assets/js/components/Config/DeviceTags.vue index 1ee6b3ed6a..6ab29b2355 100644 --- a/assets/js/components/Config/DeviceTags.vue +++ b/assets/js/components/Config/DeviceTags.vue @@ -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); diff --git a/i18n/de.toml b/i18n/de.toml index 98de66eebd..a44fcff258 100644 --- a/i18n/de.toml +++ b/i18n/de.toml @@ -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] diff --git a/i18n/en.toml b/i18n/en.toml index d780793ab2..c0f6fc8746 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -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] diff --git a/server/http_config_device_handler.go b/server/http_config_device_handler.go index 39474ce86c..4de4ef1904 100644 --- a/server/http_config_device_handler.go +++ b/server/http_config_device_handler.go @@ -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 diff --git a/server/http_config_helper.go b/server/http_config_helper.go index 138c712d93..36073f2619 100644 --- a/server/http_config_helper.go +++ b/server/http_config_helper.go @@ -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 { @@ -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 { diff --git a/templates/definition/meter/enphase.yaml b/templates/definition/meter/enphase.yaml index 59f310f85c..440f8db9eb 100644 --- a/templates/definition/meter/enphase.yaml +++ b/templates/definition/meter/enphase.yaml @@ -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" }} @@ -29,7 +32,7 @@ render: | password: {{ .token }} insecure: true {{- end }} - cache: 5s + cache: {{ .cache }} jq: .consumption[] | select(.measurementType == "net-consumption").wNow currents: - source: http @@ -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 @@ -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 @@ -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" }} @@ -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 @@ -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: @@ -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 @@ -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 @@ -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" }} @@ -129,7 +132,7 @@ render: | password: {{ .token }} insecure: true {{- end }} - cache: 5s + cache: {{ .cache }} jq: .storage[] | .wNow soc: source: http @@ -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 }} diff --git a/templates/definition/meter/vzlogger.yaml b/templates/definition/meter/vzlogger.yaml index abcc9ed470..b576256787 100644 --- a/templates/definition/meter/vzlogger.yaml +++ b/templates/definition/meter/vzlogger.yaml @@ -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 }} @@ -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 -}}