The API does not refresh in customized app. Static data

Followed the guidelines to the dot but still not rendering/refreshing new Data. The API is working fine but when I push it to Tidbyt, the data remains as is and never refreshes.

Code
# CODE
load("render.star", "render")
load("http.star", "http")
load("encoding/base64.star", "base64")

STOCK_PRICE_URL = "SOME_URL"

COIN_ICON = base64.decode("""
iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAAlklEQVQ4T2NkwAH+H2T/jy7FaP+
TEZtyDEG4Zi0TTPXXzoDF0A1DMQRsADbN6MZdO4NiENwQbAbERh1lWLzMmgFGo5iFZBDYEFwuwG
sISCPUIKyGgDRjAyBXYXMNIz5XgDQga8TpLboYgux8DO/AwoUuLiEqTLBFMcmxQ7V0gssgklIsL
AYozjsoBoE45OZi5DRBSnkCAMLhlPBiQGHlAAAAAElFTkSuQmCC
""")

def main():
    rep = http.get(STOCK_PRICE_URL, ttl_seconds = 240)

   # here c is current price
    rate = rep.json()['c'] 
    
   # to have decimals
    full_rate = rate * 100
    dollar_rate = full_rate / 100
    cent_rate = full_rate % 100

    return render.Root( 
        child = render.Box(
            render.Row(
                expanded=True, # Use as much horizontal space as possible
                main_align="space_evenly", # Controls horizontal alignment
                cross_align="center", # Controls vertical alignment    
                children = [
                    render.Image(src=COIN_ICON),
                    render.Column(
                        children = [
                            render.Text("AXP: "),
                            render.Text("%d.%d" % (dollar_rate,cent_rate)),
                        ],
                    ),
                ],
            ),
        ),
    )

Any suggestions/thoughts/solutions?

What command are you using to push the webp to the device ?

pixlet render hello_world.star
pixlet login

/** this is good for few seconds, good to test it out **/
pixlet push DEVICE ID hello_world.webp  

/** this is to push app to device **/
pixlet push --installation-id APP_NAME  "DEVICE ID" hello_world.webp

Before you push, open the webp and see if the new data is rendered. If not then it’s a code issue.

Also, have you been passing an installation_id in the command? That will cause the push to persist. Check the phone app to see them.

The webp renders as expected, and the values comes back correctly. Not sure why it don’t refresh every 4 minutes. I rendered it right now on webp, but I had to hit refresh to get latest value. Not sure how can I translate it to App.

For the installation ID, I thought installation_id = the name I want to give to the app that displays in Tidbyt App.

Example: here I want the program/app to be displayed as AXP-STOCK so I pass on:
pixlet push --installation-id AXP-STOCK “DEVICE ID” hello_world.webp

do you see AXP-STOCK in your tidbyt app ? I remember something about disallowed characters in the installation id string. Try without the dash and see if that works.

But also, it won’t refresh automatically. You must render/push anytime you want a refresh. The code does not run on the tibdbyt.

  • do you see AXP-STOCK in your tidbyt app ?
    No, I simply used “stock” .

  • You must render/push anytime you want a refresh.
    Yeah this is what I wanted to fix but it feels like there is no way around.

I really appreciate the quick response and the clarification. Thank you @Tavis_Gustafson ! I will keep the thread open just in case you or someone has/finds a solution. Cheers!

I just want to make sure that understand that your custom app won’t auto-refresh and that is by design. The only way to get an app to automatically refresh is to get it published to the community repo. Then it will be running on the tibdyt servers and they will handle the running of the script. Any other way involves running the script and pushing the webp on your own schedule.

I have written a simple webapp that will handle this operation for you if you want to try it out. It would involve creating an account and uploading your custom script. It will then let you configure it via the pixlet serve interface and then will run and publish your webp on a specified schedule. Let me know if you’re interested in that.

There are two alternatives.

You can publish this as a community app, then you and every other Tidbyt user will be able to install and use it.

Or you can sign up for Tidbyt Plus, which lets you upload your own private apps. Only you can install these apps but they run and update just like the community and official apps.