I'm trying to test out a new way of doing my "show the current audio source" Stream Deck button that's more reliable (and doesn't require running a script every few seconds), and as part of that, I'm trying to use the update_stream_deck_widget
method in a "Run Real JavaScript" action on a named trigger.
Using the example code causes BTT (alpha 4.053 (2272)) to crash whenever I press the "Run Script" button in the BTT action configuration editor. I've made two minor changes, but these don't seem to affect whether it crashes or not:
- I set the uuid as a variable, because long-term, I probably will end up hitting a couple of methods against the same widget, and also it reads cleaner
- I removed the comma after the last line of the widgetConfig JSON, since JSON can be finicky about unnecessary trailing commas (I tried it both ways and had hoped that removing the comma would be an easy fix, but alas, no).
(async ()=> {
let widgetConfig = {
text: "some new title!",
BTTStreamDeckBackgroundColor: "200,100,100,255",
BTTStreamDeckSFSymbolName : "bitcoinsign.circle.fill"
};
let uuid = 'B1F1D9EA-0016-48EA-A312-F1F8FD4E6CA2';
callBTT('update_stream_deck_widget', {uuid: uuid, json: widgetConfig});
returnToBTT(JSON.stringify(widgetConfig));
})();
I've definitely noticed that BTT / Stream Deck can be SUPER finicky about the precise JSON being returned / sent to the button / etc, and that the failure state is crashing (rather than some kind of alert), so I'm GUESSING that there's something wonky in the JSON being passed (or in processing that JSON) but I'm not really sure how to further diagnose it. I've tried using JSON.stringify, escaping quotes, etc., and not really found anything that works (sending stringified JSON doesn't cause a crash, but it also doesn't seem to actually DO anything).
I've tested using a "regular" Stream Deck trigger, a Run Apple Script trigger, and a Shell Script / Task trigger as targets; all of them fail in the same way (a crash).
Attached is a crash report (added .crash
to the end because .ips
isn't an allowed upload format)
Any thoughts?