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

Webhook not working ... #49

Closed JeffCrum1 closed 1 year ago

JeffCrum1 commented 1 year ago

Or, I am doing it wrong.

I am trying to webhook into HomeAssistant when a new device is on the network for notification to my phone.

I have fought for days to get the webhook working thinking it was a Home Assistant setup issue.

But, I just tried sending to webhook.site and nothing appears when using the Config|Settings Notification Button.

I am pasting the link into the Shoutrrr URL settings box and pressing the button after saving settings and restarting. Any recommendations?

aceberg commented 1 year ago

Or, I am doing it wrong.

I am trying to webhook into HomeAssistant when a new device is on the network for notification to my phone.

I have fought for days to get the webhook working thinking it was a Home Assistant setup issue.

But, I just tried sending to webhook.site and nothing appears when using the Config|Settings Notification Button.

I am pasting the link into the Shoutrrr URL settings box and pressing the button after saving settings and restarting. Any recommendations?

Look at Shoutrrr guide, please: https://github.com/containrrr/shoutrrr/blob/main/docs/services/generic.md

The link should be like:

generic+https://example.com/api/v1/postStuff
JeffCrum1 commented 1 year ago

Grrrr. I swear I tried that. I have certainly been to the Shoutrrr githum many times.

Seems to be working now.

Thanks.

JeffCrum1 commented 1 year ago

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.