jishi / node-sonos-http-api

An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar.
http://jishi.github.io/node-sonos-http-api/
MIT License
1.84k stars 462 forks source link

Webhook ERROR: Could not reach webhook endpoint #811

Closed swaggner closed 2 years ago

swaggner commented 2 years ago

I've added the "{ "http://localhost:5007/" }" text to a settings.json file that I've placed in the working directory, but I'm getting an error. Access to the http site under port 5005 is working as designed, but I can't get the webhook functioning. I'm sure it's something simple I'm missing, but here is my error after running npm start:

2021-10-26T12:51:18.010Z ERROR Could not reach webhook endpoint http://localhost:5007/ for some reason. Verify that the receiving end is up and running.

PS. Thanks for writing this code. Awesome work!

jishi commented 2 years ago

Well, the webhook needs to reach somewhere, and you've specified http://localhost:5007/ so what are you running there?

swaggner commented 2 years ago

I'm using the test_endpoint.js you provided. Actually, that was the issue. It was not running properly in my other terminal window because I had modified the code. Can you point me to a resource to filter that webhook payload? Thank you for the quick response.

jishi commented 2 years ago

Not really, I haven't used it for anything, it was a bit experimental to begin with. Never really found a use for it personally :)

swaggner commented 2 years ago

I want to update the albumArtworkUri image when a song changes on a DAKboard display. The built-in DAKboard sonos function isn't able to pull in album artwork reliably but your api is the missing link to make it happen. I just don't need all the json data.

jishi commented 2 years ago

You could look at this: https://github.com/jishi/sonos-event-stub

This is the simplest implementation I could do to act on state changes from players. You can define which room name you care about: https://github.com/jishi/sonos-event-stub/blob/master/app.js#L8

and then you can decide to do whatever here https://github.com/jishi/sonos-event-stub/blob/master/app.js#L27-L36

the isActive, stopHandler etc was just because it was supposed to triger on start/stop of playback, you don't care about that if you just want to update some album art.

swaggner commented 2 years ago

Thank you jishi!