Permentally add custom app?

I’ve written a custom application to retrieve a cryptocurrency’s price but after I push it to the tidbyt it only stays in for one rotation and doesn’t reappear. is there anyway i can have my app displayed within the rotation of screens?

thanks

3 Likes

Are you pushing with an installationID?

I’m actually just rendering the file and pushing it to the tidbyt like:

pixlet render /home/ken/tidbyt/chainlink.star | pixlet push --api-token $TIDBYT_API_KEY $TIDBYT_DEVICE_ID /home/ken/tidbyt/chainlink.webp

If i push the .webp with the installation ID through an API call, will the data still be dynamic with the response of the API? Or will it only show the data from the time it was pushed?

Yes, if you push it through the API with an installation ID it will persist. It will not update on it’s own though, you’ll have to update the installation by re-pushing to display new data.

Thanks for the info. Also - when trying to run pixlet through a bash script it seems to have some unexpected behavior:

$ ./link_display.sh
script file must have suffix .star: /home/ken/tidbyt/chainlink.star
: no such file or directoryinlink.webphainlink.webp

Any idea? The commands I’m running are the same and work via CLI, just not in script:

pixlet render /home/ken/tidbyt/chainlink.star
pixlet push --api-token $TIDBYT_API_KEY $TIDBYT_DEVICE_ID /home/ken/tidbyt/chainlink.webp

Hard to say without seeing the script. I’d make sure the filename you are sending is trimmed as it looks like there is a space at the end and that is preventing the check for the .star extension from passing.


Appreciate the help and followup. What i posted is the script. I just renamed the file to ensure there is no trailing space on chainlink-new.star.

Maybe it’s passing in the file break?
–edit with just one line in the file its behaving the same. I don’t think its a line break issue either
tidbyt-script-br

and yes I see the push file is the old file output name but that’s commented out for now.

An update:
I’ve seemed to fix the issue by moving to python and running my python script on cron to update the tidbyt:

import os
bashCommand = "/usr/local/sbin/pixlet render /home/ken/tidbyt/chainlink-new.star | /usr/local/sbin/pixlet push --api-token $TIDBYT_API_KEY $TIDBYT_DEVICE_ID /home/ken/tidbyt/chainlink-new.webp"
os.system(bashCommand)

Hey Ken,

Would you be cool with sharing the code to what you built here for your crypto app? Im learning and kind of just messing around with the same idea, and it would be a really useful referance to see something that works!

Thanks

Sure. A few things to note:

  • you can easily add multi coin support by changing the value of the ?symobl= parameter to a variable, and the same for lines 30-32 you can change the ["LINK"] to a coin variable. I didn’t make it multi-coin because the coinmarketcap API only allows for 333 calls per day or something.
  • on line 30 to 32 im not sure why i do float(int(..instead of just float( but im not gonna change it because it works fine :stuck_out_tongue:
  • theres probably better ways to do all of this but i’m not too familiar with skylark / starlark and it doesn’t seem to be documented too well. I mainly based this off of the bitcoin example they provide and their documentation, and the starlark spec

I run the script via the method in the comment above. Hope this helps!

@ken

Dude thankyou so much this is really well done and almost exactly what i wanted! I just moved a few things around and madde some changes!!! Thanks for helping me learn i cant wait to pull this a part and use it elsewhere.

glad to hear it buddy :slight_smile: happy hacking!

Hi,

Is there any other way to update custom apps data to refresh without having to re-push?

Hi @AndyFi!

Applications render down to static WebP animations, so in order to update them they must be re-pushed.

If your app is something that can be submitted to the Community Apps repository, it would run on Tidbyt’s servers and be updated automatically like the built-in apps.

1 Like

Thanks! Took me a while and figured that now and got it all working by using cron job to run my applets. Was first under impression that the device would “store” the code and be more self contained, but works as such also now that i know what it is and what it is not haha. Was also wondering if there is a command to “un-push” an applet…now i can only do it via tidbyt app. Say if i want to time my applets at certain times and have them gone automatically at some time…

For apps pushed with an installation ID, you can delete the installation to remove the app from the rotation using the API:

1 Like

Excellent! Thank you