svrooij / node-sonos-ts

:speaker: Sonos control library, use this library in your own appliction.
https://sonos-ts.svrooij.io/
MIT License
84 stars 18 forks source link

BUG: PlayNotification on grouped devices not playing #141

Closed theimo1221 closed 3 years ago

theimo1221 commented 3 years ago

What happened

Several devices where grouped up playing radio. An Event occured which normally results in each sonos device playing a notification. Those grouped devices didn't play the notification.

What did you expect to happen

Every device should have played the notification and ideally all previously grouped devices should regroup and continue.

How to reproduce it (minimal and precise)

  1. Open group and play radio (e.g. with phone)
  2. Play notification on one or several of the grouped device using e.g. PlayNotificationTwo
  3. Experience the group continuing without playing notification

Environment

Checklist

Please confirm the following before creating the issue.

svrooij commented 3 years ago

I don't have enough knowledge about your PlayNotificationTwo method. The issue described doesn't occur with the PlayNotification method.

You can off course try to fix it.

theimo1221 commented 3 years ago

okay thanks for clarification, thought it might be a more general problem.

So I'll dig into it 🙂

svrooij commented 3 years ago

I just remembered that for executing multiple commands after each other, you'll need to add a delay in between. For me 700-850ms works most reliable.

Are you also using delays?

theimo1221 commented 3 years ago

@svrooij I have some Telegram Command which I can abuse easily to see which Sonos device isn't properly running as it should: image

As seen in the image once my system recieves that messages it starts playing a notification on each device using PlayNotificationTwo.

Today running some more tests I discovered the following behaviour:

Test Case 1: System freshly started no radio running

Sending telegram results in all Sonos Devices speaking their respective message. Not every single one at the exact same time, but all of them spoke

Test Case 2: One device playing radio

Still everything as expected. Once I send the command radio pauses --> notification plays --> radio continues

Test Case 3: One device playing radio with another device in group

Still no problems: Radio stops on both, message gets spoken, radio continues

Test Case 4: Unplugging and replugging group leader

If sending command to early I get an 501 error which sometimes even clocks up the system in a way that even the other group member don't speak the message.

Additionally after I once recieved an error on a device I can't play a notification on it until I restart my application.

theimo1221 commented 3 years ago

I opened a PR to harden PlayNotificationTwo against some of the network issues. But one error still rises, which I can't resolve: UnhandledPromiseRejectionWarning: FetchError: network timeout at: http://192.xx.xxx.44:1400/MediaRenderer/AVTransport/Control

I'll look into trying your playnotification again. But it kinda is a problem for me, that if once a play notification fails, that system doesn't play anything again.

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 2.4.2-beta.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 2.5.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: