Messaging: resolve pointer values
This commit is contained in:
parent
9c429abc8d
commit
e087276beb
1 changed files with 9 additions and 1 deletions
10
push/hub.go
10
push/hub.go
|
|
@ -2,6 +2,7 @@ package push
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
|
|
@ -72,7 +73,14 @@ func (h *Hub) apply(ev Event, tmpl string) (string, error) {
|
|||
// get all values from cache
|
||||
for _, p := range h.cache.All() {
|
||||
if p.Loadpoint == nil || ev.Loadpoint == p.Loadpoint {
|
||||
attr[p.Key] = p.Val
|
||||
val := p.Val
|
||||
|
||||
// resolve pointers (https://github.com/evcc-io/evcc/issues/24688)
|
||||
if rv := reflect.ValueOf(p.Val); rv.Kind() == reflect.Pointer && !rv.IsNil() {
|
||||
val = rv.Elem().Interface()
|
||||
}
|
||||
|
||||
attr[p.Key] = val
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue