WebCoRE asks a question, my voice response determines the action

text-to-speech
answer
query
voice
alexa

#164

I gotta say, if we could not adapt (to changing technology), then our SmartHomes would become very dumb, LOL


#165

THanks WCmore. I had an idea today that I wanted to add a yes no question to a piston and I had come to the conclusion that I should do it somehow with simulated switches, but had only a vague notion of how I would do it in my head. Just before starting to try and code something up I did a search and well this made things much simpler.

My litter box reminder piston now will ask if we cleaned it, if we say yes then it resets the reminder, if we answer no or don’t say anything it tells us the last time it was cleaned.

If ST screws up webcore too bad when they switch over I am going to be :face_with_symbols_over_mouth:.


#166

I changed mine to “Alexa okay” and “Alexa not now”, but I think yours are a bit more natural and memorable. I’ve struggled to ge the family to remember my new phrasing.


#167

With 24 years of Army service, I was tempted to change them to Affirmative and Negative. However, my wife - although very supportive of my military time, was not actually IN the Army and therefor did not appreciate those choices…


#168

Seems to be working but in my one piston I have setup so far the answer is “Yes I did”, or “No I did not”. Since No I did not works if you don’t say anything I added the yes answer to my question. Alexa tells you what the yes response is, after the question. I was worried it might take to long but it seems to be working.


#169

Question for the experienced…

I am trying to create a “morning” routine where I start with some music, then move into “Good Morning” and then my flash briefing.

Unfortunately, Amazon limits music to being the last item on routines, but I want it to be the first, play for 10 mins, then move onto the good morning then flash briefing.

So… I tested it out this morning and it was hopping all over the place, what do I need to do to make this work in sequence (once one is over, the next thing happens?):

image

Do I need a wait between each, or perhaps use a different command?

P.S. Muting is a great tool for the kid that won’t get up with his alarm by saying “Echo, STOP”. He has to get out of bed to physically turn it off, but by that time he is up (at least so far!).


#170

The music and Flash briefing will just start playing and then move to the next item in the piston. I know that is the case with music and I would assume it is the same for the flash briefing. So You probably need some waits


#171

Great questions Kevin, but it honestly deserves to be in a new topic, since it has absolutely nothing to do with this thread…


#172

Hello,
I just stumbled on this and I’m really excited about the possibility of it. However, I tried to set up a simple piston to test with and I am having no luck with anything. Initially, it would speak the response for neither a ye sor no answer, but that doesn’t even happen anymore. I’m really not sure what I did wrong because I used the example piston and didn’t change much.


#173

You moved the critical WAIT in that piston.
(IE: the WAIT must be AFTER the speak text, to give you time to respond)

You can see the original in my first post here. (Import code: “tj6nv”)


Side Note:

I am not sure that line 40-42 will do what you want. Normally, we cannot send a “Turn on” command to a contact sensor…


#174

Thanks - I just adjusted it and will test again when I get home. Even with the wait in the wrong place, I should still hear the question asked, shouldn’t I? Because I don’t.

Re: line 40-42 - that is a virtual switch for a TV - not sure why it shows as a contact sensor when anonymized.


#175

Well, if Switch 22 changed during the WAIT:
Afterwards, the statement will no longer be true. (the piston will cancel out)

If Switch 22 did not change during the WAIT:
then the “Speak” commands on line 34 and line 60 will fire within 10 milliseconds of each other.

Setting your logging level to Full will tell you more.
(both scenarios can be resolved with the WAIT positioned as in my original piston)


Just curious:
Have you been successful with the single command: “Speak text” in other pistons?


#176

I’ve never had any problems with the “speak text” function in other pistons to answer your question - it always works. I just tested again and still nothing is happening. Here is the updated piston and logs:


#177

I am still learning but your log seems to be showing what is happening after the 15 sec wait. The first line should be something like:

Received event [switch 22].switch = on with a delay of 68ms

The first line in your log is showing received event home.time which is a time event.

What happened after the trigger from switch 22 would seem to be something to look at, but maybe I am missing something


#178

From the abbreviated log, it looks like you did not respond with either Yes or No…
so the final block (lines 54-62) was executed.

According to the log, Echo should have said, “Sorry to bug you”…

pic

If that did not happen, I would first check the volume on that Echo. If the volume was already turned up, then I would test a simple “Speak” test in a new piston. Echo Speaks is notorious for loosing connection to your SmartHome.

After testing a new (single block) piston, if Echo Speaks is currently not working for you, please consult a previous thread or create your own… There are a ton of “Speech-to-text” threads out there already, and I would prefer to keep this page focused on the logic I have above.

Thank you.


#179

If your issue is not speech related, please turn on Trace to show more information in a new green snapshot… Plus, as @Terminal mentioned, we’d need to see a FULL log… (pure text is OK) showing the first event, the wait, and the final actions.


#180

So the reason I didn’t respond with yes or no is because the question doesn’t get asked so I have no idea when to say anything - all I get is the spoken text at the end indicating I didn’t answer. Copying the logs here:

3/6/2020, 9:04:20 AM +112ms
+0ms ╔Received event [Home].time = 1583503461959 with a delay of -1848ms
+120ms ║RunTime Analysis CS > 33ms > PS > 63ms > PE > 25ms > CE
+124ms ║Runtime (40416 bytes) successfully initialized in 63ms (v0.3.110.20191009) (122ms)
+125ms ║╔Execution stage started
+146ms ║║Comparison (enum) off is (string) on = false (1ms)
+147ms ║║Condition #7 evaluated false (9ms)
+149ms ║║Condition group #6 evaluated false (state did not change) (12ms)
+159ms ║║Comparison (enum) off is (string) on = false (1ms)
+161ms ║║Condition #11 evaluated false (9ms)
+163ms ║║Condition group #10 evaluated false (state did not change) (10ms)
+176ms ║║Comparison (enum) off is (string) off = true (2ms)
+179ms ║║Comparison (enum) off is (string) off = true (2ms)
+181ms ║║Condition #15 evaluated true (15ms)
+182ms ║║Condition group #14 evaluated true (state did not change) (17ms)
+186ms ║║Cancelling statement #16's schedules...
+689ms ║║Executed physical command [Echo - Mancave Echo Dot].playTextAndResume([Sorry to bug you]) (494ms)
+690ms ║║Executed [Echo - Mancave Echo Dot].playTextAndResume (497ms)
+693ms ║╚Execution stage complete. (568ms)
+695ms ╚Event processed successfully (694ms)
3/6/2020, 9:04:06 AM +760ms
+1ms ╔Received event [Mancave Occupied].switch = on with a delay of 484ms
+94ms ║RunTime Analysis CS > 17ms > PS > 56ms > PE > 21ms > CE
+97ms ║Runtime (40419 bytes) successfully initialized in 56ms (v0.3.110.20191009) (94ms)
+97ms ║╔Execution stage started
+104ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+105ms ║║Cancelling condition #2's schedules...
+106ms ║║Condition #2 evaluated true (5ms)
+107ms ║║Cancelling condition #1's schedules...
+107ms ║║Condition group #1 evaluated true (state changed) (6ms)
+109ms ║║Cancelling statement #3's schedules...
+192ms ║║Executed physical command [Echo - Mancave Echo Dot].playText([Do you want to turn on the TV?, 80]) (76ms)
+193ms ║║Executed [Echo - Mancave Echo Dot].playText (78ms)
+197ms ║║Executed virtual command [Echo - Mancave Echo Dot].wait (1ms)
+198ms ║║Requesting a wake up for Fri, Mar 6 2020 @ 9:04:21 AM EST (in 15.0s)
+202ms ║╚Execution stage complete. (104ms)
+203ms ║Setting up scheduled job for Fri, Mar 6 2020 @ 9:04:21 AM EST (in 14.997s)
+210ms ╚Event processed successfully (209ms)
3/5/2020, 11:21:05 PM +505ms
+2ms ╔Received event [Mancave Occupied].switch = off with a delay of 1506ms
+112ms ║RunTime Analysis CS > 27ms > PS > 64ms > PE > 20ms > CE
+114ms ║Runtime (40421 bytes) successfully initialized in 64ms (v0.3.110.20191009) (111ms)
+115ms ║╔Execution stage started
+121ms ║║Comparison (enum) off changes_to (string) on = false (1ms)
+122ms ║║Condition #2 evaluated false (4ms)
+123ms ║║Condition group #1 evaluated false (state did not change) (5ms)
+124ms ║╚Execution stage complete. (9ms)
+125ms ╚Event processed successfully (125ms)
3/5/2020, 11:05:37 PM +229ms
+2ms ╔Received event [Mancave Occupied].switch = on with a delay of 162ms
+85ms ║RunTime Analysis CS > 18ms > PS > 49ms > PE > 18ms > CE
+88ms ║Runtime (40418 bytes) successfully initialized in 49ms (v0.3.110.20191009) (85ms)
+88ms ║╔Execution stage started
+94ms ║║Comparison (enum) on changes_to (string) on = false (1ms)
+95ms ║║Condition #2 evaluated false (4ms)
+96ms ║║Condition group #1 evaluated false (state did not change) (4ms)
+97ms ║╚Execution stage complete. (9ms)
+98ms ╚Event processed successfully (98ms)

#181

Thanks for the logs and clarification. It looks like your current log does not match the piston you posted. (probably because you are making changes). It appears that you used different “speak” commands for the question (playText, which failed) and the spoken text at the end (playTextAndResume, which worked).

Perhaps make them both the same


3/6/2020, 9:04:06 AM =  (failed command)
[Mancave Occupied].switch = on
Condition group #1 evaluated true
Executed physical command [Echo - Mancave Echo Dot].playText([Do you want to turn on the TV?, 80])
Setting up scheduled job for Fri, Mar 6 2020 @ 9:04:21 AM EST (in 14.997s)

3/6/2020, 9:04:20 AM =  (working command)
Received event [Home].time = 1583503461959
Comparison (enum) off is (string) off = true  (Yes is off)
Comparison (enum) off is (string) off = true  (No is off)
Condition #15 evaluated true
Executed physical command [Echo - Mancave Echo Dot].playTextAndResume([Sorry to bug you])

#182

Okay we are making progress! I’m getting the question asked now but when I respond with “echo yes” (echo is my trigger word), she responds “sorry I don’t know that one”. Here is the log:

3/6/2020, 1:42:23 PM +778ms
+1ms ╔Received event [Home].execute = 35.199.11.29 with a delay of 91ms
+93ms ║RunTime Analysis CS > 17ms > PS > 49ms > PE > 27ms > CE
+95ms ║Runtime (40423 bytes) successfully initialized in 49ms (v0.3.110.20191009) (94ms)
+96ms ║╔Execution stage started
+105ms ║║Cancelling condition #2's schedules...
+106ms ║║Condition #2 evaluated false (5ms)
+107ms ║║Cancelling condition #1's schedules...
+108ms ║║Condition group #1 evaluated false (state changed) (9ms)
+110ms ║╚Execution stage complete. (13ms)
+110ms ╚Event processed successfully (110ms)
3/6/2020, 1:42:09 PM +284ms
+1ms ╔Received event [Home].time = 1583520130265 with a delay of -981ms
+96ms ║RunTime Analysis CS > 18ms > PS > 51ms > PE > 27ms > CE
+99ms ║Runtime (40423 bytes) successfully initialized in 51ms (v0.3.110.20191009) (98ms)
+100ms ║╔Execution stage started
+116ms ║║Comparison (enum) off is (string) on = false (1ms)
+118ms ║║Condition #7 evaluated false (9ms)
+119ms ║║Condition group #6 evaluated false (state did not change) (9ms)
+127ms ║║Comparison (enum) off is (string) on = false (2ms)
+128ms ║║Condition #11 evaluated false (7ms)
+129ms ║║Condition group #10 evaluated false (state did not change) (8ms)
+140ms ║║Comparison (enum) off is (string) off = true (1ms)
+143ms ║║Comparison (enum) off is (string) off = true (1ms)
+144ms ║║Condition #15 evaluated true (13ms)
+145ms ║║Condition group #14 evaluated true (state did not change) (14ms)
+147ms ║║Cancelling statement #16's schedules...
+591ms ║║Executed physical command [Echo - Mancave Echo Dot].playTextAndResume([Sorry to bug you]) (438ms)
+592ms ║║Executed [Echo - Mancave Echo Dot].playTextAndResume (440ms)
+595ms ║╚Execution stage complete. (495ms)
+596ms ╚Event processed successfully (595ms)
3/6/2020, 1:41:54 PM +710ms
+1ms ╔Received event [Mancave Occupied].switch = on with a delay of 123ms
+71ms ║RunTime Analysis CS > 15ms > PS > 34ms > PE > 22ms > CE
+74ms ║Runtime (40428 bytes) successfully initialized in 34ms (v0.3.110.20191009) (71ms)
+74ms ║╔Execution stage started
+81ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+82ms ║║Cancelling condition #2's schedules...
+83ms ║║Condition #2 evaluated true (5ms)
+84ms ║║Cancelling condition #1's schedules...
+85ms ║║Condition group #1 evaluated true (state changed) (6ms)
+86ms ║║Cancelling statement #3's schedules...
+549ms ║║Executed physical command [Echo - Mancave Echo Dot].playTextAndResume([Do you want to turn on the TV?, 80]) (455ms)
+549ms ║║Executed [Echo - Mancave Echo Dot].playTextAndResume (457ms)
+553ms ║║Executed virtual command [Echo - Mancave Echo Dot].wait (0ms)
+555ms ║║Requesting a wake up for Fri, Mar 6 2020 @ 1:42:10 PM EST (in 15.0s)
+558ms ║╚Execution stage complete. (484ms)
+559ms ║Setting up scheduled job for Fri, Mar 6 2020 @ 1:42:10 PM EST (in 14.996s)
+567ms ╚Event processed successfully (567ms)
3/6/2020, 1:41:15 PM +751ms
+1ms ╔Received event [Mancave Occupied].switch = off with a delay of 142ms
+108ms ║RunTime Analysis CS > 16ms > PS > 50ms > PE > 41ms > CE
+111ms ║Runtime (40427 bytes) successfully initialized in 50ms (v0.3.110.20191009) (109ms)
+112ms ║╔Execution stage started
+120ms ║║Comparison (enum) off changes_to (string) on = false (1ms)
+122ms ║║Cancelling condition #2's schedules...
+123ms ║║Condition #2 evaluated false (6ms)
+124ms ║║Cancelling condition #1's schedules...
+125ms ║║Condition group #1 evaluated false (state changed) (9ms)
+127ms ║╚Execution stage complete. (16ms)
+129ms ╚Event processed successfully (129ms)
3/6/2020, 1:39:50 PM +394ms
+1ms ╔Received event [Home].time = 1583519991505 with a delay of -1111ms
+153ms ║RunTime Analysis CS > 29ms > PS > 94ms > PE > 30ms > CE
+156ms ║Runtime (40425 bytes) successfully initialized in 94ms (v0.3.110.20191009) (153ms)
+157ms ║╔Execution stage started
+172ms ║║Comparison (enum) off is (string) on = false (2ms)
+173ms ║║Condition #7 evaluated false (7ms)
+174ms ║║Condition group #6 evaluated false (state did not change) (8ms)
+182ms ║║Comparison (enum) off is (string) on = false (1ms)
+183ms ║║Condition #11 evaluated false (7ms)
+184ms ║║Condition group #10 evaluated false (state did not change) (8ms)
+194ms ║║Comparison (enum) off is (string) off = true (1ms)
+196ms ║║Comparison (enum) off is (string) off = true (1ms)
+198ms ║║Condition #15 evaluated true (10ms)
+199ms ║║Condition group #14 evaluated true (state did not change) (11ms)
+201ms ║║Cancelling statement #16's schedules...
+707ms ║║Executed physical command [Echo - Mancave Echo Dot].playTextAndResume([Sorry to bug you]) (500ms)
+708ms ║║Executed [Echo - Mancave Echo Dot].playTextAndResume (502ms)
+711ms ║╚Execution stage complete. (555ms)
+712ms ╚Event processed successfully (712ms)
3/6/2020, 1:39:33 PM +349ms
+1ms ╔Received event [Mancave Occupied].switch = on with a delay of 150ms
+134ms ║RunTime Analysis CS > 43ms > PS > 66ms > PE > 25ms > CE
+137ms ║Runtime (40429 bytes) successfully initialized in 66ms (v0.3.110.20191009) (134ms)
+137ms ║╔Execution stage started
+143ms ║║Comparison (enum) on changes_to (string) on = true (0ms)
+145ms ║║Cancelling condition #2's schedules...
+146ms ║║Condition #2 evaluated true (4ms)
+146ms ║║Cancelling condition #1's schedules...
+147ms ║║Condition group #1 evaluated true (state changed) (6ms)
+149ms ║║Cancelling statement #3's schedules...
+3148ms ║║Executed physical command [Echo - Mancave Echo Dot].playTextAndResume([Do you want to turn on the TV?, 80]) (2992ms)
+3150ms ║║Executed [Echo - Mancave Echo Dot].playTextAndResume (2994ms)
+3154ms ║║Executed virtual command [Echo - Mancave Echo Dot].wait (1ms)
+3155ms ║║Requesting a wake up for Fri, Mar 6 2020 @ 1:39:51 PM EST (in 15.0s)
+3159ms ║╚Execution stage complete. (3022ms)
+3160ms ║Setting up scheduled job for Fri, Mar 6 2020 @ 1:39:51 PM EST (in 14.997s)
+3168ms ╚Event processed successfully (3168ms)
3/6/2020, 1:39:25 PM +517ms
+1ms ╔Received event [Mancave Occupied].switch = off with a delay of 110ms
+79ms ║RunTime Analysis CS > 17ms > PS > 40ms > PE > 21ms > CE
+81ms ║Runtime (40428 bytes) successfully initialized in 40ms (v0.3.110.20191009) (79ms)
+82ms ║╔Execution stage started
+88ms ║║Comparison (enum) off changes_to (string) on = false (1ms)
+89ms ║║Condition #2 evaluated false (3ms)
+90ms ║║Condition group #1 evaluated false (state did not change) (5ms)
+92ms ║╚Execution stage complete. (10ms)
+93ms ╚Event processed successfully (93ms)
3/6/2020, 1:39:05 PM +230ms
+1ms ╔Received event [Mancave Occupied].switch = on with a delay of 491ms
+76ms ║RunTime Analysis CS > 17ms > PS > 38ms > PE > 21ms > CE
+174ms ║Runtime (40425 bytes) successfully initialized in 38ms (v0.3.110.20191009) (172ms)
+175ms ║╔Execution stage started
+182ms ║║Comparison (enum) on changes_to (string) on = false (0ms)
+184ms ║║Cancelling condition #2's schedules...
+185ms ║║Condition #2 evaluated false (5ms)
+186ms ║║Cancelling condition #1's schedules...
+187ms ║║Condition group #1 evaluated false (state changed) (8ms)
+189ms ║╚Execution stage complete. (13ms)
+190ms ╚Event processed successfully (190ms)
3/6/2020, 1:38:52 PM +236ms
+0ms ╔Received event [Home].time = 1583519933196 with a delay of -961ms
+113ms ║RunTime Analysis CS > 22ms > PS > 64ms > PE > 28ms > CE
+115ms ║Runtime (40424 bytes) successfully initialized in 64ms (v0.3.110.20191009) (114ms)
+116ms ║╔Execution stage started
+134ms ║║Comparison (enum) off is (string) on = false (2ms)
+135ms ║║Condition #7 evaluated false (8ms)
+136ms ║║Condition group #6 evaluated false (state did not change) (9ms)
+147ms ║║Comparison (enum) off is (string) on = false (2ms)
+148ms ║║Condition #11 evaluated false (8ms)
+149ms ║║Condition group #10 evaluated false (state did not change) (9ms)
+160ms ║║Comparison (enum) off is (string) off = true (1ms)
+162ms ║║Comparison (enum) off is (string) off = true (2ms)
+164ms ║║Condition #15 evaluated true (11ms)
+164ms ║║Condition group #14 evaluated true (state did not change) (13ms)
+167ms ║║Cancelling statement #16's schedules...
+722ms ║║Executed physical command [Echo - Mancave Echo Dot].playTextAndResume([Sorry to bug you]) (547ms)
+723ms ║║Executed [Echo - Mancave Echo Dot].playTextAndResume (549ms)
+725ms ║╚Execution stage complete. (609ms)
+726ms ╚Event processed successfully (726ms)
3/6/2020, 1:38:26 PM +248ms
+2ms ╔Received event [Mancave Occupied].switch = on with a delay of 1329ms
+782ms ║RunTime Analysis CS > 179ms > PS > 211ms > PE > 392ms > CE
+785ms ║Runtime (40434 bytes) successfully initialized in 211ms (v0.3.110.20191009) (782ms)
+786ms ║╔Execution stage started
+794ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+796ms ║║Cancelling condition #2's schedules...
+797ms ║║Condition #2 evaluated true (6ms)
+799ms ║║Cancelling condition #1's schedules...
+800ms ║║Condition group #1 evaluated true (state changed) (9ms)
+802ms ║║Cancelling statement #3's schedules...
+11941ms ║║Executed physical command [Echo - Mancave Echo Dot].playTextAndResume([Do you want to turn on the TV?, 80]) (11128ms)
+11942ms ║║Executed [Echo - Mancave Echo Dot].playTextAndResume (11130ms)
+11946ms ║║Executed virtual command [Echo - Mancave Echo Dot].wait (1ms)
+11948ms ║║Requesting a wake up for Fri, Mar 6 2020 @ 1:38:53 PM EST (in 15.0s)
+11951ms ║╚Execution stage complete. (11165ms)
+11953ms ║Setting up scheduled job for Fri, Mar 6 2020 @ 1:38:53 PM EST (in 14.996s)
+11961ms ╚Event processed successfully (11961ms)

#183

If you named the SimSwitches as recommended, then this works right out of the box:

  • “Echo, turn on Answer Yes” … or…
  • “Echo, turn on Answer No”

Now there is a trick in Alexa to use a more “friendly phrase”. Originally, I suggested creating Alexa Routines to do that using Yes and No. Since then, Amazon has “reserved” those words. The advice now is to use an alternative word or phrase. (Such as “Yes please” and “No thank you”)


If you are unfamiliar with Alexa Routines, I have more details in my first post above. Look for this section:

pic