webCore - Randomize announcements?

Yes, since the volume level argument isn’t required, it can’t be assumed it will be implemented. As you’ve found, looks like Sonos does not implement the command to accept the volume parameter.

I am mistaken - I was looking at the old, pre-super connect device handler for Sonos. The current (and super lan connect enabled) Sonos device does implement the Audio Notification capability. My bad!

1 Like

Thanks for the quick reply…

Ok, so then why does playText throws the error when used with volume?

The Sonos does not accept the volume parameter for the playText() command. The Audio Notification capability specifies the String message parameter as required, but not the volume parameter. So the Sonos command signature is def playText(String msg) which is why the error is thrown.

1 Like

But @Jim, hold on a second. Since we’re talking about required vs optional, the “optional” attribute of a parameter does not imply it’s requirement to not be there. Optional means it can be provided or not. Nothing in the documentation suggests that some DTHs may accept it, some may not. Being optional releases the caller from the burden of sending that parameter, but not the callee from the requirement to accept it. The DTH should accept it and ignore it, rather than not accept it. That’s how it work with all programming languages I know. Does that make sense?

1 Like

That makes sense to me, and it’s how I’d do it. + @juano2310 regarding this case. Juan, should Sonos accept the volume level parameter for the playText() command?

2 Likes

Did this ever get resolved? I’m about to embark on a new journey with alarm settings and Sonos playText and want to make sure I’m doing it right. @ady624 @juano2310 @Jim

Hi @Fe2_O3! @Jim is playText() defined in any capability? As far as I can see Audio Notifications only defines playTrack(string, number), playTrackAndResume(number, string), playTrackAndRestore(string, number).
That said I see other commands that do support volume
command “playTextAndResume”, [“string”,“number”]
command “playTextAndRestore”, [“string”,“number”]

You are correct - playText() isn’t defined in any capability.

1 Like