Comments (6)
I'm aware that the system doesn't really work if the system this is running on, or the Sonos players changes IP all of a sudden. It has however been low priority since that is not a common scenario.
Is there a specific setup that gives a higher probability that this might occur for you? The EADDRNOTAVAIL error will no longer occur the same way, since I'm no longer binding requests to a certain IP (I rely on the system routing table to make it's decision), so the only thing that happens is that the wrong URL is sent as subscription endpoint, this will fail silently.
So either a periodic update of local endpoint, or update it every time it sends an action to any player (since at that point, I know which local endpoint it used).
from node-sonos-discovery.
No specific setup, just trying to be foolproof and cover edge cases. The silent failure is a problem, the subscriber using discovery can then have "a dead player" without knowing it. Perhaps wrapping the error if unhandled and forwarding it via discovery.on('error', cb)
would allow the subscriber to chose to do something with it.
In this case I'm interested in keeping IP change handling encapsulated in node-sonos-discovery. My solution above works for the local endpoint.
However like you said I run into a similar problem if the Sonos player changes IP. I'm looking into a way to try updating a player's address if the Sonos was to change IP. The error in this case would show up as ETIMEDOUT
(in this case it could also be the sonos was turned off).
The sonos address is found in Discovery and it's passed to the Player as a constructor parameter. So either:
- Discovery could start looking on the dgram socket again and create a new Player
- Player could look (even via discovery) for it's specific device on a new IP and update its address when found
I'm not sure which one would be the best approach. It looks like we can use the id from /root/device/UDN
to find the same device (assuming the IP changed and it wasn't turned off)
from node-sonos-discovery.
It doesn't have to be that complicated. The ZoneTopology would eventually change to reflect the changes, so a player that no longer occurs in the ZoneTopology, could be removed, and any new players that would show up, is already automatically added. Likewise, you could correlate the IP with the UUID and remove players that has a mismatch.
One edge case here is when the player/bridge/boost that it subscribes for topology changes dies or changes IP, it would need to reset the whole discovery process from scratch. But that should be fairly easy to fix, anyway.
from node-sonos-discovery.
Thanks for the feedback, that makes more sense indeed. If the use case is only one Sonos is used, it would be the topology subscribed player at all times.
I took sonos-ssdp.js into the legacy branch and I was actually able to get the uuid inside of ssdp's message handler since its included in the USN header. As you said it probably doesn't need to be that complicated. pfiaux@a0a6fa8 I tested it, the subscriber will be able to find the Player again if either IPs change.
Right now I'm only handling this passively for the event tho, soap actions wont trigger my 'rediscovery' process. I'm probably going to look at getting that working as well. If you're not interested in bringing the handling of IP changes into the 1.0.0 branch we can close this issue :)
from node-sonos-discovery.
I want to eventually support this scenario, so I'll keep this open. Feel free to comment if you have any observations worth mentioning that could be beneficial.
from node-sonos-discovery.
I think I have fixed this now. Haven't verified what happens during an IP change, but when the initial player that it gets topology notifications from seems to have gone away, it will reset everything and find a new one.
from node-sonos-discovery.
Related Issues (20)
- UnhandledPromiseRejectWarning HOT 5
- Implement same features in Java/Android app HOT 4
- npm test fails on spotify HOT 2
- Support switch to Line In and TV HOT 6
- No Metadata when browsing SQ:4 HOT 3
- setting incorrect volume HOT 7
- Uncaught (in promise) TypeError: Cannot read property 'baseUrl' of undefined HOT 1
- Request: Soundbar Input Information
- error: sonos.0 TypeError: Cannot read property '$text' of undefined HOT 5
- How to update libary
- Unable to get state of player
- Audio Delay
- What are all the possible state changes? HOT 2
- Spotify: "Wrong" album art when playing from playlist
- GetFavorites does not return all favorites HOT 3
- exception in recalculateGroupVolume HOT 7
- HTTPS Support in lib/helpers/request.js HOT 5
- Question about code, half seconds HOT 3
- BTW: Great project!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-sonos-discovery.