Problem appending to a text file

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"

Seems as though this should be fixed.

@bravenel

1 Like

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.

2 Likes

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?

1 Like

see sample - I was able to type in a filename on append to file......there was no file picker option... rule 4.0

image

1 Like

I agree, I have the following working daily, from Rule Machine Legacy.

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

You're asking the OP yes? Cos I wasn't aware anything had changed.

1 Like

Greetings

I am experiencing the same challenge with file naming as reported by β€œ2ac16mo.”

Platform Version 2.3.0.124
Hardware Rev C-7
Rule Machine 5.1

I see no provision for entering a file name manually. There is only the file picker option.

I am a new Hubitat user and only have experience with RM 5.x so I don’t know how this may have been.

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??

2 Likes

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.

2 Likes

Seems it changed with RM 5.x. In RM Legacy, you still type the name of the file when appending.

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

1 Like

No, if I add %device% in the file name and hit enter, the name gets replaced with Bad File Name.

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.

1 Like

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.

(Auto-Generate a Local File)

1 Like

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. :upside_down_face:

1 Like