Case: I want my VTO to grab a picture of caller and send it via telegram to home group members.
Problem: My VTO is by default capturing photos on call and saving them on FTP server (and I want to keep that functionality), therefore when I capture image with automation which grabs http://192.168.1.240/cgi-bin/snapshot.cgi it is getting delayed and most of the times person is already entering gate.
Possible solution: Mount that FTP directory to HA as media share (done, works) grab picture from there and send it via telegram.
Example image path on FTP is:
SnapShot/2024-01-17/12/12.53.51_1.jpg
So I created path like this:
file: >-
/media/SnapShot/{{ now ().year }}-{{ now
().month }}-{{ now ().day }}/{{ now ().hour }}/{{ now ().hour
}}.{{ now ().minute }}.{{ now ().second }}_1.jpg
and the problem is that is works only from time to time, when seconds really match.
As You can notice calls are divided in directories per paticular hour (dir 12 between dir with date and actual file) and as I usually dont really get two calls in same hour all I need is to enumerate files in that folder and pass first position found to automation. Is that doable?
At first moment I thought this can be it, but I am afraid it works only within one directory, while I need to jump deeper â to date, and even deeper â to actual hour. But I will test that anyway, just to be sure.
EDIT:
Oh my god, it works!
And I dont even need my VTO integration for that, it is just monitoring that dir and pushing everything that appears through telegram. Thank You very much!
EDIT2:
LOL, doesnât work
I mean it is working if I copy new file via explorer like I did for test. FTP service from VTO somehow puts files there without being noticed. I think I will try to mirror that dir with some NAS backup synchronisation and monitor the destination dir instead of FTP directly.
Folder replication didnt solve it. Somehow the automation only discovers new files when I create them via mounted path on HA side.
I put new file over FTP to directory which is being monitored â automation dont catch it
I go directly to NAS and put new file â automation dont catch it
I go to HAhost/media// and put file there â automation catches it
Switched the way around as well - unmounted NAS from HA and mounted HA share on NAS. Created replication between NAS FTP and HA share mounted on NAS - didnât work as well but I decided to play with event type.
I think it started to work once I changed event_type: created
to event_type: modified
Tested and it works and intended now. Dont have much time for further tests like checking if changing event_type from created to modified will help on original location, but I donât care, it works now and that is all I needed.