File Manager allows you to store files locally on your hub. These files can be uploaded and managed from Settings > File Manager or from Rule Machine.
File names can contain only letters (A-Z and a-z), numbers (0-9), hyphens (-), and underscores (_). Periods (.) are allowed as any character except the first character of the file name. Spaces are not allowed, nor are any other characters.
How to Use
File contents can be read or set in rules anywhere
%variable-name% can be used by using the format
%/local/file-name% instead, as long as a variable of type String would be accepted in that context.Rule Machine also includes actions to write to or append to, or delete files. These actions are found under Set Variable, Mode or File, Run Custom Action.
In any context in Rule 4.0 or later versions where a String variable could be used with
%variable-name%, a local file can be used by using
%/local/filename%. Thus, the various actions that set a String variable by manipulating a string can manipulate the contents of a local file to set a String variable. The contents of a local file can be used in all other contexts where a String variable could be used as well.
A second way to create a local file in a rule is to create a local variable whose name begins with
/local/. When this is done, a local file is created with the name that follows
/local/. This local file can be used in any context where a String local variable can be used, with one exception: a local variable that represents a local file cannot have a variable connector. Deleting a local variable that represents a local file deletes the local file. There is also an action to delete a local file.
Note that all files on the hub reside in a shared space, as seen in File Manager. So if two rules "create" a local file of the same name either by Write Local File or be creating a local variable whose name begins with
/local/, these both reference a single file of that name. It is possible for rules to pass information to each other by referencing the same local file, but care should, of course, be taken as to which rules write to a given file.
Access via HTTP
Local files can also be accessed on the LAN at
<your-hub-IP>/local/<fileName>; for example,
Manually Uploading and Managing Files
As mentioned above, files can be manually managed from Settings > File Manager. To do this:
1. First, select the Choose button:
Then, use the dialog that appears to select the file from your computer. Optionally, repeat step 1 to choose multiple files. Pending uploads will appear in a list below the Choose, Upload, and Cancel buttons.
2. Select Upload button again to upload the file, and wait until the upload is complete (a small progress bar will appear while uploading):
3. When the upload is complete, you will see the text Successfully uploaded <your file name> displayed (A), and you will also see the file in the list (B):
To delete a file, select the delete icon (C) corresponding to that file.