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.
Rule Machine offers actions to directly write to, append, or delete File Manager files. These actions are found under Set Variable, Mode or File, Run Custom Action. File contents can be read or set in rules anywhere
%variable-name% can be used by using the format
%/local/file-name% instead, where
file-name is the name of the file, as long as a variable of type String would be accepted in that context.
A second way to create a local file in a rule is to create a local variable whose name begins with
/local/, for example,
/local/myFile. When this is done, a local file is created with the name that follows
/local/ (in this case,
myFile). This local file can be used in any context where a String local variable can be used, aside from the fact that a variable connector cannot be created for such variables.
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.
Local files can also be accessed on the LAN at
<your-hub-IP>/local/<fileName>; for example,
Developers writing custom Groovy apps or drivers on the platform can use the following methods to upload, download, or delete File Manager files:
void uploadHubFile(String fileName, byte bytes)
byte downloadHubFile(String fileName)
void deleteHubFile(String fileName)
As mentioned above, files can be manually managed from Settings > File Manager. To do this:
First, select the Choose button:
Then, select the file you want to upload (selecting Choose in the previous step should make your browser or operating system's standard file chooser dialog appear).
Optionally, repeat step 1 to add multiple files to the list of files to upload. Pending uploads will appear in a list below the Choose, Upload, and Cancel buttons.
Finally, select the Upload button again to upload the file(s), and wait until the upload is complete (a small progress bar will appear while uploading but may disappear before it is visible if the files are very small):
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):
A file can be deleted using by selecting the delete icon, C.