Sonos say only working once

Tags: #<Tag:0x00007f432ee46fd8>

Hi all

I’m trying to use say() together with my Sonos speakers, but I’m facing a strange issue.
The following rule doesn’t work if my Sonos controller (on my mobile device) says “No music selected”.

Sonos_office_notificationvolume.sendCommand(25)
say("Simple voice test.", "voicerss:enUS", "sonos:PLAY1:office")

If I start some music first, executing the rule works correctly one time.
When I execute the rule a second time, it doesn’t work anymore. I first need to start and stop some music again for it work.

I can also reproduce it in the karaf console with

smarthome:audio play sonos:PLAY1:office doorbell.mp3

It only works, if there is or was something playing on that Sonos speaker.

Any ideas?

I don’t see sucgmh behaviour on my system not do I have an idea why.
I would set the log:level to DEBUG for the Sonos binding and for a test try it using a rule without setting the notificationvolume ( setting that once should be sufficient).

Thanks, I will try to collect more information. Quickly tried to set the loglevel in the console with

log:set DEBUG org.openhab.binding.sonos

but I don’t see much in the generated logfiles.
Also tried to have the sonos logs written in a seperate files according to the documentation, but the file is not generated:

# File appender - Sonos
log4j.appender.Sonos=org.apache.log4j.RollingFileAppender
log4j.appender.Sonos.layout=org.apache.log4j.PatternLayout
log4j.appender.Sonos.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n
log4j.appender.Sonos.file=${openhab.logdir}/Sonos.log
log4j.appender.Sonos.append=true
log4j.appender.Sonos.maxFileSize=10MB
log4j.appender.Sonos.maxBackupIndex=10

# Logger - Sonos
log4j2.logger.org_openhab_binding_sonos.level = DEBUG, Sonos
log4j2.logger.org_openhab_binding_sonos.name = org.openhab.binding.sonos

Will need to read up on that…

unfortunately, the docs have not been updated yet (It’s on my to-do list :slight_smile:) to reflect the changes that log4j2 brings

See here how to log to a separate file: Log4j2 Sample Config

Great, thanks for the link. Will try that!

1 Like

I think for Sonos you need to set org.eclipse.smarthome.binding.sonos

Ah thanks! Guess we have to look in the code for that information?

Anyway, the logfile is now used, but I only get one type of entry in it:
19-Nov-2018 10:58:09.002 [DEBUG] [e.binding.sonos.internal.handler.ZonePlayerHandler] - Polling job

So something is still not quite right. Here is the config I’m using now:

# Sonos
log4j2.logger.Sonos.name = org.eclipse.smarthome.binding.sonos
log4j2.logger.Sonos.level = DEBUG
log4j2.logger.Sonos.additivity = false
log4j2.logger.Sonos.appenderRefs = Sonos
log4j2.logger.Sonos.appenderRef.Sonos.ref = Sonos

log4j2.appender.Sonos.name = Sonos
log4j2.appender.Sonos.type = RollingRandomAccessFile
log4j2.appender.Sonos.fileName = /var/log/openhab2/Sonos.log
log4j2.appender.Sonos.filePattern = /var/log/openhab2/Sonos.log.%i
log4j2.appender.Sonos.immediateFlush = true
log4j2.appender.Sonos.append = true
log4j2.appender.Sonos.layout.type = PatternLayout
log4j2.appender.Sonos.layout.pattern = %d{dd-MMM-yyyy HH:mm:ss.SSS} [%-5.5p] [%-50.50c] - %m%n
log4j2.appender.Sonos.policies.type = Policies
log4j2.appender.Sonos.policies.size.type = SizeBasedTriggeringPolicy
log4j2.appender.Sonos.policies.size.size = 10MB
log4j2.appender.Sonos.strategy.type = DefaultRolloverStrategy
log4j2.appender.Sonos.strategy.max = 10

This ever get resolved? I think I’m bailing on Sonos and getting a Echo Plus but mine won’t play anymore either. Very basic say command right now that worked before and no longer.

JR

Unfortunately not. But I didn’t spend an awful lot of time to resolve it to be honest. I went a similar way and use a Google Home Mini now to output any spoken commands. Works great so far!

Which Sonos binding are you using AND did you start music via the echo before?
I case both is a Yes, I suspect it to be the bug that is in the version which comes with the 2.4 stable release, it is resolved in the snapshot version.

The one in the Paper UI 2.4 stable. As for starting the music via the echo, not sure but it’s possible I hit the play button on it to try and get it to come back alive. So I install my bindings thru the Paper UI, how would I replace this with one in the addons folder and what would it break in doing so?

Thanks.

JR

See this

I my case, I started a radio station via the Echo. The Sonos controller does show an indication if the music/radio is started via the Echo!

In order to only use the updated jar, delete the Binding via PaperUi and drop the new .jar into the addons folder. Shouldn’t break anything.