Announcements Happening When They Shouldnt be


#21

@ike2018 or @WCmore,
Hey guys, hope you are having a merry Christmas!! As you can see from my attached piston, I am slowly starting to understand things, and am growing my pistons. I am currently still working on the doors piston; but I seem to be having some issues with this section.

It seems when I am trying to pass a variable into the Speak section, it never seems to speak; or get chosen when I am using Random. And then in the evaluation section when I am creating this expression, it just comes up null. I can’t figure out what I have wrong? Maybe you experts can take a closer look at it.

I am passing a variable into speak in another much smaller simpler piston, so maybe something else is going on here. But I been at it all day with no luck.

Here is the entire piston.

Hopefully its something easy you guys can recognize.


#22

Your snippet “Set variable” looks alright to me…

I use an entirely different method to convert text to speech, but I have seen many people mentioning that the set volume, speak and restore should be in separate commands.

Hopefully one of them can chime in to clarify.


#23

Hi guys
Merry Christmas to you too…
My experience with text to speech was not so great espcially using variables. Somehow it fails to speak many many times (Sonos speakers all around the house) I decided not to rely on Text to Speech anymore.

Here is what I did - I know not a solution to your piston - but maybe you like it?

  • I used a web site that turns text to speech and lets you download mp3s
    http://www.fromtexttospeech.com
  • I like the option called DAISY.
  • created bunch of mp3 files.
    Alarm, cat door is left open.
    Main door was left open more than 20 seconds. Somebody count the cats.
    Someone knocking on the front door. Camera 1 is activated, take a look.
    so you get the picture.
  • Uploaded all of them to my website (you can even use a free website hosting, it’s very simple)or host them yourself in a spare computer in your house. (if you liek this idea, hosting them yourself I can link a youtube tutorial for it)
  • Used all of these mp3 extention with their URL links in RANDOM command…
    PLAY TRACK : (Either variable or direct link) ww w.examplesite.com/soundfiles/maindooralarm.mp3 for instance…

Works perfectly. Never had a problem yet.


#24

@WCmore is your method to convert speech more difficult? Or too difficult for me to comprehend?

I need to at least get the {doorContact} to pass, otherwise I cannot use it at all. You see here how I am getting null in the expression? Im guessing that shouldnt be happening?

I tried taking things out and such, but cant seem to pass the variable if it is in the random function. I passed it without random.


#25

This seems interesting @ike2018, and something I will surely look into. It is little too time consuming for me to get involved this week. I felt as if I was just tieing up what I needed to get things to work like I needed to…

I’d love to get this working, even if I have to switch up the commands. I’d like to know what is causing the issue, for future things I want to do.


#26

It requires an old Android, a speaker connected to it, about $5 for the app in the PlayStore, and maybe a half hour to set it up the first time, but I like this method.

Before trying that though, can you humor me by testing your “c8pjt” piston above that is only sending the speak command? (no set volume and no restore)

If that works with your random, then the issue will likely resolve using different syntax.

Surely, someone who is using your method can chime in with more specifics.


#27

Yes, I have tried that. Here are the logs… I stuck the whole thing on a test switch a bit ago, just so I didnt have to open a door the entire time. Here are the logs…Now, it seems like its not running correctly at all…Before, I was saying it was definitly something in my Speak expression…

12/25/2018, 8:24:24 PM +610ms
+1ms ╔Received event [Test Button].switch = on with a delay of 508ms
+133ms ║RunTime Analysis CS > 31ms > PS > 64ms > PE > 39ms > CE
+137ms ║Runtime (51288 bytes) successfully initialized in 64ms (v0.3.109.20181207) (134ms)
+139ms ║╔Execution stage started
+152ms ║║Comparison (enum) on changes = false (1ms)
+155ms ║║Condition #38 evaluated false (7ms)
+157ms ║║Condition group #1 evaluated false (state did not change) (10ms)
+159ms ║╚Execution stage complete. (21ms)
+162ms ╚Event processed successfully (162ms)
12/25/2018, 8:21:13 PM +87ms


#28

Well, don’t forget that the TEST button will do nothing in this piston. it only runs when “contact changes to open” on line 32 above


#29

I took that part out while testing it out… and just put it on a switch, to see if I could get it to run… But it’s not…

It’s sort of a principal thing to me, that I’m just curious what the heck I am doing wrong at this point.

My variables just will not pass to the speak.


#30

Did you test with a single sentence?(in a variable) to see if your speakers are getting the variable…
just to understand if the problem is syntax or something else…


#31

Yes I did. So attached is the stripped down version, where in Cold If statement and Cool If statement, i took out the variables out of the Random Speaks. And it worked fine. I kept the Hot If statement in just for reference to see what I had in before. So it is definitely something in the syntax of the Random Speak with the variables that is hanging me up. Just dont know what.

Here are the logs

+1ms ╔Received event [Test Button].switch = on with a delay of 1065ms
+91ms ║RunTime Analysis CS > 14ms > PS > 35ms > PE > 43ms > CE
+94ms ║Runtime (47221 bytes) successfully initialized in 35ms (v0.3.109.20181207) (93ms)
+95ms ║╔Execution stage started
+105ms ║║Comparison (enum) on changes = true (1ms)
+107ms ║║Cancelling condition #38’s schedules…
+108ms ║║Condition #38 evaluated true (6ms)
+110ms ║║Cancelling condition #1’s schedules…
+111ms ║║Condition group #1 evaluated true (state changed) (9ms)
+123ms ║║Comparison (decimal) 49.0 is_greater_than_or_equal_to (integer) 75 = false (2ms)
+125ms ║║Condition #4 evaluated false (11ms)
+126ms ║║Condition group #3 evaluated false (state did not change) (13ms)
+140ms ║║Comparison (decimal) 49.0 is_inside_of_range (decimal) 32.1 … (integer) 74 = true (3ms)
+142ms ║║Condition #12 evaluated true (12ms)
+144ms ║║Condition group #11 evaluated true (state did not change) (14ms)
+148ms ║║Cancelling statement #22’s schedules…
+157ms ║║Executed virtual command setVariable (3ms)
+164ms ║║Comparison (string) test2 is_not (string) = true (2ms)
+166ms ║║Cancelling condition #21’s schedules…
+168ms ║║Condition #21 evaluated true (8ms)
+169ms ║║Cancelling condition #20’s schedules…
+170ms ║║Condition group #20 evaluated true (state changed) (12ms)
+174ms ║║Cancelling statement #24’s schedules…
+678ms ║║Executed physical command [Echo - Living Room].speak([test2]) (498ms)
+680ms ║║Executed [Echo - Living Room].speak (500ms)
+685ms ║║Executed virtual command [Echo - Living Room].wait (0ms)
+686ms ║║Waiting for 2000ms
+2694ms ║║Executed virtual command [Echo - Living Room].setVariable (3ms)
+2707ms ║║Comparison (decimal) 49.0 is_less_than (integer) 32 = false (2ms)
+2709ms ║║Condition #29 evaluated false (10ms)
+2710ms ║║Condition group #28 evaluated false (state did not change) (13ms)
+2713ms ║╚Execution stage complete. (2618ms)
+2715ms ╚Event processed successfully (2714ms)

#32

I don’t know if this will help, but here is one of my speech command with the random built-in.
(it occasionally uses an old phrase, but I don’t mind)

Notice the random section is outside the quotes.


#33

Oh, I see your issue!!

You need to keep your variables outside of quotes if you are using an Expression box.
(not 100% sure of the policy using Value because I hardly ever use that box)

You might also want to ditch the commas in your speech since that screws up the random code as well


#34

I did fiddle around with removing the extra commas along the way… But didn’t have any luck there.

How do I keep the variables outside of the quotes? Should I still write the variable is {}?


#36

I use an expression box… and variables are kept outside the quotes, with no curly brackets required.


#37

Im really trying man, thought I was on to something but no dice…Im going to keep trying some different ways…I think it is something with the Random in my expression.


#38

I agree. I would be tempted to make a new piston for testing. Only a single line of code to make it quick and easy to identify. (no triggers so the test button will work) And log the results of the variable to console for easy evaluation


#39

Think I got it…What a pain in the ass…I had to put a space " " in front of the Random statement…then use single quotes…

" "random({doorContact} ‘Opened’, ‘Someone Opened the’ {doorContact},{doorContact} ‘Opened Its hot as fuck outside close it’, ‘Its’ {outsideTemp} ‘degrees outside and’ {insideTemp} ‘degrees inside lets keep it that way Close the’{doorContact},{doorContact} ‘Opened Its Hot Outside Dont Keep it Open’,{doorContact} ‘Opened Its Hotter than the Devils Balls outside Close it’,{doorContact} ‘Opened I am Sweating my nuts off close it’, {doorContact} ‘Opened I am Sweating my tits off close it’)

And I removed the commas. How do you take into pauses, without commas though?


#40

I think this effectively put the random outside the quotes. :+1:
Since that is your only double quotes, you can delete " " and it will run the exact same.

On an unrelated note:
You can use single quotes (IE: it’s hot) if you use double quotes to surround the text. (IE: “it’s hot”)

For example:
A line like this:
'Its' {outsideTemp} 'degrees outside'
can be changed to
"It's "{outsideTemp}" degrees outside"

Notice the double quotes allow for the single apostrophe, and I added a space inside the quotes before & after the variable. Otherwise, it will be seen as:
Its67degrees outside

One small observation:
When I copied and pasted your code:
‘Its’
it is seen as having a beginning and a closing quote. I always code with the single quote next to the Enter button, which displays as '
That one never gives me issues.


If your code above worked for you, the next level of testing would be to add commas back, just make sure they are inside quotes. I use commas in spoken text all the time, and occasionally I use random text, but I don’t think I have tested random with commas. It might be possible though if kept inside the quotes.


#41

Well @WCmore and @ike2018 it is safe to say I can close this one. Everything is working pretty solid, and I cannot thank you guys enough. Attached is the final Piston. I went ahead and took out the setVolume things, because I just felt like it was causing more issues than it was worth. I instead just set the volume in a separate piston, throughout time intervals of the day.
Until next time boys, but don’t think this is the last time you are going to hear from me.

Thanks again.