Sonos Speech Quit Working for Expressions with Variable


#1

1) Give a description of the problem
I created a piston that would speak the weather forecast every morning. This worked for some time and then quit after awhile. I did some testing this morning to see if I could figure out the cause. The piston is firing on the desired days and time, but no sound is played. I setup another piston to test and was able to get a string constant to be played, but if I use an expression with a variable, no sound is played. If I use two Speak Text commands, the first with a constant and the second using an expression with a variable, only the first test is spoken.

Has there been a change recently that would have broken the use of expressions with variables in Speak commands?

2) What is the expected behavior?
Using a Sonos speaker, the Speak text “The time is {$time}” would produce output sounds giving the current time.

3) What is happening/not happening?
Speak text “This is a test” works
Speak text “The time is {$time}” does not work

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
5/12/2018, 8:14:33 AM +691ms
+1ms ╔Received event [Switch Test].switch = on with a delay of 115ms
+86ms ║RunTime Analysis CS > 14ms > PS > 33ms > PE > 39ms > CE
+88ms ║Runtime (37297 bytes) successfully initialized in 33ms (v0.3.104.20180323) (87ms)
+89ms ║╔Execution stage started
+98ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+100ms ║║Cancelling condition #6’s schedules…
+100ms ║║Condition #6 evaluated true (5ms)
+101ms ║║Cancelling condition #1’s schedules…
+102ms ║║Condition group #1 evaluated true (state changed) (8ms)
+104ms ║║Cancelling statement #2’s schedules…
+118ms ║║Executed physical command [Light Bulb Bonus].on() (9ms)
+118ms ║║Executed [Light Bulb Bonus].on (11ms)
+121ms ║║Cancelling statement #7’s schedules…
+270ms ║║Executed physical command [Speaker Master Bath].playText([This is a test]) (142ms)
+270ms ║║Executed [Speaker Master Bath].playText (144ms)
+276ms ║║Calculating (string) The time is + (string) 8:14 A.M. >> (string) The time is 8:14 A.M.
+315ms ║║Executed physical command [Speaker Master Bath].playText([The time is 8:14 A.M., 50]) (35ms)
+316ms ║║Executed [Speaker Master Bath].playText (37ms)
+319ms ║║Cancelling statement #9’s schedules…
+323ms ║║Executed virtual command [Light Bulb Bonus].wait (1ms)
+324ms ║║Requesting a wake up for Sat, May 12 2018 @ 8:14:44 AM MDT (in 10.0s)
+328ms ║╚Execution stage complete. (239ms)
+330ms ║Setting up scheduled job for Sat, May 12 2018 @ 8:14:44 AM MDT (in 9.995s)
+338ms ╚Event processed successfully (338ms)


#3

Unfortunately he’s right, TTS doesn’t work anymore with Expressions. It’s been about two weeks, I DID have the days weather speak over my Samsung Speakers each morning on a motion trigger, but now all she says is “NULL”.

It was this "Today’s forecast {$weather.forecast.forecast.txt_forecast.forecastday[0].fcttext_metric} " " Today’s Low "{$weather.forecast.forecast.simpleforecast.forecastday[0].low.celsius} {$weather.conditions.current_observation.weather} {$weather.alerts.alerts.description}

Then I tried putting it in a variable, it showed up fine, but she still says “NULL”.

So now I have my Google Homes speak the same weather forecast and it’s fine, hoping TTS Expressions works again with Samsung…


#4

I’ve always had trouble with “speak text” - but had much more success with “speak text and restore” / “speak text and resume”. I have several Pistons using those for my Sonos speakers and they have been working just fine.


#5

Thank you.

I was able to get it to work using either resume or restore. However, I was not able to find any documentation on the difference between the variants of speak. Can you provide any details on the difference between resume and restore?


#6

I’m not 100% certain, but I believe that “speak text and restore” is used to restore attributes that you saved beforehand using the “Capture attributes to a [local or global] store”.

I think “speak text and resume” automatically captures and then restores all of the speaker attributes.

Keep in mind that Sonos speakers can’t capture the previous track or where that track was interrupted, so the best you can hope to restore / resume is the playlist or station you were listening to before the TTS is spoken. You will have to add a Play action as well to restart the music.