File Manager
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
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 supported, 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, http://192.168.1.5/local/myFile.txt
.
Manually Uploading and Managing Files
As mentioned above, files can be manually managed from Settings > File Manager. To do this, first click the Upload button:
Then, click the Browse button and select the file to upload:
Finally, click the Upload button again to upload the file, and wait until the upload is complete (the text Uploading...please wait will appear while uploading):
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):