I’m trying to send camera snapshot to telegram.
Automation works fine: creates timestamp variable, makes and saves snapshot to www folder, sends screenshot.
But image is not fresh.
For example: filename (= timestamp) is camera_20230526_150430.jpg, but timestamp on image is 2023/05/26 14:50:48.
Rtsp stream works fine, camera is configured properly, without any delays.
Difference between filename timestamp and timestamp on spanshot can be very different
I suppose HA saves and sends CACHED image. Any ideas how to fix it?
UPD: I suppose Caching happens on HA side, not camera side, because I see HA needs few (5-10) sec to load rtsp stream for lovelace card.
camera:
- platform: generic
name: "Camera-Vivotek"
stream_source: "rtsp://192.168.1.5:554/live.sdp"
action:
- service: input_text.set_value
entity_id: input_text.timestamp
data:
value: '{{ now().strftime("%Y%m%d_%H%M%S") }}'
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: camera.snapshot
data:
filename: /config/www/camera/snapshots/camera_{{ states("input_text.timestamp") }}.jpg
target:
entity_id: camera.camera_vivotek
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: telegram_bot.send_photo
data:
file: /config/www/camera/snapshots/camera_{{ states("input_text.timestamp") }}.jpg