Added error check
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Dreaded_X 2022-09-16 22:29:11 +02:00
parent e5a6b75f62
commit c6bf97c3db
Signed by: Dreaded_X
GPG Key ID: 76BDEC4E165D8AD9

View File

@ -88,6 +88,7 @@ type ntfy struct{
} }
func (ntfy *ntfy) notifyPresence(home bool) { func (ntfy *ntfy) notifyPresence(home bool) {
// @TODO Maybe add list the devices that are home currently?
var description string var description string
var actions string var actions string
if home { if home {
@ -98,8 +99,10 @@ func (ntfy *ntfy) notifyPresence(home bool) {
actions = "broadcast, Set as home, extras.cmd=presence, extras.state=1, clear=true" actions = "broadcast, Set as home, extras.cmd=presence, extras.state=1, clear=true"
} }
req, _ := http.NewRequest("POST", fmt.Sprintf("https://ntfy.sh/%s", ntfy.topic), req, err := http.NewRequest("POST", fmt.Sprintf("https://ntfy.sh/%s", ntfy.topic), strings.NewReader(description))
strings.NewReader(description)) if err != nil {
panic(err)
}
req.Header.Set("Title", "Presence") req.Header.Set("Title", "Presence")
req.Header.Set("Tags", "house") req.Header.Set("Tags", "house")