From 145cebea2f5fcecb0249b1024660553dd2b7170c Mon Sep 17 00:00:00 2001 From: andig Date: Mon, 30 Jan 2023 18:28:47 +0100 Subject: [PATCH] Pushover: add devices (#5948) --- push/pushover.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/push/pushover.go b/push/pushover.go index 619a6693d9..e8e570dca9 100644 --- a/push/pushover.go +++ b/push/pushover.go @@ -2,6 +2,7 @@ package push import ( "errors" + "strings" "github.com/evcc-io/evcc/util" "github.com/gregdel/pushover" @@ -15,6 +16,7 @@ func init() { type PushOver struct { log *util.Logger app *pushover.Pushover + device string recipients []string } @@ -23,6 +25,7 @@ func NewPushOverFromConfig(other map[string]interface{}) (Messenger, error) { var cc struct { App string Recipients []string + Devices []string Events map[string]EventTemplate } @@ -37,6 +40,7 @@ func NewPushOverFromConfig(other map[string]interface{}) (Messenger, error) { m := &PushOver{ log: util.NewLogger("pushover"), app: pushover.New(cc.App), + device: strings.Join(cc.Devices, ","), recipients: cc.Recipients, } @@ -46,6 +50,7 @@ func NewPushOverFromConfig(other map[string]interface{}) (Messenger, error) { // Send sends to all receivers func (m *PushOver) Send(title, msg string) { message := pushover.NewMessageWithTitle(msg, title) + message.DeviceName = m.device for _, id := range m.recipients { go func(id string) {