aceberg / WatchYourLAN

Lightweight network IP scanner. Can be used to notify about new hosts and monitor host online/offline history
https://hub.docker.com/r/aceberg/watchyourlan
MIT License
3.84k stars 119 forks source link

Notification not sending JSON to generic+ to shoutrrr #50

Closed JeffCrum1 closed 1 year ago

JeffCrum1 commented 1 year ago

From my previous issue:

I now have it sending to Home Assistant using generic+URL:port/api/webhook/-WebHookID

But, the payload is not JSON formatted even though it does go with the Content-Type: application/json.

The payload looks like: UNKNOWN HOST IP: '192.168.0.4', MAC: '18:56:80:c7:dd:1e', Hw: 'Intel Corporate'

And, I believe it needs to be like: {"Title":"UNKNOWN HOST","IP":"192.168.0.4","MAC":"18:56:80:c7:dd:1e","Hw":"Intel Corporate"}

When I send it this way to Home Assistant using curl, the notification works fine. Using the top payload, Home Assistant throws a JSONDecodeError.

I can't find a way to get Home Assistant to just put out the payload directly. It seems to need it JSON formatted.

JeffCrum1 commented 1 year ago

Okay. Working with piksel over at shoutrrr, I got it working.

Don't use generic+http://

Just use generic:// and follow the URL with ?template=json

That actually sends https:// by default. If you need http://, append &disabletls=yes