Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to play after alexa has played music #15

Open
johnnyfleet opened this issue Aug 25, 2022 · 4 comments
Open

Unable to play after alexa has played music #15

johnnyfleet opened this issue Aug 25, 2022 · 4 comments
Assignees

Comments

@johnnyfleet
Copy link

johnnyfleet commented Aug 25, 2022

Hi there - I'm posting here, but don't know if this should go to one of the underlying libraries. I've noticed a specific scenario which seems to be generating an error when trying to play something using the NFC tag reader.

The issues invovles when music is already playing that was triggered by a request via Alexa and then attempts made to play via nfc tag reader.

Steps to recreate

  1. Reset sonos and raspberry pi.
  2. Play something through the nfc tag - all works fine (see logs below)
  3. Ask alexa to play something e.g. 'Alexa, play Kings of leon'. Music switches and plays new request.
  4. Remove the nfc tag and replace it. Errors with a comment about setting crossfade.
  5. nfc approach will continue to fail, even when the music stopped, until I use the sonos app to choose something manually from spotify/mylibrary.
  6. After manually setting, add the nfc tag, works all fine.

Logs

From pm2 log

1. Add an nfc tag after resetting sonos and raspberry pi

0|npm  | [0] ACS ACR122U 00 00 detected TAG_ISO_14443_3 with UID 041ea9b2ed6c81
0|npm  | [0] 
0|npm  | Read from NFC tag with message:  spotify:user:spotify:playlist:37i9dQZF1DWVFJtzvDHN4L
0|npm  | [0] Detected 'spotify' service request
0|npm  | [0] Resetting repeat
0|npm  | [0] Resetting shuffle
0|npm  | [0] 
0|npm  | Resetting crossfade
0|npm  | [0] Clearing Sonos queue
0|npm  | [0] Fetching URL via HTTP api: http://localhost:5005/Sun Room/spotify/now/spotify:user:spotify:playlist:37i9dQZF1DWVFJtzvDHN4L
0|npm  | [0] 
0|npm  | Sonos API reports:  { status: 'success' }
0|npm  | [0] 
0|npm  | Read from NFC tag with message:  command:shuffle/on
0|npm  | [0] Detected 'command' service request
0|npm  | [0] Fetching URL via HTTP api: http://localhost:5005/Sun Room/shuffle/on
0|npm  | [0] Sonos API reports:  { status: 'success' }
0|npm  | [0] 
0|npm  | Read from NFC tag with message:  command:next
0|npm  | [0] Detected 'command' service request
0|npm  | [0] Fetching URL via HTTP api: http://localhost:5005/Sun Room/next
0|npm  | [0] 
0|npm  | Sonos API reports:  { status: 'success' }

2. Logs after playing something via alexa and then re-tagging the nfc tag

0|npm  | [0] 
0|npm  | ACS ACR122U 00 00: TAG_ISO_14443_3 with UID 041ea9b2ed6c81 removed
0|npm  | [0] 
0|npm  | ACS ACR122U 00 00 detected TAG_ISO_14443_3 with UID 041ea9b2ed6c81
0|npm  | [0] 
0|npm  | Read from NFC tag with message:  spotify:user:spotify:playlist:37i9dQZF1DWVFJtzvDHN4L
0|npm  | [0] Detected 'spotify' service request
0|npm  | [0] Resetting repeat
0|npm  | [0] 
0|npm  | Resetting shuffle
0|npm  | [0] 
0|npm  | Resetting crossfade
0|npm  | [1] 
0|npm  | 2022-08-25T22:11:52.981Z ERROR 
0|npm  | [1]   Error: Got status 500 when invoking /MediaRenderer/AVTransport/Control
0|npm  | [1]     at Object.invoke (/home/pi/node-sonos-nfc/node_modules/sonos-discovery/lib/helpers/soap.js:99:10)
0|npm  | [1]     at /home/pi/node-sonos-nfc/node_modules/sonos-discovery/lib/models/Player.js:682:19
0|npm  | [0] Error: Unexpected response while turning crossfade off: 500

3. Logs after changing song int he sonos app, then re-tagging the nfc tag

0|npm  | [0] ACS ACR122U 00 00: TAG_ISO_14443_3 with UID 041ea9b2ed6c81 removed
0|npm  | [0] 
0|npm  | ACS ACR122U 00 00 detected TAG_ISO_14443_3 with UID 041ea9b2ed6c81
0|npm  | [0] Read from NFC tag with message:  spotify:user:spotify:playlist:37i9dQZF1DWVFJtzvDHN4L
0|npm  | [0] Detected 'spotify' service request
0|npm  | [0] Resetting repeat
0|npm  | [0] 
0|npm  | Resetting shuffle
0|npm  | [0] 
0|npm  | Resetting crossfade
0|npm  | [0] 
0|npm  | Clearing Sonos queue
0|npm  | [0] Fetching URL via HTTP api: http://localhost:5005/Sun Room/spotify/now/spotify:user:spotify:playlist:37i9dQZF1DWVFJtzvDHN4L
0|npm  | [0] 
0|npm  | Sonos API reports:  { status: 'success' }
0|npm  | [0] 
0|npm  | Read from NFC tag with message:  command:shuffle/on
0|npm  | [0] Detected 'command' service request
0|npm  | [0] Fetching URL via HTTP api: http://localhost:5005/Sun Room/shuffle/on
0|npm  | [0] 
0|npm  | Sonos API reports:  { status: 'success' }
0|npm  | [0] Read from NFC tag with message:  command:next
0|npm  | [0] Detected 'command' service request
0|npm  | [0] Fetching URL via HTTP api: http://localhost:5005/Sun Room/next
0|npm  | [0] 
0|npm  | Sonos API reports:  { status: 'success' }

Notes on hardware set up

Just in case it helps to narrow down, this is my set up:

  • Sonos Play:1 (older model with no voice assistant)
  • Amazon echo dot 1st generation - paired with the Sonos as the primary speaker.
  • Raspberry Pi 3 Model B Rev 1.2
@johnnyfleet
Copy link
Author

Cross posted: jishi/node-sonos-http-api#899

@johnnyfleet
Copy link
Author

I also tried creating a new instance of node-sonos-http-api on a separate machine using https://github.com/chrisns/docker-node-sonos-http-api.

I updated the usersettings/json to point to it and re-run. This produced the same results. I wanted to check whether a newer version on node-sonos-http-api ficed the issue but it seems not.

I've cross-posted the issue there as seems the error may be lower down the stack than this nfc part of the program.

@johnnyfleet
Copy link
Author

johnnyfleet commented Jun 11, 2024

I seem to be able to workaround the issue by removing "reset_crossfade": true from the usersettings.json

@ryanolf
Copy link
Owner

ryanolf commented Sep 12, 2024

Hi there! That's really annoying. I'm glad you found a workaround. I think we should probably not be giving up the music playing when we fail to set crossfade. Apparently the system can't set crossfade in this situation, but that's probably OK. I'll have some time soon to fix this.

@ryanolf ryanolf self-assigned this Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants