Author |
|
patrickm Senior Member
Joined: February 22 2007 Location: United States
Online Status: Offline Posts: 188
|
Posted: January 24 2012 at 20:31 | IP Logged
|
|
|
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 |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: January 25 2012 at 12:13 | IP Logged
|
|
|
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 |
|
|
patrickm Senior Member
Joined: February 22 2007 Location: United States
Online Status: Offline Posts: 188
|
Posted: January 25 2012 at 16:53 | IP Logged
|
|
|
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 |
|
|
smarty Super User
Joined: May 21 2006 Location: United States
Online Status: Offline Posts: 728
|
Posted: January 26 2012 at 13:31 | IP Logged
|
|
|
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 |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: February 03 2012 at 09:42 | IP Logged
|
|
|
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 |
|
|
patrickm Senior Member
Joined: February 22 2007 Location: United States
Online Status: Offline Posts: 188
|
Posted: February 03 2012 at 10:55 | IP Logged
|
|
|
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 |
|
|