henkelis / sonospy

Sonospy is a UPnP control point and Windows Media proxy for the Sonos multi-room audio system.
GNU General Public License v3.0
113 stars 16 forks source link

Sonsopy Services have wrong name #88

Closed Viper525 closed 6 years ago

Viper525 commented 6 years ago

Hi,

I've moved to another flat, so I had to setup a new network. In the end most of it worked out fine:

So I started sonospy again using: sudo ./sonospy_proxy -r -sSonospy=Alben,Alben.db,Alben.ini -sSonospy=Interpreten,Interpreten.db,Interpreten.ini -sSonospy=Charts,Charts.db,ChartsSampler.ini -sSonospy=Medleys,Medleys.db,Medleys.ini -sSonospy=Sampler,SamplerSoundtracks.db,ChartsSampler.ini -sSonospy=Hoerbuecher,Hoerbuecher.db,Alben_direct.ini -sSonospy=Hoerspiele,Hoerspiele.db,Alben_direct.ini

But the services on the sonos controller didn't find any music. After a while I found out that the call without "-r" worked and the sonospy services can play music again.

But: The services are mixes up. I have the wrong content in the wrong services and I have two services with the same name, but one is missing.

When I stop sonos and disconnected sonos from the services the services stay in the sonos controller (at add services). Even after a day not running sonospy they could be found there. I even can register to the services, but I cannot play music when sonospy is off, of course.

Any ideas what I can do for that? Will I have to reset my sonos players for that?

And for my interest: any ideas why this happens? Is there some kind of serviceID at the services? Perhaps they've got mixed up when implementing the server in the new network. As sonos seems to cache the services (for a looong time) it could get the wrong services behind a service name or something like that.

Thanks in advance! Viper

henkelis commented 6 years ago

Hi, are you running the latest version of Sonospy? Sonos added csrf support to the customsd page at the end of last year, so I added a patch to cater for that - basically it stopped -r working. Unless you notice the error in the logs, you won't see an issue unless you create a new service or swap the entries around on the command line. You also wouldn't see an issue if you didn't update the Sonos software.

You are correct that the is a service ID involved: -r unregisters then registers services with a service ID when you start Sonospy, so it doesn't matter if there are old service IDs there as they get overwritten. If you run without -r Sonospy will work with whatever services are on the service IDs when it runs, which will be why you're seeing them mixed up. Sonos will keep those service IDs unless you reset it - you can delete them manually but obviously then you won't be able to connect without -r.

It's nice to see someone running with multiple services as it's intended to work :o)

Mark.

Viper525 commented 6 years ago

Hi, thanks for reply. I performed a git pull on 11/07/2018 (last tuesday). And I ran every update on the sonos system. Where can I get the patch? I'd like to give it a try instead of resetting the sonos system. If I understand you correct "-r" will work again after the patch?

In the error dir the latest file is "ErrorDump-20170822-084822.txt" and the log dir only includes files "scan*". So I guess the is no logged information about an concerning my issue?

Running with multiple service worked the last years! So: Thanks for the great work with this software!!! :-)

henkelis commented 6 years ago

The patch is in the latest version of the code, so it looks like something else is causing your problem. There should be a pycpoint.log file in the folder you run sonospy_proxy from (it gets overwritten on each run), but if you don't have debug on it won't contain much.

My Sonos software is up to date (v9.0). If you run Sonospy from the sonospy folder (not the folder where sonospy_proxy is) using the command below, we can see whether you're getting customsd errors: python pycpoint.py -p -sSonospy=Alben,Alben.db,Alben.ini -r You should see:

Args:
option.proxyonly: True
option.register: True
    Music service: Sonospy=Alben,Alben.db,Alben.ini
Proxy. Name: Sonospy
>>>> new device (from controller): <for each device it finds>

and hopefully two successful calls to customsd:


customsd call success: True <the first one removes the SID>
customsd call success: True <the second one readds the SID>

The customsd data should include a csrfToken.

Viper525 commented 6 years ago

I deleted my former answers, as I forgot to perform the sonospy_stop command.

So new result of "sudo python pycpoint.py -p -sSonospy=Alben,Alben.db,Alben.ini -r":

Args:

option.proxyonly: True
option.register: True
    Music service: Sonospy=Alben,Alben.db,Alben.ini
Proxy. Name: Alben

>>>> new device (from controller): 192.168.178.36 - Sonos Sub at http://192.168.178.36:1400  udn: uuid:
The server couldn't fulfil the request. Error code: 400, Reason: Bad Request
customsd call success: False,  args: {'name': '', 'sid': '240'}
>>>> new device (from controller): 192.168.178.27 - Sonos Bridge at http://192.168.178.27:1400  udn: uuid:
The server couldn't fulfil the request. Error code: 400, Reason: Bad Request
customsd call success: False,  args: {'containerType': 'MService', 'secureUri': 'http://192.168.178.23:50104/smapi/control', 'authType': 'Anonymous', 'name': 'Alben', 'sid': '240', 'presentationMapVersion': '342', 'presentationMapUri':
>>>> new device (from controller): 192.168.178.26 - Sonos Play:1 at http://192.168.178.26:1400  udn: uuid:
henkelis commented 6 years ago

So the calls to customsd are definitely failing. The code tries that call on the first Sonos component it finds, in your case your Sub - it would be that the Sub doesn't support that call (and maybe the Bridge too). Can you put http://192.168.178.36:1400/customsd into a web browser on the same network please. I think you'll get Bad Request. If you try it with one of the other IPs you should get a page back (can you try it with the bridge too please).

Viper525 commented 6 years ago

Okay: Result from Sub: Error 400 - Bad Request Result from Bridge: Error 404 - Not found Result from one of the Play 1: Webside

henkelis commented 6 years ago

Ok, I need to change the code to ignore the Sub (it currently only sends the request to ZonePlayers, the Sub must be classed as one of those).

To check my theory, can you run the following please:

python pycpoint.py -p -sSonospy=Alben,Alben.db,Alben.ini -z 192.168.178.26

This tells Sonospy to register with the ZP at the given address - you should see successful customsd calls now.

Can you then run:

python showdevices.py

and send the devices.txt file it creates to my email address please - that will help me decide how to ignore the Sub.

Viper525 commented 6 years ago

I had to cancel both with Strg+c, but I think there was no mistake. What is your email address?

henkelis commented 6 years ago

mark . henkelis at gmail . com

Did -z work?

henkelis commented 6 years ago

I've pushed a fix to msrefactor5 - it will now try to register with other Zoneplayers if it fails with the first (or subsequent) one(s).

Viper525 commented 6 years ago

Hi,

didn't solved the issue.

sudo git pull
remote: Counting objects: 5, done.
remote: Total 5 (delta 4), reused 5 (delta 4), pack-reused 0
Entpacke Objekte: 100% (5/5), Fertig.
Von https://github.com/henkelis/sonospy
   2a1649c..841f520  msrefactor5 -> origin/msrefactor5
Aktualisiere 2a1649c..841f520
Fast-forward
 sonospy/customsd.py | 12 ++++++++----
 sonospy/pycpoint.py | 22 ++++++++++++++++++----
 2 files changed, 26 insertions(+), 8 deletions(-)
sudo python pycpoint.py -p -sSonospy=Alben,Alben.db,Alben.ini -r
Args:
option.proxyonly: True
option.register: True
    Music service: Sonospy=Alben,Alben.db,Alben.ini
Proxy. Name: Alben
>>>> new device (from controller): Teiwes Twonky Server at http://192.168.178.23:9000  udn: uuid:55076f6e-6b79-1d65-a4a5-424242424242
>>>> new device (from controller): FRITZ!Box 6490 Cable (kdg) at http://192.168.178.1:49000  udn: uuid:95802409-bccb-40e7-8e6c-CCCE1EBFAEE1
>>>> new device (from controller): FRITZ!Box 6490 Cable (kdg) at http://192.168.178.1:49000  udn: uuid:663d5d6c-f9f8-4bb4-84d4-CCCE1EBFAEE1
 >>>> new device (from controller): FRITZ!Box 6490 Cable (kdg) at http://192.168.178.1:49000  udn: uuid:123402409-bccb-40e7-8e6c-CCCE1EBFAEE1
>>>> new device (from controller): InternetGatewayDeviceV2 - FRITZ!Box 6490 Cable (kdg) at http://192.168.178.1:49000  udn: uuid:75802409-bccb-40e7-9f6c-CCCE1EBFAEE1
>>>> new device (from controller): FRITZ!Box 6490 Cable (kdg) at http://192.168.178.1:49000  udn: uuid:75802409-bccb-40e7-8e6c-CCCE1EBFAEE1
>>>> new device (from controller): AVM FRITZ!Mediaserver at http://192.168.178.1:49000  udn: uuid:fa095ecc-e13e-40e7-8e6c-ccce1ebfaee1
>>>> new device (from controller): Twonky RUIS [teiwes-server] at http://192.168.178.23:9000  udn: uuid:57076f6e-6b79-1d65-a4a5-424242424242
>>>> new device (from controller): 192.168.178.27 - Sonos Bridge at http://192.168.178.27:1400  udn: uuid:RINCON_B8E93718957001400
>>>> new device (from controller): 192.168.178.35 - Sonos Playbar at http://192.168.178.35:1400  udn: uuid:RINCON_000E58BE282E01400
>>>> new device (from controller): 192.168.178.29 - Sonos Play:1 at http://192.168.178.29:1400  udn: uuid:RINCON_B8E93780855E01400
>>>> new device (from controller): 192.168.178.36 - Sonos Sub at http://192.168.178.36:1400  udn: uuid:RINCON_000E589B981001400
customsd call return: True,  args: {'csrfToken': 'm1OMvKxCy3wtbKoShNMOJwh748Rtb0gS', 'name': '', 'sid': '240'}
>>>> new device (from controller): 192.168.178.30 - Sonos Play:1 at http://192.168.178.30:1400  udn: uuid:RINCON_B8E9378C575401400
>>>> new device (from controller): 192.168.178.31 - Sonos Play:1 at http://192.168.178.31:1400  udn: uuid:RINCON_B8E9375C53E201400>>>> new device (from controller): 192.168.178.28 - Sonos Play:1 at http://192.168.178.28:1400  udn: uuid:RINCON_B8E937807D2801400

>>>> new device (from controller): 192.168.178.26 - Sonos Play:1 at http://192.168.178.26:1400  udn: uuid:RINCON_B8E9375FA22201400
customsd call return: True,  args: {'caps': ['search', 'trFavorites', 'alFavorites', 'arFavorites', 'ucPlaylists'], 'presentationMapVersion': '344', 'secureUri': 'http://192.168.178.23:50104/smapi/control', 'pollInterval': '30', 'csrfToken': 'qnUz2ENBJ2U1o2gVentwLbs/Xuc8Wt/y', 'authType': 'Anonymous', 'name': 'Alben', 'presentationMapUri': u'http://192.168.178.23:50104/5e0fc086-1c37-4648-805c-ec2aba2b0a27.xml', 'uri': 'http://192.168.178.23:50104/smapi/control', 'sid': '240', 'containerType': 'MService'}

There is stops and I have to perform Strg+C.

Soing the usual start command in the command line it seemt tork (like before), but no change in the sonos controller. I still have the old service with mixed up names.

The last one (where it seems to end or stop) is the one where we performed the "-z" command before.

henkelis commented 6 years ago

Hi, that worked, in that the customsd call was successful. As you ran pycpoint direct and only supplied one SMAPI, only that SID will have been reset. You have to stop the direct call with control c.

If you try it again with sonospy_proxy and the full set of services it should be fine.

Mark.

On Mon, 13 Aug 2018, 06:34 Viper525, notifications@github.com wrote:

Hi,

didn't solved the issue.

sudo git pull remote: Counting objects: 5, done. remote: Total 5 (delta 4), reused 5 (delta 4), pack-reused 0 Entpacke Objekte: 100% (5/5), Fertig. Von https://github.com/henkelis/sonospy 2a1649c..841f520 msrefactor5 -> origin/msrefactor5 Aktualisiere 2a1649c..841f520 Fast-forward sonospy/customsd.py | 12 ++++++++---- sonospy/pycpoint.py | 22 ++++++++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-)

sudo python pycpoint.py -p -sSonospy=Alben,Alben.db,Alben.ini -r Args: option.proxyonly: True option.register: True Music service: Sonospy=Alben,Alben.db,Alben.ini Proxy. Name: Alben

new device (from controller): Teiwes Twonky Server at http://192.168.178.23:9000 udn: uuid:55076f6e-6b79-1d65-a4a5-424242424242 new device (from controller): FRITZ!Box 6490 Cable (kdg) at http://192.168.178.1:49000 udn: uuid:95802409-bccb-40e7-8e6c-CCCE1EBFAEE1 new device (from controller): FRITZ!Box 6490 Cable (kdg) at http://192.168.178.1:49000 udn: uuid:663d5d6c-f9f8-4bb4-84d4-CCCE1EBFAEE1 new device (from controller): FRITZ!Box 6490 Cable (kdg) at http://192.168.178.1:49000 udn: uuid:123402409-bccb-40e7-8e6c-CCCE1EBFAEE1 new device (from controller): InternetGatewayDeviceV2 - FRITZ!Box 6490 Cable (kdg) at http://192.168.178.1:49000 udn: uuid:75802409-bccb-40e7-9f6c-CCCE1EBFAEE1 new device (from controller): FRITZ!Box 6490 Cable (kdg) at http://192.168.178.1:49000 udn: uuid:75802409-bccb-40e7-8e6c-CCCE1EBFAEE1 new device (from controller): AVM FRITZ!Mediaserver at http://192.168.178.1:49000 udn: uuid:fa095ecc-e13e-40e7-8e6c-ccce1ebfaee1 new device (from controller): Twonky RUIS [teiwes-server] at http://192.168.178.23:9000 udn: uuid:57076f6e-6b79-1d65-a4a5-424242424242 new device (from controller): 192.168.178.27 - Sonos Bridge at http://192.168.178.27:1400 udn: uuid:RINCON_B8E93718957001400 new device (from controller): 192.168.178.35 - Sonos Playbar at http://192.168.178.35:1400 udn: uuid:RINCON_000E58BE282E01400 new device (from controller): 192.168.178.29 - Sonos Play:1 at http://192.168.178.29:1400 udn: uuid:RINCON_B8E93780855E01400 new device (from controller): 192.168.178.36 - Sonos Sub at http://192.168.178.36:1400 udn: uuid:RINCON_000E589B981001400 customsd call return: True, args: {'csrfToken': 'm1OMvKxCy3wtbKoShNMOJwh748Rtb0gS', 'name': '', 'sid': '240'} new device (from controller): 192.168.178.30 - Sonos Play:1 at http://192.168.178.30:1400 udn: uuid:RINCON_B8E9378C575401400 new device (from controller): 192.168.178.31 - Sonos Play:1 at http://192.168.178.31:1400 udn: uuid:RINCON_B8E9375C53E201400>>>> new device (from controller): 192.168.178.28 - Sonos Play:1 at http://192.168.178.28:1400 udn: uuid:RINCON_B8E937807D2801400

new device (from controller): 192.168.178.26 - Sonos Play:1 at http://192.168.178.26:1400 udn: uuid:RINCON_B8E9375FA22201400 customsd call return: True, args: {'caps': ['search', 'trFavorites', 'alFavorites', 'arFavorites', 'ucPlaylists'], 'presentationMapVersion': '344', 'secureUri': 'http://192.168.178.23:50104/smapi/control', 'pollInterval': '30', 'csrfToken': 'qnUz2ENBJ2U1o2gVentwLbs/Xuc8Wt/y', 'authType': 'Anonymous', 'name': 'Alben', 'presentationMapUri': u'http://192.168.178.23:50104/5e0fc086-1c37-4648-805c-ec2aba2b0a27.xml', 'uri': 'http://192.168.178.23:50104/smapi/control', 'sid': '240', 'containerType': 'MService'}

There is stops and I have to perform Strg+C.

Soing the usual start command in the command line it seemt tork (like before), but no change in the sonos controller. I still have the old service with mixed up names.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/henkelis/sonospy/issues/88#issuecomment-412412628, or mute the thread https://github.com/notifications/unsubscribe-auth/AAxMW07meoKLL9PaErIQA9nk5k696FZ5ks5uQQ_tgaJpZM4V32GZ .

Viper525 commented 6 years ago

Hi,

that's what I meant with the 'usual start command'. I tried sudo ./sonospy_proxy -sSonospy=Alben,Alben.db,Alben.ini -sSonospy=Interpreten,Interpreten.db,Interpreten.ini -sSonospy=Charts,Charts.db,ChartsSampler.ini -sSonospy=Medleys,Medleys.db,Medleys.ini -sSonospy=Sampler,SamplerSoundtracks.db,ChartsSampler.ini -sSonospy=Hoerbuecher,Hoerbuecher.db,Alben_direct.ini -sSonospy=Hoerspiele,Hoerspiele.db,Alben_direct.ini

I just had a chance for a quick check this morning. Can it be that there is a buffer and it takes some time until the correct names will show up?

But sill the old mixed up names. :-(

Sebastian

henkelis commented 6 years ago

Hmm. If you stop it, what does the pycpoint.log file show for customsd?

On Mon, 13 Aug 2018, 09:16 Viper525, notifications@github.com wrote:

Hi,

that's what I meant with the 'usual start command'. I tried sudo ./sonospy_proxy -sSonospy=Alben,Alben.db,Alben.ini -sSonospy=Interpreten,Interpreten.db,Interpreten.ini -sSonospy=Charts,Charts.db,ChartsSampler.ini -sSonospy=Medleys,Medleys.db,Medleys.ini -sSonospy=Sampler,SamplerSoundtracks.db,ChartsSampler.ini -sSonospy=Hoerbuecher,Hoerbuecher.db,Alben_direct.ini -sSonospy=Hoerspiele,Hoerspiele.db,Alben_direct.ini

I just had a chance for a quick check this morning. Can it bee that there is a buffer and it takes some time until the correct names will show up?

But sill the old mixed up names. :-(

Sebastian

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/henkelis/sonospy/issues/88#issuecomment-412442075, or mute the thread https://github.com/notifications/unsubscribe-auth/AAxMW8q2A-Sc06oGZ-xSCKxVfGUZY9SZks5uQTXwgaJpZM4V32GZ .

Viper525 commented 6 years ago

content of pycpoint.log after stopping:

Args:
option.proxyonly: True
    Music service: Sonospy=Alben,Alben.db,Alben.ini
    Music service: Sonospy=Interpreten,Interpreten.db,Interpreten.ini
    Music service: Sonospy=Charts,Charts.db,ChartsSampler.ini
    Music service: Sonospy=Medleys,Medleys.db,Medleys.ini
    Music service: Sonospy=Sampler,SamplerSoundtracks.db,ChartsSampler.ini
    Music service: Sonospy=Hoerbuecher,Hoerbuecher.db,Alben_direct.ini
    Music service: Sonospy=Hoerspiele,Hoerspiele.db,Alben_direct.ini
Proxy. Name: Alben
Proxy. Name: Interpreten
Proxy. Name: Charts
Proxy. Name: Medleys
Proxy. Name: Sampler
Proxy. Name: Hoerbuecher
Proxy. Name: Hoerspiele

But as I'm not at home, I have no change to check the Sonos app at the moment what the services say in meantime and if there perhaps really has been an caching issue.

Viper525 commented 6 years ago

New Status: I was able to start my sonos app via VPN and it works great! (Good to know to prank somebody. :-p)

But: In the sonos App I still see: Alben (correct content) Charts (content of Interpreten) Hoerbuecher (content of Sampler) Hoerspiele (content of Hoebuecher) Hoerspiele (no content) Medleys (content of Charts)

henkelis commented 6 years ago

You need to add -r to your usual start command (it's missing in your reply and the log doesn't show any customsd entries).

Viper525 commented 6 years ago

Argh! I'm an idiot for that right after you explained the parameter to me! Sorry!

Aaaand: Now it's working perfect again! Thanks a lot!!!

henkelis commented 6 years ago

No problem.