File created detection

Hi,
Is It possible to detect file creation in openhab rule ?
Il have xiaomi camera with synology surveillance station. Il want to send notification or send command ‘ON’ on a virtual switch when motion is detected. But, it’s not possible to get this information through surveillance station. I think, file created detection is the best way (file.mp4 is created on my synology when motion is detected).
Any ideas ? Thanks

(sorry for my english)

Exec binding with a shell script could do what you want

1 Like

You could implement it in a rule using some of the classes built into Java:

See

https://docs.oracle.com/javase/tutorial/essential/io/notification.html

This would be a little more responsive than polling a shell script, though the shell script would probably be easier to implement.

You could also use the systeminfo binding to watch the number of files in your target directory.

1 Like

Thanks for your differents answers. How can i do this ? With systeminfo to detect new files ?

Just set it up like described in the docs.

You’ll need to create an item to track the number of files in the target directory, along with a rule to send your notification when that value changes.