Skip to content

Examples

Arie J. Godschalk edited this page Nov 15, 2026 · 8 revisions

Examples

Home / Examples

Choose the example that matches what you'd like to do. Start with the small test, check the result, and then adapt it to your own files or devices. The text-file example is a useful first Flow.

These workflows build on examples discussed in the FTP Client community topic, with details checked against the current app. Other apps supply the triggers and consuming actions that use the file or image; their exact card names can vary.

On this page

Before you start

For examples using FTP, first complete the small-file transfer check. Use a writable test folder and sample files that you can safely replace.

Warning

Saving to an existing filename replaces that file. Use unused test names before trying an upload example on important data.

  • Replace server, folder, camera, and speaker selections with your own.
  • Names such as doorbell-test.jpg, track.mp3, and temperature.txt are examples. Use an extension matching the actual bytes; FTP Client does not convert formats by changing a filename.
  • Connect cards in execution order. In Advanced Flow, select output tokens from the preceding card, not a similarly named token from another branch.
  • Check the expected result after each step before adding schedules or loops.

Save a camera snapshot to a NAS

A NAS is a network storage device. In this example, you'll save a picture from your camera to a folder on it.

Requires: a working FTP Connection and a camera app that supplies an Image token. This example assumes a JPEG snapshot; adapt the extension if your camera returns another format.

  1. Add an FTP Connection for the NAS and verify that you can upload a file from its repair view.
  2. Start a Flow from a doorbell event or another camera-related trigger.
  3. Obtain an Image token from the camera app.
  4. Add FTP Client's Save Image Token action and supply that Image token.
  5. Select a writable test folder and enter doorbell-test.jpg as the filename.
  6. Run the Flow, refresh the FTP folder in Repair, and download the file.
Source Connect to
Camera action's Image token Save Image Token: image-token input
flowchart TD
  Event["Doorbell or test trigger"] --> Snapshot["Get camera Image token"]
  Snapshot -->|"Image token"| Save["FTP Client: Save Image Token"]
  Save -->|"success"| Check["Check saved image"]
  Save -->|"error"| Report["Report failure"]
Loading

Connection diagram for Advanced Flow, not a screenshot. Choose the snapshot and notification/logging cards provided by your installed apps. Use the diagram's zoom controls on small screens; the steps and token mapping above also describe the connections in text.

Expected result: the selected folder contains doorbell-test.jpg, and opening it shows the snapshot supplied to the Flow.

The filename is your chosen destination name, not automatically the camera token's name. Include an appropriate file extension. Reusing a fixed name replaces the existing file rather than keeping a snapshot history.

To show the saved image later, use Get an Image Token with that same directory and filename, then pass its Image output to an action that accepts image tokens. If you need precisely the same snapshot in several actions, reuse the original Image token rather than asking the camera for new snapshots.

Keep successive snapshots

After the fixed-name test works, use a varying filename such as doorbell-{[ Date.now() ]}.jpg. This preserves separate runs unless they produce the same timestamp. If another card must retrieve that exact saved file, calculate the filename once and reuse its value; evaluating the timestamp again selects a different name.

A fixed name keeps one current image; varying names build an archive and need a plan for deleting old files on the server. Avoid storing camera images longer than needed, and restrict access to the archive.

See the snapshot-saving discussion and BLL coding.

Play an audio file on a speaker

Requires: a working FTP Connection, a small audio file that your speaker supports, and a speaker action accepting an audio URL. Use a test file such as track.mp3; renaming another format to .mp3 does not convert it.

  1. Upload a playable audio file to your FTP server, using the repair view.
  2. Add Get file URL, select the FTP Connection and the audio file.
  3. Connect its output to your speaker app's action that accepts an audio URL.
  4. Use URL or Cloud URL, depending on which address the speaker can reach.
Source Connect to
Get file URL: URL or Cloud URL Speaker action: its audio-address field

Expected result: the speaker plays the selected audio file after the URL action succeeds. If the URL can be opened by your phone but not the speaker, check the speaker's own reachability and format support rather than assuming the FTP download failed.

The speaker must support the audio format and the returned URL. The community topic demonstrates Sonos playback; that does not guarantee every player accepts the same URL. Generate the URL just before playback rather than storing a temporary link for later use.

Saving a base64 audio file works too: run Save File from base64 first, then Get file URL after the upload completes. The save action itself does not return a URL.

Play the file on Homey's own speaker

If your Homey has the local speaker feature, you can use Music Url Converter's setup. Connect Get file URL's URL or Cloud URL tag to Music Url Converter's Play URL action, in its URL field. Run the URL card first so playback receives the newly created address.

Start with a short MP3 or WAV. Check the converter's accepted response types and size limits: the file extension alone is not enough, and your Homey must be able to download the returned address. Large split MP3 playback can continue after the converter card finishes, so do not use that completion as an end-of-track signal.

This connection is also recommended in the community discussion about audio files.

Save text or HTML as a file

Requires: a working FTP Connection with write access. Save File from base64 expects base64-encoded bytes, not plain text.

First test without a script

Copy this value into File, without adding quotes:

MjA=
  1. Add Save File from base64 to a Flow you can run manually.
  2. Select your FTP Connection and a writable test directory.
  3. Paste the base64 value above into File and enter temperature.txt in the filename field.
  4. Run the Flow, refresh the folder in Repair, and download the file.

Expected result: temperature.txt contains exactly 20.

Generate content with HomeyScript

For longer or dynamic content, install HomeyScript and use its action that returns a text token. For example:

const text = '<!doctype html>' +
  '<html><body>' +
  '<p>Temperature: 20</p>' +
  '</body></html>';
return Buffer.from(text, 'utf8')
  .toString('base64');

Pass the returned text token to FTP Client's File field. Select the destination directory and set the filename to index.html.

Source Connect to
HomeyScript action's returned text token Save File from base64: File

Connect the save action after the script completes. Expected result: the downloaded index.html contains the HTML above and displays Temperature: 20 when opened in a browser. Saving HTML does not itself configure a web server to host it.

For a text file containing just a value, encode that value in the same way:

const value = '20';
return Buffer.from(value, 'utf8')
  .toString('base64');

Use temperature.txt as the destination filename. Replace the example value with the value your Flow or script supplies. These saves replace the file; they do not append readings to a log.

See the community HTML example.

Export a file supplied by another app

Requires: an export-producing app and a working FTP Connection with write access. Use the producer's base64 export format.

An export is a file containing data from another app, such as a log or a list of variables. Here, the other app prepares the file and FTP Client saves it.

If another app returns an export as base64, pass that token directly into Save File from base64. Set a filename with the extension matching the actual export format, such as .xlsx for an Excel workbook.

For a scheduled Excel export, follow Simple (Sys) Log's FTP walkthrough, adapted from the forum export example. For variable reports, see BLL's variable-export example.

Source Connect to
Simple (Sys) Log: Log, exported as Excel (base64) Save File from base64: File
BLL: Variables, exported as Excel (base64) Save File from base64: File

Expected result: the saved .xlsx opens as an Excel workbook containing the producer's exported records or variables. Test manually before enabling a schedule. Prefer a fixed filename for a replaceable current report, or varying filenames with a retention policy for an archive.

Do not base64-encode an already encoded token again. If the other app returns binary data, it must first be converted to base64; treating raw binary as a text response can corrupt the file.

Retrieve an image from an HTTP URL

Requires: Better Logic Library and a direct image address reachable from Homey. An FTP Connection is not needed for this app-level card.

For a simple test, use the public logo address shown in the community example:

https://etc.athom.com/logo/transparent/128.png
  1. Add Get an Image Token from URL and enter that address.
  2. Set Available duration to 60 seconds.
  3. Connect its Image token to a compatible display or notification action, with no delay between the actions.

Expected result: the receiving action displays the Homey logo. Replace the URL with your own direct image address once the token connection works.

Use Get an Image Token from URL with a direct HTTP/HTTPS image address, then pass its Image output to a compatible action. Set Available duration long enough for that action to finish. 0 keeps the token registered until FTP Client restarts.

FTP Client URL-to-image action showing its Image output token

Historical developer screenshot, in Dutch. The purple Image output feeds the consuming action. The screenshot uses 30 seconds; the test above uses 60 seconds.

Process several FTP images

Advanced example: a loop repeats the same steps for each item in a list. Here, JSON Handler reads the list of image paths and processes them one at a time. An AVD is an Advanced Virtual Device created with Device Capabilities; its camera field can show an image.

Requires: a working FTP Connection, a folder containing known image files, and JSON Handler. The linked AVD example also requires Device Capabilities and Advanced Flow.

Use Get files (JSON) to obtain a JSON array of paths, then use JSON Handler to process each item. For displaying the images on a virtual camera, follow Device Capabilities' FTP image walkthrough. It covers the named loop, per-item image token, and Set Camera Image action.

Source Connect to
Get files (JSON): Files (JSON) JSON Handler loop: Collection
JSON Handler trigger: Item as text Get an Image Token: filename/path
Get an Image Token: Image AVD Set Camera Image: image-token input

Expected result: each valid path produces an image update on the selected AVD camera field. The field shows one image at a time; use a small collection first and follow the linked example's timing and path-handling guidance.

Use known image files only. Pass each individual path, not the whole JSON array, into Get an Image Token. Do not add the selected directory again when a returned path already includes it. The walkthrough adapts the developer's collection-processing example.

Handle errors and execution order

In Advanced Flow, connect the successful output of one action to the next action that needs its result. For example, let the upload finish before running Get file URL for that file. Placing cards next to each other without connecting them does not make one wait for the other.

Connect relevant error outputs to a notification or logging action that identifies the failed operation. Do not start the normal consuming action from the error branch or treat a failed upload as a successful save. Keep passwords and private download URLs out of notifications and logs.

For a failed test, locate the first failing card, correct its input or server configuration, and run the small test again. See Troubleshooting for checks and verification steps. Avoid uncontrolled retries: a repeated save may overwrite a file or create additional archive copies.

Next steps

After a small example works, find its individual card reference for argument details, and use BLL coding if filenames must vary. If an example does not work, start with the matching troubleshooting symptom before adding schedules or loops.

Clone this wiki locally