play random sequence for gpio input

perigalacticon

New elf
Joined
Nov 21, 2019
Messages
37
Location
Troy, MI, USA
Is there a way to get fpp to play a random sequence from a set triggered by a GPIO input? I have a set of of sequences in a playlist. When a button is pressed, I want the manually started (already running) background sequence to stop, and a random sequence from my set to be played, to completion. Then I want the background sequence to resume when triggered sequence is finished. All sequences have their own audio that must be played. And I don't want additional button presses to register when the triggered sequence is playing. Can this be done with a script? I haven't done anything with scripts before, I would really appreciate if someone could help me out to make this work before Halloween night.

Thanks,
Stephen
 

Skymaster

Crazy elf
Global moderator
Generous elf
Joined
Dec 19, 2021
Messages
1,063
Location
Western Sydney
Most probably there's no response because no one actually knows how to achieve it, or haven't seen the thread.
I can't comment directly on what they are thinking though :)

As for input to the problem statement at hand - I'm not sure about the random sequence side of things.
There was a post on the FPP Facebook yesterday about doing something similar, but only with a single sequence. I am not sure whether it'll ignore future button presses either.
Scripting could definitely be used - you can do pretty much anything with a script- however I haven't delved into that in any detail as yet so I'm not sure how to accomplish it.


View: https://www.facebook.com/groups/FalconPlayer/permalink/3341233799484913/
 

Zuseleets

Full time elf
Joined
Oct 12, 2016
Messages
289
Location
Townsville
Yeah you can do it. Its a script that you need to download from the script repositry in FPP first, then you need to configure your GPIO . Im not sure if there is a script for random playlists, or if it's a script for a random sequence. Just have a scroll through the list of scripts to see which one suits your needs.
 

Kingfisher

Apprentice elf
Joined
Mar 6, 2021
Messages
52
I'm doing something similar...

You can push one of 12 - 18 buttons (things still need to be checked) to activate any number of different things, from fog filled bubbles, bubbles and even snow to audio and lights. Basically the entire show.

The way I do it is I use QLC+ on a laptop and an Arduino pro micro that acts as a usb keyboard. You push a button on the fence, that gets translated to a keyboards input like "A" and QLC+ runs the associated que list.

It's a bit more complicated than that, involving feedback loops to lock certain functions, so that the kids can't smash 3 buttons and have 3 different audio tracks playing.

There are some downsides to using QLC+ though. Mostly around the fact that it really wasn't designed for this use case. But it works for me. Also I find it easier to understand what's going on then the other methods.
 

NavySWO91

New elf
Joined
Jun 13, 2022
Messages
3
If you haven't already come up with a solution, I have exactly this working right now. I have a large red button for visitors to press which will select a random sequence... well, playlist. I created a playlist for each sequence and I am using the CycleRandomPlaylists.sh script. The script is tied to a GPIO input controlled by the button. I also have a background sequence which plays and is kicked off by the Command Preset FPP_STARTED. Works great! When the button is pushed one of the playlists/sequences plays and the entire thing resets and re-randomizes once all playlists have been played. After each playlist the background sequence kicks back in. I think I could have skipped the one sequence per playlist and used the CycleRandomSequences.sh script but I was sure how to avoid the background sequence in the randomized list of sequences -- probably easy but too lazy to figure it out and since this worked for me just fine.
 

dkulp

Full time elf
Joined
Jan 2, 2013
Messages
146
Location
Framingham, MA
This is all built into FPP 6.2. There is an "Insert Random Item From Playlist" FPP command that will pretty do exactly what it says it will do.
 

perigalacticon

New elf
Joined
Nov 21, 2019
Messages
37
Location
Troy, MI, USA
This is all built into FPP 6.2. There is an "Insert Random Item From Playlist" FPP command that will pretty do exactly what it says it will do.
Dave, if this works the way I think it does it may be problematic for the application I wanted. I tried insert playlist immediate a few years ago, but I found that the kids would press the buttons lot of times, and all those add playlist commands added lots and lots of playlists to a queue, and they all got subsequently played, which is not what I wanted. I wanted either the immediate response of starting a playlist regardless of which was currently playing, or, ignore the button press until the current playlist was done playing. Like an arcade button, fires instantly, or is blocked until you are able to use it.
 

TerryK

Retired Elf
Joined
Feb 9, 2020
Messages
655
Location
West Central Ohio
What would be nice to have in FPP if not already would be a register indicating what sequence is currently being executed. A script triggered by an external device could then determine whether to ignore or add the request to the queue.

Downside to this is the sequences would need an unique ID of sorts all correlated to the external trigger script.
 

Javito

New elf
Joined
Jan 15, 2021
Messages
7
Hi. Is there an answer to TerryK? , Is there a way to retrieve the name of the sequence being playing and use it in an script?
 

MikeKrebs

Full time elf
Joined
Dec 8, 2014
Messages
164
Go to the help menu in FPP.
Select Rest API help
FPPD status will return that information (along with a bunch of other stuff).

You would parse the response using a json parser and voila, you'd know the sequence playing.

This script does that (and much more) but if you just wanted the sequence, you could start removing things.
 

someoneAUS

Apprentice elf
Generous elf
Joined
Nov 19, 2012
Messages
76
Location
Perth, 6056
This is something I was keen on doing this year. I need to take a look at it as I assumed it was going to be relatively straight forward.
 

Whitey-

Apprentice elf
Joined
Sep 4, 2023
Messages
67
Location
Launceston, Tasmania
This is something I was keen on doing this year. I need to take a look at it as I assumed it was going to be relatively straight forward.
I'm not up to that part for my show yet, but I had a quick poke in the FPP previously and it looks like using the "Run Script" command you can effectively bootstrap absolutely anything. To do advanced things like in this topic (e.g. retaining the state of a button), you'd want to pass to an external script.

If anyone needs a hand, feel free to reach out. I'm a lot more comfortable on Linux and programming than I am soldering lights 😄
 
Top