Directing Echo Speaks to particular Echos depending on which piston fires [SOLVED]


#1

1) Give a description of the problem
I use Echo Speaks along with @Bamarayne 's method that sends all notifications to a specific “Speaking” piston. Whereas his uses various light and contract triggers to determine which Echos to send the notifications to, I’d like to be able to designate which Echos ahead of time. I assume this will require an array, and need help coding it.

2) What is the expected behaviour?
For example, an open gate door starts the OPEN GATE piston. I already have a global variable called @WhichEcho. I’m assuming that, for an array, I’d probably need another global variable to designate how many devices.

Gate Piston: If “gate opens”, then for 1 thru 3, @WhichEcho = Echo 1, Echo 3, Echo 4", WhichEchoNumber = 3

Speaking Piston: For 1 thru WhichEchoNumber, @WhichEcho speaks “The Gate is open”

For another Piston, such as doors opening, I would only designate Echos 1 and 2. For yet another Piston, I would designate Echo 4, and so on.

I’d also like to do this because I’ve created a “Quiet Mode” piston to stop all announcements, and I’d like to keep that in the Speaking piston only for simplicity. Otherwise, I have to encode it into other pistons as well.

3) What is happening/not happening?
Have not started the piston yet. Hoping to get some pointers.

**4) Post a Green Snapshot of the piston!
(Right now, I have the “Gate is open” speech inside the Gate piston, instead sending it to the Speaking piston)

(This is my current kludgy example. I don’t want to write a line for every possible scenario of Echo choices)


#2

Well, it would appear that I’ve created my own solution. My first Piston, WhichEcho Switches, used virtual switches to designate particular echos. I noticed the AlarmVolume on one of my Echos was at 70%, so I decided to try and set the AlarmVolume to 99% for whichever particular Echo I wanted to speak.

Then the @PistonTrigger starts up the Speak Control piston, which then checks to see which Echo has an AlarmVolume of 99 and places them into a device list. Those Echos are then placed into an asynchronous loop which plays the announcement on each of them almost simultaneously. Finally, all AlarmVolumes are turned back to 70.

This wouldn’t work for anyone who uses the AlarmVolume for…well…an alarm, but perhaps they can find another setting to use. I had tried using TrackData before this, but it didn’t seem to work.

So now, using just my Announcement Piston, my Gate is Open Piston sends an announcement to ALL the Echos:

But my Door is Open Piston sends most messages to the Living Room and Computer, but different messages can be sent to the Computer and Master Bedroom. I could also change which Echos get messages depending on other conditions, such as time of day, etc.