Why isnt my piston speaking? But is sending an SMS


#1

1) Give a description of the problem
Why is my piston not speaking on Echo Speaks. Echo speaks is working for everything else I have.

2) What is the expected behavior?
To send a random message, with the weather forecast.

3) What is happening/not happening?
The sms message is coming thru fine. Just no speaking.

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach any logs (From ST IDE and by turning logging level to Full)
12/31/2018, 8:11:40 AM +481ms
+2ms ╔Received event [Mom Announcements].switch = off with a delay of 954ms
+133ms ║RunTime Analysis CS > 25ms > PS > 49ms > PE > 58ms > CE
+136ms ║Runtime (44464 bytes) successfully initialized in 49ms (v0.3.109.20181207) (132ms)
+137ms ║╔Execution stage started
+147ms ║║Comparison (enum) off changes_to (string) on = false (1ms)
+149ms ║║Cancelling condition #2’s schedules…
+150ms ║║Condition #2 evaluated false (7ms)
+151ms ║║Cancelling condition #1’s schedules…
+152ms ║║Condition group #1 evaluated false (state changed) (10ms)
+155ms ║╚Execution stage complete. (19ms)
+156ms ╚Event processed successfully (156ms)
12/31/2018, 8:11:37 AM +55ms
+1ms ╔Received event [Mom Announcements].switch = on with a delay of 963ms
+134ms ║RunTime Analysis CS > 27ms > PS > 55ms > PE > 52ms > CE
+137ms ║Runtime (44197 bytes) successfully initialized in 55ms (v0.3.109.20181207) (135ms)
+138ms ║╔Execution stage started
+149ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+151ms ║║Cancelling condition #2’s schedules…
+152ms ║║Condition #2 evaluated true (8ms)
+153ms ║║Cancelling condition #1’s schedules…
+155ms ║║Condition group #1 evaluated true (state changed) (10ms)
+161ms ║║Cancelling statement #6’s schedules…
+753ms ║║Calculating (string) Today’s forecast is: + (string) Partly cloudy early then becoming cloudy with periods of rain this afternoon. High 48F. Winds SE at 5 to 10 mph. Chance of rain 100%. Rainfall near a quarter of an inch. >> (string) Today’s forecast is: Partly cloudy early then becoming cloudy with periods of rain this afternoon. High 48F. Winds SE at 5 to 10 mph. Chance of rain 100%. Rainfall near a quarter of an inch.


#2

I have not used Speak in a while, have you tried it with setVolumeSpeakAndRestore()?


#3

I have, both of them do not work. It seems to be when I add in the weathMsg Variable, which is giving me some weather details. As soon as I put that into the speak, then I get no audio. If I take that out, then it will speak?

I do not understand why.


#4

Ah, ok, that makes more sense now that you explained the weather part. What I would suggest is
try and append the weathMsg after you do your random text, remove it from nextMsg variable.

Speak {nextMsg} {weathMsg}


#5

Yes I tried that as well along the way.

It seems any instance of the {weathMsg} anywhere in the speak command just keeps it quiet. It does send the SMS message though, with the proper text. Which is baffeling me?


#6

I will give it a try when I’m at a location with an echo device.


#7

Thank you @eibyer, I greatly appreciate it.

What I am trying to do, just for some background, as maybe you have a better idea.

My mother comes every morning to take my kids to school.

I was trying to have random personalized greeting for her, and then read the weather for the day.

I have an echo show; so what I ideally wanted to do, was to use the Echo Routines, so that I could use the built in weather feature of the Echo Show, which shows the forecast and all on the screen.

But I found out, if I attempt to put a custom message, inside the routines, with a virtual switch, they are overlapping each other, and the personal message just gets cut off.

So my plan B was to put it all into a Piston in Webcore, which really isnt my first choice. Unless you can think of another way to incorporate it into the Echo Show.

Thanks for all the help.


#8

One small observation:
You start your variable {nextMsg} with double-double quotes (which serves no purpose), and then use single quotes in the rest of that line. Also, the weather is in double quotes. Either will work, but you need to be consistent throughout your piston. (all single quotes or all double quotes)


I agree with @eibyer in splitting up the two strings during processing, and then putting them together at the speak command.

Set variable nextMsg = random("Good morning", "Top of the morning", "Looking good")
Set variable weathMsg = $weather.forecast.forecast.txt_forecast.forecastday[0].fcttext

Speak {nextMsg} {weathMsg}

Since a picture is worth a thousand words, here is an example from one of my pistons. (written as an expression) The previous 7 lines (not shown) is gathering & storing data into the 7 variables, and this one combines them all with the appropriate spacing and punctuation between them.

The highlighted sections are inside double quotes, the variables are kept outside the quotes.


#9

@WCmore, I start my variable {nxtMsg} with the double-double quotes, because anytime I try to do a random expression, with variables in, if i start with random, it does not output anything. The only way I figured to fix this, was adding the " " in front of random, and then going to single quotes. That then gives me a result.

Your picture is fantastic, and perhaps is exactly what I am looking for, with a couple of tweaks. Does this speak on your Echo? If so can you perhaps show me the other 7 variables storing the data; so I can try to adjust mine to work properly?

Thanks for your help.


#10

If I remember correctly, when we made lots of changes to this originally (a week ago), you had added the double-double quotes long before we made lots of improvements to it. I don’t remember you removing “” towards the end of our tweaks. (notice my double quote-space-double quote above is to add a space to the spoken text)

Yes. I have set mine up so any notification that starts with a ® will be spoken out loud.
I use this method.

I don’t mind doing this, but I didn’t use random in those above. Do you still want to see them?


#11

Maybe this random example will be helpful, even though it contradicts a lot of what we have suggested above, LOL

For complex randoms, I would still do it in it’s own step


EDIT
Actually upon closer inspection, there is no contradiction other than random not being in it’s own line. Notice the double quotes surround the normal text, the variables are kept outside the double quotes, and the random is entirely outside the double quotes. (with the individual phrases being in single quotes)


#12

@WCmore you are correct. You were helping me with another piston last week. LOL. You seem to be helping me alot lately, I appreciate it. In that one I kept the " " before the random in order to keep things working.

I don’t know why, or if I am doing something wrong. But if I put random() in an expression, and inside that random I use a combination of text and variables, I cannot get it to output an answer, unless I put the double quotes before. See below.

If I dont have any variables in the expression, then I do not need to use the " " before the random. See below

Nonetheless, I do believe I got this working now. I dont know if this was the problem or not, but I had to add " " around all the text, in my weathMsg variable; similar to what you mentioned. The strange thing is that I was receiving the same result before adding them. And the SMS messages were sending without adding them. It just seemed to not want to Speak without adding them.

So, I would love to see how you are doing your weather piston, if you don’t mind sharing. I feel this is the best way I am learning, is seeing what other people are doing.

Now with all that being said, maybe you can offer your advice. I was going to tie this piston, into a Routine in Alexa, so when my mother comes to take my kids to school, she merely says, “Alexa, I am here to take the boys”. And the piston runs and turns the TV off.

It seems when I do it this way, that its not really running smoothly, it hiccups a bit, and almost seems not to want to run. Is there a way, to just invoke this from an Alexa saying, without using their built in routines?


#13

With thousands of pistons under my belt, I have never used variables inside a random. (although I have done randoms inside a variable as seen in my last post) I think you will find it much easier to grasp if you gather your variables separately, your randoms separately, and then combine into one long spoken phrase as seen in my last two images. (Pro tip: if you use double quotes consistently, then you can use apostrophes like: It’s raining)

My advice is to use webCoRE for all of your coding logic. (whenever possible)
The only “coding” I do in Alexa is to make short friendly phrases toggle long-named devices.
Everything else is powered and controlled by webCoRE.
(In your case, she could say something simple like, “Alexa, it’s me” to run that piston to turn off TV etc)

To clarify, I do not use any routines in Alexa. But, I do use Alexa to toggle Simulated Switches. WebCoRE is monitoring those switches, and takes over all the logic from there. The reaction time is less than a half second.


#14

I cannot share my import code, but this is the first half of my piston that runs when I go to work.
(I use Alexa to turn on my SimSwitch called “Work”)

The first 34 lines of code is simply gathering data & storing it in variables. The final line combines them all into one line so my house can speak the text out loud.


#15

Your piston is fantastic, and will get me started to doing things properly. As good practice I am going to try and start breaking down my speak commands as much as possible. It seems my random() problem only occurs if I lead with random, and then put a variable in it. I have yet to put a random later in the speak command as you have.

You mention this below…

What would I use in webcore to say something to Alexa , and fore her to respond to and run a piston in Webcore; aside from telling her to turn something on and off. Can I have her say, “Alexa I’m here” and then have the switch turn on? And do this entirely thru webcore? I haven’t come across this yet anywhere, and wasnt sure if it was possible.

I am really appreciative of your help on this stuff man. Really sky is the limit with what can be done here, and I am looking forward to getting everything running smoothly.


#16
  • Create a Simulated Switch in the IDE. (let me know if you don’t know how)
  • Add that device to both webCoRE and Alexa as usual
  • Create a one-line routine in Alexa, when you say a “short phrase”, she will turn on a long named device. (in this case, the SimSwitch)
  • Create a new piston in webCoRE that runs when that SimSwitch changes to on
  • Sit back and enjoy your smooth automation.

#17

Ok yes, this is what I am doing. So there is still some sort of stuff you need to do in Alexa. The routine needs to be created in Alexa. Thats what I am doing now…

But I was turning on a few switches with that routine. I probably should just add those switches in the piston…To keep the routine simple.

I got it now…

My last question, there is no way to silently show the weather forecast on the Echo Show is there? While this piston is running?


#18

Yes, this is the key. Keep Alexa as dumb as possible, LOL


As far as I know, you are correct. I have succeeded using webCoRE to do this, but it is not silent.
Well technically, I don’t say a word, but webCoRE is sending a verbal command to my Echo Show, LOL


#19

Just to clarify, if your Simulated Switch has a “friendly” name, you can bypass Alexa Routines entirely, and trigger the piston by saying something like, “Alexa, turn on work”.

But if you want to use a cool phrase like, “Alexa, it’s party time” then yes, you’d need a one line routine to point that phrase to the right SimSwitch.


#20

But then Alexa Speaks? Am I understanding you correctly? Basically what I was wanting to do, was to have my Piston run, but also show the forecast on the Alexa Show, sort of like she does with her built in routine, but without her speaking it… There is no way to do this correctly?