Sending contents of file

I can successfully communicate bidirectionally with my device using MQTT. One of the features I need to implement is device firmware update. When we were selecting Losant as a platform, I was told that this was possible, but I can’t figure out how to do it.

Ideally I’d like to upload a firmware file (binary or base-64 encoded) and add it to an MQTT message as a payload. Then, the subscribed devices would receive it and update themselves.
If this isn’t feasible, then we could have the devices download the file themselves. However, while I can easily upload a file, I can’t find any information on either how to download it, or add it to an MQTT payload.

Any suggestions?


Welcome to the Losant Forums! :wave:

If you would like to keep them within Application Files, you can use the HTTP Node to grab the firmware data and add it to the payload.

On the other hand, if they are stored as base64 and depending on memory size, you could also just store the base64 in Data Tables. Then, use the Table Get Rows Node to add the firmware data from the table to the payload.

Both of these should work. I’m happy to go into further details or answer any more questions.

Thanks for the fast reply!
I’ll look into those options and let you know if I need more help.

FYI: I was able to package a previously uploaded text file into my MQTT payload and receive the data, so I think I wrapped my head around how it works :slight_smile:

Thanks for the help.

1 Like