When I try to play sound with the playSound or karaf console command, I get this error in the log:
Failed playing audio stream 'org.openhab.core.audio.FileAudioStream@12ce044' as no audio sink was found.
My audio sinks show up in the console:
openhab> audio sinks
Sonos Move (sonos:zoneplayer:RINCON_542A1B75BDCC01400)
Sonos Move (sonos:Move:RINCON_542A1B75BDCC01400)
* Sonos Play:1 (Kitchen) (sonos:PLAY1:RINCON_347E5CC467EA01400)
Sonos Play:1 (Living Room) (sonos:PLAY1:RINCON_347E5CC468AE01400)
System Speaker (enhancedjavasound)
Web Audio (webaudio)
openhab>
And I’ve selected that Kitchen sink as default in the UI.
I can reproduce the error either by executing this command in the console:
openhab> audio play jetsons_doorbell.mp3
openhab>
or triggering this script:
logInfo( "RULE", "Play sound: '" + PlaySound.state.toString + "'" )
SonosPlay1Kitchen_Stop.sendCommand(ON)
// Kitchen
playSound( "sonos:PLAY1:RINCON_347E5CC467EA01400", PlaySound.state.toString, new PercentType(40) )
I’m running openhab v3.3.0 on a raspberry pi running raspbian bullseye and I imported these configs from an OH 2 install. I’m guessing that has something to do with it.
Update: I uninstalled the Sonos binding and removed each Sonos Thing. Then reinstalled the binding and the Kitchen Speaker Thing. As long as I was taking a hatchet, I rebuilt the script using the Blockly script.
This did resolve the sink not found error and now just plays dead air. I know it is dead air, because if I’m playing a song on the Sonos device, it is paused for a bit, then dead air, and then the song resumes.
This is what my log looks like:
2022-07-19 07:14:48.587 [INFO ] [openhab.event.RuleUpdatedEvent ] - Rule 'Doorbell' has been updated.
2022-07-19 07:14:53.782 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'PlaySound' received command jetsons_doorbell.mp3
==> /var/log/openhab/openhab.log <==
2022-07-19 07:14:56.479 [WARN ] [org.openhab.rule.Doorbell ] - undefined Sound file: jetsons_doorbell.mp3
==> /var/log/openhab/events.log <==
2022-07-19 07:14:56.609 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_Volume' changed from 15 to 40
2022-07-19 07:14:59.837 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_CurrentTrack' changed from Tinlicker - In Another Lifetime - Rebirth to - - e572c4db-26bc-464a-b98d-ee1dd9451ecd.mp3
2022-07-19 07:14:59.988 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_State' changed from STOPPED to TRANSITIONING
2022-07-19 07:14:59.994 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_MediaControl' changed from PAUSE to UNDEF
2022-07-19 07:14:59.997 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_Stop' changed from ON to OFF
2022-07-19 07:15:02.862 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_CurrentTrack' changed from - - e572c4db-26bc-464a-b98d-ee1dd9451ecd.mp3 to ODESZA - The Last Goodbye (feat. Bettye LaVette) - The Last Goodbye (feat. Bettye LaVette)
2022-07-19 07:15:02.865 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_State' changed from TRANSITIONING to STOPPED
2022-07-19 07:15:02.871 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_MediaControl' changed from UNDEF to PAUSE
2022-07-19 07:15:02.878 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_Stop' changed from OFF to ON
2022-07-19 07:15:19.976 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_Volume' changed from 40 to 15
2022-07-19 07:15:20.110 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_CurrentTrack' changed from ODESZA - The Last Goodbye (feat. Bettye LaVette) - The Last Goodbye (feat. Bettye LaVette) to Tinlicker - In Another Lifetime - Rebirth
Update: Update:
I poked around the console some more and I can get it to play out of the speakers with this command:
openhab> audio play enhancedjavasound jetsons_doorbell.mp3 80
But no dice through the sonos.
DEBUG log for the sonos binding:
==> /var/log/openhab/openhab.log <==
2022-07-19 22:12:07.149 [DEBUG] [s.internal.handler.ZonePlayerHandler] - playNotificationSoundURI: currentURI x-rincon-queue:RINCON_347E5CC467EA01400#0 metadata
2022-07-19 22:12:07.229 [DEBUG] [s.internal.handler.ZonePlayerHandler] - Handling notification while playing queue: currentQueueURI x-rincon-queue:RINCON_347E5CC467EA01400#0 trackPosition 0:00:03 currentTrackNumber 1
2022-07-19 22:12:07.421 [DEBUG] [s.internal.handler.ZonePlayerHandler] - setCurrentURI URI x-rincon-queue:RINCON_347E5CC467EA01400#0 URIMetaData
==> /var/log/openhab/events.log <==
2022-07-19 22:12:07.190 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_Volume' changed from 36 to 70
==> /var/log/openhab/openhab.log <==
2022-07-19 22:12:08.885 [DEBUG] [s.internal.handler.ZonePlayerHandler] - Polling job
2022-07-19 22:12:09.036 [DEBUG] [s.internal.handler.ZonePlayerHandler] - Polling job
2022-07-19 22:12:09.666 [DEBUG] [s.internal.handler.ZonePlayerHandler] - Polling job
==> /var/log/openhab/events.log <==
2022-07-19 22:12:10.598 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_CurrentTrack' changed from ODESZA - The Last Goodbye (feat. Bettye LaVette) - The Last Goodbye (feat. Bettye LaVette) to - - 4c42ef9c-ed75-4bd8-9e05-112a13dfee05.mp3
2022-07-19 22:12:10.761 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_State' changed from STOPPED to TRANSITIONING
2022-07-19 22:12:10.769 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_MediaControl' changed from PAUSE to UNDEF
2022-07-19 22:12:10.774 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_Stop' changed from ON to OFF
2022-07-19 22:12:13.819 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_CurrentTrack' changed from - - 4c42ef9c-ed75-4bd8-9e05-112a13dfee05.mp3 to ODESZA - The Last Goodbye (feat. Bettye LaVette) - The Last Goodbye (feat. Bettye LaVette)
2022-07-19 22:12:13.845 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_State' changed from TRANSITIONING to STOPPED
2022-07-19 22:12:13.852 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_MediaControl' changed from UNDEF to PAUSE
2022-07-19 22:12:13.860 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosPlay1Kitchen_Stop' changed from OFF to ON