Determine the config schema for an app

I’d like for an app to remain pinned on my TidByt, for a time, based on an event (priority over all other apps in the rotation). Since we don’t appear to be able to mute the unwanted apps via the API (based on this post: Add Mute toggle to API fro installed apps) or control the rotation/schedule, I’m thinking my next best option is to use the REST API to delete all installations except the one I want displayed and then re-add them again (still using the API). I believe the only thing keeping me from being able to do this is the fact that I don’t know the configuration schema for each of the installed apps (I don’t find the source for the “Clock” app, for example, in the community repo––for the community apps, I believe I can look at their schema definition in the repo).

Does anyone know if there’s a way to do this? Any other ideas? Or possibly I’ve misread some documentation somewhere and we actually can control the app rotation from the API?

Yes, you are right… you’d have to know the schema parameters for each app.
For community apps you can just look at the Github repo, for the official apps it’s a little more tricky.

Are you familiar with the Chrome Dev Tools and inspecting HTTP requests?
If you are, then just open it and go to https://tidbyt.app and you’ll be able to see how the website requests the image previews and the schema parameters that are passed :smile:

Example for the official weather app:
https://prod.tidbyt.com/app-server/preview/weather.webp?%24tz=America%2FSao_Paulo&location={"lat"%3A"-23.609"%2C"lng"%3A"-46.664"%2C"locality"%3A"Moema"%2C"timezone"%3A"America%2FSao_Paulo"}&three_day_forecast=true&unit=c

Everything is url encoded, but in this case there are 4 parameters:

$tz=America/Sao_Paulo
location={"lat":"-23.609","lng":"-46.664","locality":"Moema","timezone":"America/Sao_Paulo"}
three_day_forecast=true
unit=c

Ahh, right, that’s a great idea to use the dev tools to inspect the requests. I also didn’t know about tidbyt.app, so that’s helpful too.

The whole thing feels like a big workaround (uninstalling and reinstalling apps to control visibility), just being able to control the app rotation or muting apps from the API would be very nice.

Obrigado!

1 Like

Unfortunately, the core “clock” app doesn’t seem to honor the location field passed to it in the config object via the REST API call (/v0/devices/{deviceID}/install).

Full payload:

{
    "appID": "clock",
    "config":
    {
        "24hclock": false,
        "blink": true,
        "display_location": false,
        "display_weather": true,
        "location":
        {
            "lat": "40.712982",
            "lng": "-74.007205",
            "locality": "New York",
            "timezone": "America/New_York"
        },
        "time_color": "#fff",
        "tz": "America/New_York"
    }
}

Not sure what else to try. Debugging this thing is a bit of a pain—just trial and error. Any tricks?

Try passing the location parameter as a stringified JSON instead of the actual object.
Also, I think the tz parameter is actually $tz (with the dollar sign).

Try it like this:

{
  "appID": "clock",
  "config": {
    "24hclock": false,
    "blink": true,
    "display_location": false,
    "display_weather": true,
    "location": "{\"lat\":\"40.712982\",\"lng\":\"-74.007205\",\"locality\":\"New York\",\"timezone\":\"America/New_York\"}",
    "time_color": "#fff",
    "$tz": "America/New_York"
  }
}

That did the trick! Thanks!

1 Like