wasLastSpokenToDevice not updating


1) Give a description of the problem
I am using Echo Speaks on Hubitat, and have a piston that should respond using the echo that was last spoken to. The issue is that while the piston gets called, it is not updating the lastspokentodevice, so it always responds from one (in this case, the one in my office). This did work at one point, but stopped over a year ago, so I just hard-coded in some things as a workaround, but am finally getting some time to look at it.

2) What is the expected behavior?
When you speak to an echo device, it will respond to you using that device. In my case, I have a piston so that when I ask what doors and windows are open, it will speak which ones (or that all are closed).

3) What is happening/not happening?
It is not updating the “lastspokentodevice” so it always responds via the last one it had recorded (from a couple of years ago), which happens to be the one in my office.

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full
10/12/2022, 1:34:50 PM +969ms
+4ms ╔Received event [9011Hub].:df07296575f5dbc1b2f7333da6ffc20c:.@dynLastEchoSpokeToPistonTrigger = @dynLastEchoSpokeToPistonTrigger with a delay of 55ms, canQueue: true, calledMyself: false
+53ms ║RunTime initialize > 52 LockT > 1ms > r9T > 41ms > pistonT > 38ms (first state access 10 5 47)
+56ms ║Runtime (7386 bytes) initialized in 41ms (v0.3.114.20220917_HE)
+59ms ║╔Execution stage started
+69ms ║║Comparison (dynamic) 1665606890827 changes = true (1ms)
+72ms ║║Condition #2 evaluated true (5ms)
+75ms ║║Condition group #1 evaluated true (condition changed) (9ms)
+152ms ║║Executed physical command [Echo - Basement Echo Dot].getDeviceActivity() (68ms)
+218ms ║║Executed physical command [Echo - Dining room echo].getDeviceActivity() (61ms)
+287ms ║║Executed physical command [Echo - MBR Echo].getDeviceActivity() (63ms)
+355ms ║║Executed physical command [Echo - Office Echo Dot].getDeviceActivity() (63ms)
+372ms ║║Comparison (string) false is (boolean) true = false (2ms)
+375ms ║║Comparison (string) false is (boolean) true = false (1ms)
+377ms ║║Comparison (string) false is (boolean) true = false (1ms)
+379ms ║║Comparison (string) false is (boolean) true = false (1ms)
+382ms ║║Condition #6 evaluated false (25ms)
+383ms ║║Condition group #5 evaluated false (condition did not change) (27ms)
+398ms ║║Empty device list
+401ms ║║Executed virtual command log (3ms)
+408ms ║║Device ‘’:null not found
+410ms ║║Executed virtual command log (2ms)
+417ms ║╚Execution stage complete. (360ms)
+423ms ╚Event processed successfully (419ms)


I think this is an issue that happened with echo speaks.

some of web socket is not working correctly, and has not been fixed in echo speaks.

You can verify this by starting with echo speaks and see what events its devices are generating


Looks like same problem and it’s something that amazon’s change broke… and I believe @Pantheon used that feature a lot.


“wasLastSpokenToDevice” at one time was the backbone of much of my home/music automation. Since it died over a year ago, I had to rewrite 3-4 dozen pistons.


@Pantheon - Could I ask what you are using instead of wasLastSpokenTo?


Basically I had to abandon the practice of not having to specify which Alexa I was speaking to or to which location in my house I wanted. For instance, I used to be able to say “Alexa, play rock music” and my pistons would know which echo was spoken to, using the “wasLastSpokenToDevice”, and start playing music on my audio system in that room. Now, it’s more of “Alexa, play rock music in the great room”. Not a big deal for me but the WAF dropped because she has trouble remembering the room names and command sequences throughout the house. SO, instead of having a single piston for “rock” music that could be used anywhere in my house, now I have to basically have a copy of that piston for each room. Or use higher level programming to accomplish the same thing. But I still have to use multiple very similar pistons to cover my whole house.

I have a hardwired whole home audio system. I know I could accomplish the same functionality with a Sonos system or similar. Just more $$$ and my wife considers all of this automation stuff just a big waste of time and $$$.


Thank you, @Pantheon - I appreciate it!

Off to write more pistons, I guess… :slight_smile: