Could KM overcome an issue (design flaw?) of the Stream Deck app Backups?

Mac OS Ventura latest version, iOS 8iPadOS) 16.7.7, Stream Deck 6.6

Hello,

I have 2 devices, one Stream Deck and one iPad 2016 running iOS 16.7.7 and the mobile version of Stream Deck.

When I Open the Stream Deck software (in Mac OS - nothing to do with iOS software) → Settings → Profiles → Back up All → Create Backup... , according to Elgato Stream Deck forum, all profiles on all devices (Stream Deck and iPad) will be written to one backup file.

The problems

  • according to the Stream Deck web site it can happen that Stream Deck profiles become corrupt during an update or another reason
  • if I lose my Stream Deck config (all profiles and buttons) for one device (which happened to me with the iPad) and I restore from a backup→ BOTH devices are restored. In my case, my iPad was restored but I lost all the work I had done on the Stream Deck device since the backup.
  • The same applies if you have only one device and corrupt only one profile. You can only restore all profiles if you restore from a backup.

Solutions I tried:

  • individual Stream Deck Profiles are located in Library/Application Support/com.elgato.StreamDeck/Profiles, but the filenames are cryptic, so not useful to restore a specific profile
  • Yes, it's possible to export each profile of each device individually but that very tedious
  • asked chatGPT but I don't know if the script is any good (see below)
  • the only possible solution would be some kind of automation (KM?) which backs up (and clearly identifies every profile of every device)
  • I found one macro in the KM forum, but it basically poses the same problems as backing up using the Stream Deck app Stream Deck - Backup Profiles on Quit Macro (v9.2) - Macro Library - Keyboard Maestro Discourse

thank you !

chatGPT script

set profileName to "Your_Profile_Name"

set json to "{\"profile\": \"" & profileName & "\"}"

do shell script "curl -X POST -d " & quoted form of json & " http://localhost:12345/profile"

chatGPT complete response

No it's not (covered in your other thread).

I'm confused -- you are, I assume, backing up your computer. If anything in the Stream Deck profiles corrupts, can you not just replace the files from your backup? If you want more frequent backups of just the SD profile files, can you not just set up a KM macro to make regular copies to eg your Documents folder?

1 Like

Or create a watched folder macro that makes an added backup whenever the folder holding those backups changes? (I'm not quite sure how the Stream Deck backups work, having only a six-button device, I don't really care if they all vanish—it's a testing tool for me, not something I regularly use.)

-rob.

1 Like

There is a misunderstanding. I did not express myself correctly.

Let's assume that you are right and I have a carbon copy cloner backup dating 2 weeks back.

I messed up the Format Profile (all text styling) or it is simply corrupt (as described on the Stream Deck website) and want to replace it, and I have been working on other profiles let's call them Bear Profile and Tax Profile intensely for the past 2 weeks.

  • My profiles are stored in the following folder: individual Stream Deck Profiles are located in Library/Application Support/com.elgato.StreamDeck/Profile

  • the profile filenames are cryptic, so which one do I want to replace (the format profile) and which one do I not want to replace (the 2 others) ? What would you do ?

as described to @Nige_S , the issue is that filenames are cryptic, so I don't know which file is which profile.

Looking in that folder now, I have an idea ... it'll take a bit of time, but let me see what I can do.

-rob.

Any backup is better than no backup -- but more backups are better still! Any reason not to run Time Machine and hook up a disk whenever you are at your "work station"? Then you'll only ever lose an hour or two of work at the most, and you'll still have your "point in time" CCCs.

(Yes, you've caught me in the middle of a "backup reminder" frenzy after a couple of people at work recently lost data because they weren't bothering to plug in the disks we issue them with...)

Since KM can't see "inside" a watched folder to monitor for changes (but I believe Hazel can, so use that if you've got it) I'd just back up the "Profile" folder and its contents every hour -- you don't have to worry about which profile is which, just restore the lot. A simple periodic-trigger KM macro that copies ~/Library/Application Support/com.elgato.StreamDeck/Profile to, for example, ~/Documents/SD Profile Backups/, appending a time stamp to the copied folder's name, would do it. Profiles are tiny, but if you are worried by the number of folders that could accumulate then include actions to delete the oldest once a certain number is reached.

Here's a basic-but-functional backup tool for individual profiles. When you run it, it copies each profile folder into a properly-named folder that makes it easy to tell which profile is which:

This is possible because there's a manifest.json file in each profile folder, and that JSON data contains the actual name of each profile. Here's the macro that creates the above:

Download Macro(s): Create archive of Stream Deck profiles.kmmacros (7.4 KB)

Macro screenshot

Macro notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System information
  • macOS 14.4.1
  • Keyboard Maestro v11.0.2

It's very basic, you'd probably want to add some bells and whistles, but it does work quite well (and quite quickly). The first thing you have to do is (in Finder) create a folder that will hold the backups. Then edit the macro and put the full path (no tilde shortcuts) to that folder in the green boxed Set Variable action.

The macro then simply loops through the Stream Deck profiles folder, and for each folder it finds, it...

  1. Reads the JSON to extract the profile's real name.
  2. Checks to see if a folder with that name already exists in the chosen backup location. If not, it creates one.
  3. Copies the profile into the properly-named backup folder.
  4. Adds a date and timestamp at the front of the filename, for easier tracking of your backups.

If you ever needed to restore a given backup, here's what worked in my (admittedly limited) testing:

  1. Quit Steam Deck—don't just close it, quit it.
  2. Delete the troublesome profile from the Steam Deck folder—you know which one due to the backup having them stored by name.
  3. Move or copy the backup to the Steam Deck folder.
  4. Rename the file by removing everything before the start of the cryptic code.
  5. Launch Stream Deck.

When I tested it, this successfully restored a profile I had backed up.

-rob.

3 Likes

seems fantastic. I will start installing and testing and give you a follow-up. thank you so much !

Fantastic !! a gem !!! works perfectly! instructions are also crystal clear. thanks again very much !

a microscopic addendum: if the user has multiple devices, profile names must be unique, for example not having the identical name "default profile" in 2 devices.

Glad it's working for you; that was a fun little one to write :).

In theory, you could write a pretty simple Restore Backup macro, too. All it would do is:

  1. Quit Stream Deck.
  2. Use the Choose Folder action to let you pick a profile to restore.
  3. Trim the date/time stamp from the name.
  4. Find and delete (or move to trash) the original version of that folder in the Stream Deck folder.
  5. Move the chosen folder to the Stream Deck folder.
  6. Restart Stream Deck.

I don't do enough with my Stream Deck to need this, and really should get back to my work project :), so that one's left to you as an exercise.

-rob.

1 Like

That makes sense—the macro simply checks the profile name. There is a Device field in the JSON file, though, and it could be used to make a second level of folders:

{
  "Device" : {
    "Model" : "2....etc",
    "UUID" : "@(1)[4057\/9....etc]"
  },
  "Name" : "Profile 1",
  "Pages" : {
   ...etc

Both the model and the UUID are long ugly strings, though, so you probably wouldn't want those in your folder structure. You'd need to put a translation table variable in the macro, with something like UUID,PrettyName, and then parse it with a regex to find and split out the pretty name based on UUID.

But it seems much simpler to me to just add a prefix to each of your profile names on each device :).

-rob.

1 Like

I will have a look. thank you

absolutely !