How to use the push app to device API?

Hi there,

just trying to get my first written app to my tidbyt.
I first tried it with pixlet push with an installationID but providing an installationID does not seem to have any affect. My tidbyt shows the image but I cannot see it in my app…

So I tried to use the REST API but I do not know how I specify the “image” parameter (which is the webp image I have) as a string? Do you have some hint regarding this? An CLi command would be super cool to transform my file into a string.

Then, actually, I am kind of frustrated on the achitecture of the tidbyt. I was thinking that I can upload some code on it and then it runs the code every time on the tidbyt itself the “app” is shown. This way the tidbyt would and could work without servers. I do not really understand why companys always go with the “server” approach instead of “standalone client” approach. Maybe to make money or more control? For customers it is mostly bad because when the severs are shut off (due to many reasons) then the customers can just throw their device to the bin…
Also with the “the app code runs on the server” I can never show data that is not available in the internet (e.g. my home assistant smart home data). Only with very frustrating afford meaning having a cron job that runs the code with pixlet every 5 seconds and then call the tidbyt servers to ask them if they can kindly show that image on the tidbyt that is just 2 meters away from me :slight_smile:
→ to sum up: I really would like to have local access to the tidbyt. Why going through a server when it it is in the same network as my pc?

1 Like

The image parameter would have to be encoded using JSON standards. A JSON library should be able to do it. Also Pixlet appears to have a command that can be used to just to send to image.

I would be nice if the API would let you could POST the image raw and put the application id in the headers.

I agree, Image data as json body would be the way I have seen this a hundred times. But this API wants the image as string inside a JSON. Normally my instinct tells me to base64 encode the file. But I get an error when I do this…

EDIT: Never mind. Base64 encoding the file did it. Not sure why it did not work in the first place

I’m getting started with my tidbyt, is there no local access to the device at this point? That would be super awesome for locally developed/run and quickly updated apps.

if you have the webp file then you can use a curl command like so with an embedded base64 command to encode the image to a string :
curl --request POST --url --header 'Authorization: Bearer eyJhbGciOiJFUzI1NiIs0xxxxxxxxSNIP' --header 'Content-Type: application/json' --data '{"image": "'$(base64 -w 0 -i windy-tron.webp)'","installationID": "windytron"}'

On the issue of local vs server access, I believe the team is working on a hardware development kit which would allow you to flash the device with your own custom firmware so that it could work completely locally and on its own. However, it’s complicated and this is why they went with the server route because to make a generalized firmware to allow for customers’ complete customization is basically impossible.

1 Like