If I want to write something to a local text file, In past versions I had been able to select "append to file" and enter a new file name. I tried this on a C4 and a C7 with 2.3.0.124. The problem is I cannot enter a new name for the file, I can only select from existing filenames. So the work around is to select "write to file", then when the file is created I can go back and select "append to file"
It's always been this way. Append is something you do to an existing file, and writes to the end of the file; write to file is for a new file, or overwrites an existing file. This is no different than how these two actions work in any file system.
I agree Bruce - but in the past I never had to create a file, then go back and append to it, I was able to do it in one line of a rule. If the file was NEW, the append function created it, if the file existed, it appended to it. I'm old and I'll be the first to admit I'm getting a little soft in the head, but I swear I didn't have a two step to append to a file. How do you expect me to create a file the first time? Write a rule to write to a file, then come back and modify my rule to append to that file?
Ah, reminds of the good ol' Apple ][ days, where the AppleDOS would allow us to use APPEND in BASIC whether the file existed or not. If not, it got created and written to. I can definitely see the utility in this construct, although Bruce is technically correct. #chicken#egg
Well in my case the file existed when I wrote the rule, but it gets deleted in one line and appended to from the very next time. So presumably the system is happily creating the file before appending to it, and it's just the rule editor itself not allowing it.
Did you happen to note which firmware revision caused this to stop working for you? (Or perhaps I tl;dr'd the OP, and should maybe realize that this is a RM4-to-RM5 dilemma.)
Have you tried manually creating the file, picking it, completing your rule edit, then deleting the file? Does the hub still create the new file before appending, like it does for me??
I neglected to stop a rule the first time I tried your method. Albeit not intuitive (to me); after a re-do, I can confirm that your method does work. Thank You.
ktd: What you see; is also what I see using RM 5.1. The upgrade to RM 5.x occurred shortly after I acquired Hubitat so my experience and history with RM is limited.
Are you able to successfully enter a %variable-name% into the local file name field?
thx
Alas being a newcomer I am not sure what the expected behavior should be. I am still very much in the learning and digesting phase of the possibilities of RM and Hubitat. Thanks for checking.
I donβt really see the point in having the %device% in the name of the file. Just create a file ex. Devices.log and have %device% inte message that is appended to the file.
My intent was to help determine whether or not a %variable-name% could be used in the creation of a file name (using RM 5.1); as it was not working for me (or you). My question was related to this post.
At the present time your only solution (within Rule Machine) is to "write" to a file, then edit your rule to "append" to that file. I haven't tried creating the file with a text editor, which would probably work as well. Not a big deal, just a slight PITA.