-
Notifications
You must be signed in to change notification settings - Fork 95
Ability to have a script run before/after certain events #359
Comments
The only issue with adding in an external script is the possibility of the script causing the board to hang. The functionality for running an external script already exists in the pushbutton code but it's very basic and doesn't take into account for anything out of the ordinary and is used for specific situations where if it hangs, it doesn't really matter (ie poweroff or reboot). If you are looking for event driven activities, the upcoming MQTT addition provides topics for goals and penalties and the addition of the board start /stop could be added without a problem. That's likely a better solution in my opinion. Then you could use a separate python script that won't impact the running of the core board that subscribes to the topics and do what you need to do on the goals/penalities etc. Maybe @riffnshred has some other ideas, but that's my 2 cents. |
Definitely understand that as an issue. I would think having it multithreaded in some way with the script run separately and the board not waiting for it would address the issue, but perhaps not. It's a bit beyond my limited capabilities - the MQTT messagins seems appropriate as well if things could be done locally and quickly so there's not multi-second delays between the script running and events occurring on the board. |
So I just double checked the code for the pushbutton and I am already using the subprocess function to launch the scripts. It was one of the first things I coded so I'd have to circle back and wrap my old brain around what I did and see if it can be extended to other parts of the code. I think it could be added along side the MQTT stuff where events are being sent already. @riffnshred assign this to me as an enhancement, I'll see what I can do to add it. |
roger that ! I like the idea. Just not sure with the state of the project how well it will integrate without causing issues to the current features. Ill leave that to you. |
Description
Incorporate ability to run a script at certain events. Suggested event lists:
Pseudocode Example:
if (GoalOccurs) then if (Goal-PreAnimation Exists) then execcommand = pregoalscriptname PlayGoalAnimationsandAlerts if (Goal-PostAnimation Exists) then execcommand = postgoalscriptname
This would allow custom activities to happen around events.
The text was updated successfully, but these errors were encountered: