Can I Have webCoRE direct Output to the Last Active Echo Speaks Alexa Device?

Here’s how I use mine:
This piston is a generic piston I use anytime I’m trying to do a speech announcement. It accepts a few arguments - sMessage being the message itself. The other arguments are a set of flags that determine how the announcement behaves, do I do the last Echo, a subset of echos or ALL of my echos. I’m also monitoring the status of a virtual switch to determine if the alert will happen at all. (Wife Acceptance Factor). It’s not at all finished but it’s workable.

Notice I’m basically setting up a list of devices to target based on the flags… You could clean that all out if you want. The default no argument ‘null’ condition on bAnnounce and bOverride sends the announcement to the last spoken Echo device. This requires the Global Variable @LastSpokenTo to be not NULL

Now @LastSpokenTo is set within 60 seconds any time an Echo updates its .wasLastSpokenTo attribute to TRUE in this piston:

So whenever I call the speech piston it doesn’t have to ask - it just points and shoots. I did not find any good reason to update the device status - 60 seconds resolution is good enough for me.

This is an example of calling the Speech piston from another. I have a piston that evaluates whether my garage doors SHOULD be open and if not, alerts by message and voice. (Yes, I know I have some work to do in this one both for optimization and to handle multiple alerts at once, but it gets the job done.)

A lot of code here - but it should help you see how it all fits together.

2 Likes