Local Files in Rule 4.0

Iā€™m still trying to understand.

If I upload a couple mp3 files are these accessible in rule machine ?

Can perhaps you list a couple use cases how we could use local storage.

Yes, as a string. But I don't think there's anyway to "play" a string.

We are hoping you guys come up with cool use cases. That's why this is beta. One use that I played with, that gets talked about frequently, is the creation of logs that can later be pulled out to your computer. RM could log just about anything by appending to a file, complete with time stamp. There are of course other ways to do this as well.

4 Likes

When I first saw this new feature. my immediate thought was to log Node-Red logs and when RM added support RW access, insert those logs into HE native log stream..
Thx

Is there anyway in groovy to call these files?

1 Like

Not yet. I think this is a try something small first, and expand use later if it goes ok thing. Patience.

5 Likes

Yes you can upload image files and other files (css for instance) using file manager in settings and use the local file url for dashboards

12 Likes

@thomas.c.howard this may come in handy for your apps!

1 Like

Just to clarify for everyone, yes, but it is LOCAL, so it won't work for cloud dashboards

3 Likes

No upload button or anything on mine...

A bunch of people experienced this during the beta. All I can say is I reloaded the page 4-5 tiems and then it worked and hasn't done this since. Since it's still a beta feature, I'm sure they're still working on it!

3 Likes

Would be a neat feature if we could specify a picture for local access and a different url for cloud access in the dashboard.

3 Likes

Just tried this on my Google Home. In Rule Machine choose Run Custom Action, select Actuator, select the Google Home Speaker, select play track, select string, then put the url in for the mp3 you wish to play http://[hubip]/local/[mp3uploaded.mp3]

9 Likes

No upload button or anything after I installed, same as reported above - but then I rebooted the hub again and then it became active for me.

I created a rule that created a file - that worked. Upload worked fine too.

[hub-ip]/local/fileName shows the file. file://[hub-ip]/local/fileName does nothing.

Oh that is freaking excellent!
Well done Hubitat Team!

1 Like

@Brandon Just to clarify - you were able to play the mp3?

@mattias I just did it. It freakin worked! Played a MP3 file

2 Likes

I have two HE hubs - in one the File Manager worked straight after installation of 2.2.1. The other I had to reboot the hub to work. Probably a glitch that the guys from Hubitat will quickly figure it out.

Nice. I can see this being a good way to store those online audio files keeping them local. Iā€™m going to update my rules to point to local storage.

I feel there will be excellent use cases when it comes to writing programs under groovy. I just canā€™t think of a good example. :slight_smile:

Could something like Echo Speaks benefit from local storage?

Local storage, IMHO, is a HUGE enhancement to HE !!

It has a potential of opening the door for a lot of features using this local storage.

One that I can think right now would the possibility of an app doing the hub backup locally and, using an internal mail client or even a FTP client, send that backup file elsewhere.

Again, this is HUGE !!

Here is humble attempt to contribute ...

I think this approach will, sooner or latter, cause serious file management problems.

One problem that I can foresee is multiple RM Rules - and, in the future, apps, drivers and others "producers" and "consumers" of files - meddling with each other's files.

What I'd like to suggest, and I think that would be not too cumbersome to develop quickly, is, for start, to create files only in subfolders of /local/, and not directly under it. Doing so will make it a little more difficult for two different RM rules using the same file name meddling with each other's files.

So, to clarify what I'm suggesting:

  • File Manager should have the option to create/rename/delete folders under /local/
  • File Manager should only allow to upload files to folders, never to /local/ directly
  • In RM, files could be read and write to folders, but never create folders itself - this should be a task of File Manager only

This approach would allow future File Manager enhancements like:

  • Definition of folder and/or files disk space quota to avoid runaway RM rules eating up the available space
  • Definition of file access rights
    • Who (namespace perhaps ?) has read access
    • Who has write access
    • Who has Read/write access
    • Who has no access at all (none)
    • Default access right
  • Definition of access scope definition:
    • hub only
    • hub + LAN access
  • File retention option (great for a folder of temporary files automatic cleanup)
    • Keep files indefinitely
    • Keep files for a finite amount of time
    • Define files expiration dates

What Hubitat and the community think about it?

2 Likes

Correct, the local mp3 played through my google home speaker.