Difference between revisions of "File Manager"

From Hubitat Documentation
Jump to: navigation, search
(Create page)
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
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 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==
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.
+
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 ==
+
==How to Use==
 
File contents can be read or set in rules anywhere <code>%variable-name%</code> can be used by using the format <code>%/local/file-name%</code> 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'''.
 
File contents can be read or set in rules anywhere <code>%variable-name%</code> can be used by using the format <code>%/local/file-name%</code> 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'''.
  
Line 13: Line 13:
 
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 <code>/local/</code>, 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.
 
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 <code>/local/</code>, 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 ==
+
==Access via HTTP==
 
Local files can also be accessed on the LAN at <code><your-hub-IP>/local/<fileName></code>; for example, <code><nowiki>http://192.168.1.5/local/myFile.txt</nowiki></code>.
 
Local files can also be accessed on the LAN at <code><your-hub-IP>/local/<fileName></code>; for example, <code><nowiki>http://192.168.1.5/local/myFile.txt</nowiki></code>.
  
== Manually Uploading and Managing Files ==
+
==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:
+
As mentioned above, files can be manually managed from '''Settings > File Manager'''. To do this:
[[File:File Manager Upload Btn.png|alt=Screenshot of "Upload" button in File Manager|none|thumb]]
 
  
Then, click the '''Browse''' button and select the file to upload:
+
1. First, select the '''Choose''' button: [[File:File Manager Upload Btn.png|alt=Screenshot of "Choose" button in File Manager|none|thumb]] 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.
[[File:File Manager Browse Btn.png|alt=Screenshot of "Browse..." button in File Manager|none|thumb]]
+
 
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):
+
2. Select '''Upload''' button again to upload the file, and wait until the upload is complete (a small progress bar will appear while uploading):
 
[[File:File Manager Upload Btn 2.png|alt=Screenshot of File Manager "Upload" button after file selected|none|thumb]]
 
[[File:File Manager Upload Btn 2.png|alt=Screenshot of File Manager "Upload" button after file selected|none|thumb]]
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)''':
+
 
[[File:File Manager Upload Success.png|alt=Screenshot of File Manager after successful upload|none|thumb]]
+
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)''':
 +
[[File:File Manager Upload Success.png|alt=Screenshot of File Manager after successful upload|none|thumb]]To delete a file, select the delete icon ('''C''') corresponding to that file.

Latest revision as of 04:33, 10 June 2022

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 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, 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:

1. First, select the Choose button:

Screenshot of "Choose" button in File Manager

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):

Screenshot of File Manager "Upload" button after file selected

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):

Screenshot of File Manager after successful upload

To delete a file, select the delete icon (C) corresponding to that file.