Problem is that, when I go to build a piston, that global variable is not available for me to choose to do anything with it.
This is another part Iâm stumped on.
How can I edit the text of the piston?
I know how to edit a piston, but when I go in there, there is no way of modifying the âtextâ on my end.
The only option I have is to choose one of the other items in a list that is pre-populated.
@ReceivedMsg is the final message, and @Pistontrigger activates my Speaking Piston
Now, thereâs two things going on here. If I want the message to go to a particular piston, I set AlarmVolume=99 to that Echo. The piston looks for that value and sends the message there. If thereâs no 99, then it sends it to the Alexa that received the command.
(Switch 3 is my ANNOUNCEMENTS switch. I can turn off all Announcements by telling Alexa to âTurn off warningsâ.)
The trick is to throw in the getDeviceActivity somewhere as close as possible to the beginning of the piston to start the activity search. I have it in both pistons, just to be safe. It still takes 2-3 seconds, but is nowhere near the original 10+ seconds that it used to be, which was very impractical.
@nathancu
Now it appears as though my global variable is no longer being updated.
Does that mean that, I have to modify it to âdeviceâ each time I want to add it to a piston, and then change it back to âdynamicâ when Iâm done so that it goes back to being able to be set dynamically?
Well, the frustrating thing is that, earlier, all I did was import @mebejedi 's piston, and change the devices so it was using mine, and it worked.
Now though, after tweaking, and stuff, for some reason, itâs not.
So, I went so far as to delete my previously created pistons that I was working with for this, and started fresh with a new copy of @mebejedi 's piston (it now being the only one), and itâs still not working.
I think there must be something kooky going on with my system.
So, I suspect I have something completely unrelated to troubleshoot.
Is this part working for you? I kinda worry about that, since there will always be a LastSpokenTo deviceâŚeven if it was spoken to several hours/days ago.
You are correct. Once itâs set, it stays. I was thinking about clearing it out on a timer. But considering itâs always running in the background and how much I use Alexa - itâs usually one of my 3 most popular devices. It was on a todo list to change, but I havenât needed to.
How are you testing it? I did it by going to one Echo and asking the time, and then going to another Echo, asking the time,b and then immediately testing the piston.
Ya. Iâm pretty much doing the same thing. I have three of them right next to me (1st Gen Echo, Echo Show 5, and my Windows 10 computer); each using a different âwake wordâ.
Goofy thing is that, whereas earlier, when I first tested it, it was working, and would shift the spoken text from the single webCoRE piston to whichever Alexa device I was asking the question to, later, it just got stuck on one of them. Also, it was no longer updating the global variable.
I havenât tried since I got back to the office. I will check it now and report back here in this commentâŚ
Update:
OK, now it looks like it is back to updating the global variable, but Iâm consistently seeing it get hung upâŚ
Piston waited at a semaphore for 9267ms
âŚand the update to the global variable doesnât happen until after that.
Also, I noticed just now when I re-imported another copy just to see what it looks like right away, even though it asked for and I gave it 5 devices, it only has three for
device Echos =
Does that matter at all?
At any rate, the one Iâm actually using has just three actual devices, and that field only shows one of them.
Also, when I test now, when it does work, it only works on the two ânativeâ Alexa devices, and not Windows 10 unit.
Weird that it would work before, but not now.
OhâŚto test, I just have a very simple piston in webCoRE that says
If THIS SWITCH turns on
Using @theGlobalVariable
Speak THIS
âŚand as I test it just now, itâs stuck on sending the spoken msg to just one of the native Alexa devices, even though I tested with the other one.
Ya, but like I said, itâs extremely simple.
Here it is thoughâŚ
I also have an Alexa Routine.
When it hears me say âThank youâ,
it turns on a particular simulated switch in SmartThings (Switch 47 here in this green screenshot).
Additional info:
I just remembered that when I initially started testing this thing, I had the piston actions to send the msg written right into the same piston as the one doing the work to update the global variable, and it may have been when I separated them that it stopped behaving nicely.
So, as another step in testing, Iâm going to recombine, and see what happensâŚ
OK, with it all recombined (other related pistons completely disabled, AND I donât even need the WAIT in there at all), it works, but only for the two native Alexa devices. When I engage the Windows 10 unitâs Alexa app in exactly the same way, the global variable never gets updated with the Windows 10 unitâs device name like it does with the two native ones.
SoâŚperhaps the Alexa app for Windows 10 doesnât even report wasLastSpokenToDevice, and maybe I only imagined that this piston worked with the Windows 10 unit during my initial round of testing?
I would add the getactivity command to the beginning of the speaking speaking piston as well. You should also have the âif wasLastSpokenToDevice=true, save devices to Xâ check right before the actual speaking.
Ya, I just recombined it all back into a single piston, and it works just fine (except for the Windows 10 Alexa endpoint).
In that case, I donât even need to use the global variable.
Is there a simplified way of doing the speaking piston if I wanted to keep them separated, or would it basically be just about the same amount of code for each one (Iâm not in a place I can actually look at it right now)?