Adding a timestamp when writing to a file

I have a HE C8 Pro running the latest version 2.4.2.158. I'm using a File Manager call in a rule to write events to a file. I'd like to add a timestamp to each entry I write. I'm hoping that there is an easy way to add one to the string I write to the file.

It might be best to share your rule. How are you writing the lines now? The built-in %now% variable will represent the current time, but if your trigger is an event and that is the time you care about, %time% would refer to that (in many cases, these would be similar -- but, again, it depends on your rule).

1 Like

I've just added an action to a rule triggered by motion detected. The action: Write to Patio.log: 'motion'
The file is one that I uploaded using File Manager.

OK, then either of the above approaches should really work. I'd suggest %time% just because that's the one technically associated with the event. If your current string is "motion", you can write "%time% motion" to get this value prepended/interpolated before your text, or you can put it wherever in whatever format you want.

Note also that you'll get an options under the Actions to Run table to specify the time format (only after doing this), so that can help with other kinds of adjustments.