Config UI: vehicle icons from yaml (#18647)
This commit is contained in:
parent
229b7f19f3
commit
1633e72b85
5 changed files with 16 additions and 10 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue