Skip to content

Commit

Permalink
Pushover: add devices (evcc-io#5948)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Jan 30, 2023
1 parent ee12a54 commit 145cebe
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions push/pushover.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package push

import (
"errors"
"strings"

"github.com/evcc-io/evcc/util"
"github.com/gregdel/pushover"
Expand All @@ -15,6 +16,7 @@ func init() {
type PushOver struct {
log *util.Logger
app *pushover.Pushover
device string
recipients []string
}

Expand All @@ -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
}

Expand All @@ -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,
}

Expand All @@ -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) {
Expand Down

0 comments on commit 145cebe

Please sign in to comment.