Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: File Monitor Plugin Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: January 24 2012 at 20:31 | IP Logged Quote patrickm

Can the file monitor plugin create a unique trigger for a specific file change?

I have the ini file setup as follows:

[Setup]
filecount=2

[Files]
file1=c:\data\data.csv
file2=c:\data\warning\1.txt

I have tried various combinations of command and option in the Triggers window but the trigger fires if any file changes. Do I have to setup the ini file differently?

Patrick
Back to Top View patrickm's Profile Search for other posts by patrickm
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: January 25 2012 at 12:13 | IP Logged Quote dhoward

Patrick,

I checked out the code for File monitor plugin and it should be capable of firing a specific trigger for a specific file.

The Trigger ID Number should always be set to "Command 1". The Trigger Value can be set for the specific file you want to trigger on, ie. "Option 1" will be specific for file1. "Option 2" is specific for file2, etc. You can set to "[Any Option]" and the trigger will fire on any file change.

Also, in the TEMP variables will contain the name of the file that changed, the new datetimestamp, and the number of the file that caused the trigger to fire.

Hope this helps,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: January 25 2012 at 16:53 | IP Logged Quote patrickm

Thanks Dave,
I had it set to command 1, option 2 initially but it was always triggering on both files. I tried reinitializing and finally shutdown Powerhome and restarted it and it's working properly now.
Back to Top View patrickm's Profile Search for other posts by patrickm
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: January 26 2012 at 13:31 | IP Logged Quote smarty

Question: Could the file monitor plugin be set up to trigger whenever a new file shows up in a monitored directory? Is it even possible to monitor a directory with the plugin?

This could be useful for security CCTV systems....if no new files are created within XX minutes, it could mean that your CCTV system is no longer recording....



__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: February 03 2012 at 09:42 | IP Logged Quote dhoward

Smarty,

The current file monitor plugin couldnt be set to monitor a directory. However, I have on my todo list to create a new directory monitor plugin that would do what you're looking for (I have need for this as well ).

Trouble is, I havent quite decided how to implement it. It would be similar to the file monitor where in the INI file you would specify the directories to monitor. As soon as a new file appeared, the trigger would fire and would contain the name of the new file, etc. At this point, Im not sure how to proceed. I was originally going to write the plugin where it expects the directory to be empty. When a file appears, the trigger fires, but something has got to cleanup the file or else the trigger will fire again over and over until the file is gone. Since plugins run in their own thread, the next file check would occur probably multiple times before the file was completely processed by PH.

I was thinking that I could build a list of files that have been found and then exclude them from further triggers until they disappeared but that could get messy quickly if alot of files are appearing. Another thought was to have a second directory that is associated with each monitored directory so that as a file appears, the plugin would move the file to the second directory (where it could stay for however long until processed) and fire the trigger. This way, the trigger would only fire once and the file could linger (in the moveto directory) and be processed from there.

Im leaning towards the second implementation but was wondering your thoughts.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
patrickm
Senior Member
Senior Member


Joined: February 22 2007
Location: United States
Online Status: Offline
Posts: 188
Posted: February 03 2012 at 10:55 | IP Logged Quote patrickm

Dave,
Have you thought about a trigger option for file content change?

I have several files that are written periodically but the contents do not change. I compare the file lengths in the trigger boolean field right now but the event log is full of trigger checks for the file monitor.

Thanks,
Patrick
Back to Top View patrickm's Profile Search for other posts by patrickm
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum