• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
action: file
#1
I created a file action for pilight V7 (development version).
It is intended to be used in rules to create files and write lines of text to them.
Code:
IF ... THEN file TO /home/pi/mylogs/myfile.txt MODE append TEXT My line of text

Functions and device variables can be used both in the file name and in the text to be written.

I myself am using it to log (rare) events, so I can examine them afterwards without having to sit and wait for them to happen.

The code and a more detailed description can be found here
 
Reply
#2
Why not call it a write action?
 
Reply
#3
What's in a nameSmile
Because it is filing information, I called it file, but write would be fine for me as well.
 
Reply
#4
Just because of the language:

write TO /tmp/log
or
log TO /tmp/log

instead of

file TO /tmp/log

That's what i meant.
 
Reply
#5
As I said, write is ok, but what do you think of this action? Is it worth making a PR?
If so, I will change the name to write first.
 
Reply
#6
Hey,
first of all great idea, I'd support that as well.
Is the order of the parameters fixed or variable? Like having this ->
Code:
IF ... THEN write TEXT My line of text TO /var/log/myfile.txt MODE append
working as well?
... and the mode is also optional?

I know these are "luxury" problems, just a spontaneous thought.. Big Grin
 
Reply
#7
There is no check on the order of the parameters, but they all have to be present.
It would have been easy to make MODE optional, but I think it is better to let the user explicitly define what the action must do.

Fyi. the current version on my github still is called "file".
 
Reply
#8
You can always do the pull-request Smile
 
Reply
#9
Yes, I know, but I prefer to do that only when you think a file/write action as such is useful enough to add it to pilight.Smile
 
Reply
#10
A write action would be nice. Could be extended to other writeable location like sockets.
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  _VARSTORE_ set action fourty2 1 933 05-19-2019, 09:07 PM
Last Post: curlymo
  skipping overridden action switch do1eh 2 605 01-19-2019, 05:25 PM
Last Post: do1eh
  http action Niek 21 4,026 08-12-2018, 11:44 AM
Last Post: rorie
  action: Pushbullet bazb 24 11,433 01-04-2018, 08:38 PM
Last Post: curlymo
  action: pushover Niek 36 17,558 12-03-2017, 11:13 AM
Last Post: Alex
  action: switch Niek 54 19,979 03-31-2016, 06:24 PM
Last Post: jjj
  action: program bazb 16 7,861 03-31-2016, 09:14 AM
Last Post: Niek
  action: toggle Niek 1 2,467 02-19-2016, 03:04 PM
Last Post: Joeks
  action: dim terrar 10 5,909 08-13-2015, 05:13 PM
Last Post: terrar
  Event action sipcal to make a voip phonecall pieterd 7 4,251 05-15-2015, 05:47 PM
Last Post: koos147

Forum Jump:


Browsing: 1 Guest(s)