Publishing Apps

@kay, that is my approach. I’m using launchd on the Mac to render the webp every n seconds and push it to the device. I specify the -b flag when pushing to update the image in the background, so it does not get displayed immediately on the device. That maintains the rotation of the images on the device. So far it works well but running my script to do the rendering and push was kind of a pain to setup with launchd.

4 Likes

I’m doing this very approach for each of my apps, but running it from a VM on Google Cloud Platform. Render and push to the device every 5 mins. It’s disappointing we can’t do the processing in the cloud, but I understand this is still new and still being perfected.

2 Likes

I’m also rendering and pushing my apps to my new Tidbyt every N seconds/minutes. If you have a docker host handy, here’s my Dockerfile (a bit crude but works for my controlled environment)

FROM golang:bullseye

ENV WEBP_VERSION libwebp-1.2.2-rc1

ENV REPO=$GOPATH/src/github.com/tidbyt/pixlet

RUN apt-get update \
 && apt-get install -y ca-certificates tzdata openssl libwebp-dev bash

RUN apt-get update && apt-get install -y cron && which cron && \
    rm -rf /etc/cron.*/*

RUN git clone https://github.com/tidbyt/pixlet.git $REPO && cd $REPO && make build

COPY entrypoint.sh /entrypoint.sh
COPY crontab /etc/crontab
COPY INSERTYOUR.star /INSERTYOUR.star

ENTRYPOINT ["/entrypoint.sh"]
CMD ["cron","-f", "-l", "2"]

You could COPY in your crontab/star or do a volume/mount for them.
Some other info / files you’ll need: Running Cron in Docker

Example of crontab entry:
*/10 * * * * root /go/src/github.com/tidbyt/pixlet/pixlet render /INSERTYOUR.star > /proc/1/fd/1 2>/proc/1/fd/2 && /go/src/github.com/tidbyt/pixlet/pixlet push --api-token eyJ… DEVICE /INSERTYOUR.webp --installation-id INSERTYOUR -b > /proc/1/fd/1 2>/proc/1/fd/2

1 Like

It would be great to at least have some guidelines published for what an acceptable app will look like - at least in terms of inputs into the main function, what kind of config values are appropriate and how to handle them.

I’m working on an app for Strava, and I’m really interested in how the workflow should work for someone entering / approving the connection to their Strava account, and how the auth key / refresh token can be provided to the Starlark code.

2 Likes

Any guidance as to how often of a refresh is acceptable? If I am refreshing every 5 seconds all day… is that going to put too much load on the Tidbyt servers?

There’s no way to push directly to the Tidbyt without going through Tidbyt servers… so, not really any other options at this point…

1 Like

@DanS are you getting your app to actually refresh after a certain amount of time? I can’t get mine to refresh, including the bitcoin.star example. I did open a separate issue here for this though.

Yes. I am pushing it with pixlet every 5 seconds, so it always stays on the screen. Don’t use the “installation ID” or “background” options.

@DanS That’s like 17,000+ pushes a day… I am just curious… what sort of app is it that you want 5 second updates?

I am interested in making some stock apps, and they can be pretty high frequency, if you like to watch the markets as closely as possible.

I am also looking at a satellite tracking idea and that might be pretty active at times.

@rohan can you tell us what sort of plans you have for supporting the user base when they want to implement all these ideas? Do you see it being better for us to generate our own images at high rates and push them through, or having TibByt servers to do the processing and send the results, or will it be the local device that does the work?

-Scott

I am showing the location, speed and direction of the nearest aircraft. Obviously, that can change quickly…

1 Like

Hi @DanS,

Super pumped to see the Aircraft applet! Technically, if we don’t rate limit you we support it. On the flip side, please be nice to our services. We pay per push - so if we get a lot of folks pushing so frequently, we’ll need to implement stronger rate limits across the board.

Pushing updates every 30-60 seconds feels more then adequate to get up to date aircraft information. Unless of course you’re trying to use Tidbyt for an air traffic control tower in which case I’d have to advise against that :sweat_smile: .

1 Like

Understand. What would be good is a way to get the tidbyt to hit a URL (with parameters) that returns a webp file… or allow a direct push to the tidbyt from the same IP network… that way it all stays local and doesn’t stress your servers. (I assume you’re using AWS?)

I can also write it so that it only pushes when an aircraft is within 1-2 miles or so.

A couple samples… This is currently focused on “anything flying” rather than just big commercial jets:


5 Likes

Basically… you hear some noise outside… “WTH was that!?” - this will answer the question… :wink:

Do you just have a shell script or something constantly running to rerender and repush your updates?

Do you have an MWE or could you elaborate further.

Thanks in advance!

Yeah, it’s a shell script that renders and pushes using pixlet

And is there a way to get it to push into the rotation at a certain point?

Thanks again for the help!

So, currently, it just pushes and takes over the display if there’s a plane closer than X miles.

You could work this into the rotation though by pushing it with an InstallationID, then pushing with the “background” flag set from then on.

1 Like

Do I just add background=true after the installation Id when you push to the pixlet? Or is it separate?

And does the background key only work with the installation ID? or if you push without an installation ID and with background then it just appears as the final image before it starts the cycle again?

When pushing with pixlet, you can add the background flag like this:

pixlet push --background ...

You don’t need to specify an installation ID, but it’s a good practice to do so.

2 Likes

Thanks @rohan! Does the background flag only just not interrupt the current rotation? Also I presume it is set to false by default?