I do believe for what you are trying to do with your message, you need to use a data_template for your message. I’m not 100% sure on this, but that is the direction I would go in.
@TinyDoT, thanks, changed to data_template but still no change.
From looking at other notify.telegram examples in forum, it seems I have correct format but still no message element.
- service: notify.telegram
data_template:
message: >-
{% if states.sensor.facebox_detection.state != "unknown" %}
Facebox triggered. {{ states("sensor.facebox_detection") }} is at the door
{% else %}
Facebox triggered.
{% endif %}
data:
photo:
file: '/config/www/facebox/tmp/image.jpg'
caption: '{{now().strftime("%d.%m.%Y-%H:%M:%S")}}'
I have a hazy memory that you can only send a picture OR a message in one go, and if you send both the picture overrides the message. I think it’s because if you want a message and a picture it has a different format (so the text gets overlaid on the picture) that isn’t supported by something or other. It’s been a long time.
The workaround is to send the picture, and then send the message separately straight after.
@fergalom, mf_social might be on to something, you could split it up like mf_social said or you could send it in the caption, because you said that comes through. Just sent this:
'Facebox triggered. {{ states("sensor.facebox_detection") }} is at the door, {{now().strftime("%d.%m.%Y-%H:%M:%S")}}'
Forget about all the rest, it will tell you who or unknown is at the door, or just send the 2 messages. One of these ways should make you a Happy Camper, I hope.
Not sure if something changed lately, but for Home Assistant version 0.104.2 I can’t send a message and a picture on the same Telegram message. But sending both separetely worked fine with the following:
For a script editing yourself the scripts.yaml file: