(creating a queue) Append to a list of strings while pulling the first item in the list


I want to figure out a way to queue up a list of strings while a piston is running. In Javascript terms…I’d like a way to push() and shift() the list of strings. Add to the end, and pull from the front.

Long version:
I’m more than happy to figure out the rest of the piston on my own. I can do the majority of it no problem. The main thing I am hung up on is pushing and shifting the array.

If this isn’t possible, then I suppose the alternative is to just keep an index…The loop just keeps going further and further into the queue…when it reaches the end, it just cleans out the list and sets the index back to zero, assuming there’s an easy way to clear out a string list variable. If there isn’t…I suppose the next option would be to set values to blank after they are pulled. And the loop is set to not do anything if the next item in the list is blank.

If I can figure out these two things, I think I can get everything else done:

When Adding / Pushing to the list:
I’m assuming I will have to use some sort of expression to check the length of the string list, add one, and then append the string?

When Pulling / Shifting from the list:
Here is where I’m stuck…I can’t figure out an option to shift the array…aka, pull the first item, and shift everything else forward.

For those curious, here is what I’m trying to accomplish:
I have pretty terrible ADHD. I usually have a list of things I know I need to get done, I just get distracted with other things. So to stay on task, I want to try out an idea using WebCoRE, IFTTT and Echo Speaks…

Basic Idea…I tell Google to add a chore to my list. Then Alexa announces that chore every 5 minutes, until I hit a button saying it’s done. Then Alexa moves onto the next item in the list and starts announcing that every 5 minutes.

(I’m using both Google Assistant and Alexa because I hate having to say “Alexa Trigger BLAH”. Whereas the Google Assistant trigger with IFTTT lets you customize whatever you want, with 3 different phrasings for 1 action, and a custom response)

The process may end up being more than one piston. But here is what the process would be…
I tell Google Assistant “queue up take out the trash” (or something like that)
IFTTT will have an applet saying:

IF (Google Assistant receives phrase "queue up $")
THEN (Webhook request to WebCoRE, containing "$" string in arguments)

The piston will take the string and append it to the end of the string list

There will be a loop that runs every X minutes…it will Speak() on my Echo device the most recent string it pulled from the string list.

It will continue Speaking this string every X minutes until I push a button, which will then tell it to move onto the next string.

My research progress (also for my own personal reference when looking back on this post):
Currently reviewing: Implementing a Queue
Info on how to clear an array while testing: Deleting an array element


So easy,

Alexa - show me the list of “assistant hiring” websites.

Joke aside, I’ll be watching this post closely because if this is possible - I’m sure it’s - I need to learn. Because I can use this kind of help from alexa.

I’m already using something similar BUT i need to TYPE the task in google calendar and when the time comes alexa says the task. Without repeating.

@chadbaldwin pls post the final piston and steps when this is done.


No problem. I’m inching my way through it right now.

I’m currently working with a CSV list instead…Idea came from one of the posts I linked at the bottom of my post.

I’ll definitely include all steps needed when done.


I’m going to tag some people to this post.


Some of the names that helped lots of people with interesting ideas.


Looks like I’ve got it working…I might try and rearrange parts, or maybe find ways to consolidate it into more clear logic, but it’s working!

There’s one glitch, but it’s pretty minor.

So here’s the flow:

  • “Hey Google, Queue up take out the trash”
  • IFTTT passes “take out the trash” to WC
  • WC adds that string to the beginning of a CSV string variable
  • WC starts a loop to announce the string every X minutes (for testing I have it set to 20 seconds)
  • If the button is pushed, then it finds the current task, and replaces it (removing it from the string)
  • The loop starts over again, and picks up the next item in the list
  • If the last item is removed, it tells you “good job”.

The only bug seems to be that when you add a new item to the list, it resets the timer for the repeating announcement. So if you say “queue up take out the trash”…it will be added to the queue and will be announced immediately. If you then say “queue up do the dishes”, it will be added to the queue, and then alexa will immediately announce “take out the trash”.

Pretty minor issue…but at least the general concept is there and working?

Global Variable: @ChoreQueue string

Piston 1: Add to the queue:

Piston 2: The meat and potatoes

IFTTT Configuration:

    Google Assistant
        Say a phrase with a text ingredient
            What do you want to say?
                queue up $
            What do you want the Assistant to say in response?
                okay, added to your reminder list
    Make a web request
        Content Type
            {"Chore": "{{TextField}}"}


@ike2018 FYI, in case you’re not subscribed to the topic, see my latest update. I got it working with one minor bug.

However, I can see this opening up a whole new world of potential automations.

For example…I could set up something like…“Hey google, start morning checklist”

And she can start reading through a list of pre-set up checklists, and each item is marked off using a button. Maybe even eventually I could set up some sort of skip, next, remove and repeat options using different buttons.


I’m loving it… I was actually checking IFTTT if we have something for Alexa… (my setup is echo and st hub not google)

thank you so much for the detailed info…


Yeah…Alexa is going to be a bit more difficult with IFTTT since they don’t have any triggers with text ingredients. My solution works well since I have both a Google Home and an Alexa in the kitchen. However, you may be able to make it work using the “Item Added to your todo list” Alexa trigger.

Or, buy a google home mini :slight_smile: I think you can get a first gen from best buy for 30 bucks.


I might just do that actually. I love simple solutions.

I wonder if anyone out there using ST hub AND Google hub in the same house? For seperate tasks?


Wow…didn’t realize I’d become a household name. It’s a privilege to share a list with @WCmore. That dude’s a legend.


oh that was a typo… Sorry
(just kidding)


You guys are too much!! LOL


I’ll tell you who the ROCK STARS are on this forum…ALL of us. I have been on here for over a year now and EVERYONE here has been helpful.


You are absolutely right, @Pantheon

This is, by far, the best forum in the multiverse, thanks to the awesome members!


I’m wondering if I should split this off into it’s own thread now that I’ve got it all working fairly well. Seeing how the original post for this is not actually for the whole project, and was more for just one part.


Also…I just learned about cast-web-api today, which I guess is similar to Echo Speaks, but for google home. The only difference is you have to run a service on your local network. But from what I can tell, it should all work the same once set up. It allows setting up google home devices as devices in smartthings and gives the ability to make announcements from them.

This is good for me, because it could eliminate my need for both a google home device AND an alexa/echo device in order for all of this to work.


One more update…

I’ve since modified this project to include more functionality. I now have google home commands to:

  • Stop (stop making announcements, but does not clear the queue…“pause” may be a more fitting verb)
  • Resume (pick up where I left off)
  • Clear (clears the queue and stops announcements…may change this to “stop”)
  • Add to front (adds the request to the front of the queue…you have a task you need to get done prior to the one that it is currently asking you to do)
  • Add to back (normal operation, adds request to the end of the queue)

Other options I am considering:

  • Read entire queue - Reads off the entire list of items
  • Stop the queue when location mode switches to away or my presence sensor switches to away
  • Add multi-room announcements - will need time constraints so that if I’m using it when my GF has already gone to bed, it won’t be announcing things in the bedroom
  • Also send text message, push notification or other alert to phone


FYI…migrated project over to its own thread. Please direct future comments to this thread: