The methods have been sitting in my repository for some time now, and have been implemented successfully in several places, but until now weren't very useful unless you wanted to write code. While the best way to fully utilize this code is still as a child device for an app or another device, this device driver provides some standalone capabilities and allows an application, RM, webCoRE, or anything else that can utilize a device interface, to write, append, and retrieve textual and image data from Hubitat's Local File Manager.
I have been wanting to use HE and webcore to update my many different music playlists (as I add and delete music to/from my collection). Will this driver allow me to load an entire playlist, add a new song, sort the list with webcore, and then output the new list back to my HE?
The write works well, and it can execute the readFile() command, just haven't figured out what webCoRE does with the return from the command yet. In a regular app it would be a simple
I apologize first off for posing such a vague question.
What would be an example of this? Could someone automate a shopping list with this? Weekly meal planning for family viewing? Forgive me if I'm way off on my understanding of potential.
Let's say you have a temperature device that you check with a rule every 10 minutes to make sure it stays within bounds. After a while you decide that you'd like to plot that temperature over a period of months; simple way to gather the data for doing that would be to append a new date stamped temperature entry into a file each time the rule ran, and then with another app read that file and plot the data.
Was hoping to get around the 1024 byte attribute limit by returning directly to the rule/piston, but appears that I can’t make it work that way - I’ll add a readFile with offset to bring back the data 1024 bytes at a time - should be able to get it up by late tomorrow.
Are you sure that this is an actual limit for attributes? I store image bytestreams much larger than 1kB in one of my drivers. You can't display them on a dashboard if greater than that size, but there's no issue I have seen with actually storing bigger attributes.
Just for reference, I have an image value in an attribute on my driver. It's a data URL that renders to the device page, and with the little bit of HTML around the base64 image data, it is currently storing ~32k characters.
Is there a way to delete a line from a file? So, if you only wanted to capture the last 1000 events, you would append line 1001, then delete line 1. Deleting lines by date would be even better, but seems like more of a database operation.
It’s what we use to call a sequential text file, so the easiest way to trim the top would be to read the file and determine the how many bytes you want to remove and use that as your starting point when re-writing the file, i,e, fileData = fileData.substring(500)
I've been trying [unsuccessfully] to get Google Charts to read and plot a data set using html and csv files on my HE. I had basically abandoned the idea because I thought it would be impractical to manually "manage" the source data file when it got too long. Your driver seems to be able to solve that problem. The next hurdle is pulling that data into a google charts object. The documentation says it's possible, but I'm not a programmer so the developer docs might as well be written in ancient Sanskrit...
Added temporary fileContent attribute (erases after 30 seconds - plenty of time for automation to process); if you use this option it is recommended that you set Event and State history for this device to 1 (no need to store the file in the file system and twice in the database).
Added fileList attribute
Added fileTopTrim command to allow the removal of the first X characters in the file
Added copyFile command to allow copying one local file to another