I have button-card for take picture and send my phone with notify + telegram.
- type: custom:button-card
name: Çek
icon: mdi:camera-plus
tap_action:
action: call-service
service: script.cek_gonder
service_data:
baslik: 'Kamera Görüntüsü'
mesaj: 'Çekilen resim'
filename: "'/media/camera/tablet_{{ now().strftime('%d-%m-%Y_%H:%M:%S') }}.jpg'"
My script getting values but filename value sometimes throw error. Telegram cant send notification becuz filename have “seconds” variable.
Example generated file name ;
tablet_20-06-2022_12:24:30.jpg
Notify send phone : tablet_20-06-2022_12:24:30.jpg
then telegram trying to send notification: tablet_20-06-2022_12:24:31.jpg // +1 sec
My script;
cek_gonder:
alias: Çek Gönder
sequence:
- service: camera.snapshot
data_template:
filename: "{{ filename }}"
entity_id: camera.tablet
- service: notify.telegrambot
data_template:
title: '{{ baslik }}'
message: '{{ mesaj }}'
data:
photo:
file: "{{ filename }}"
caption: '{{ mesaj }}'
mode: single
icon: mdi:webcam
How can i set filename string value not date time ?