kslb
(KSLBe)
September 7, 2021, 6:25am
1
Hi,
I have problem in configuration, that sending picture is not working with Telegram integration. Messaging is working normaly, but I have problem to add picture.
My configuration:
configuration.yaml
allowlist_external_dirs:
- "/share"
Automation (not working):
# Vklopljen SCHRACK ventilator
- id: '19000'
alias: Vklopljen SCHRACK ventilator
description: ''
trigger:
- platform: state
entity_id: switch.schrack_fan
from: 'off'
to: 'on'
condition: []
action:
- service: notify.simon_telegram
data:
photo:
- file: "/share/fan_on.png"
title: "SCHRACK"
message: "Vklopljen SCHRACK ventilator (več kot {{states('input_number.variable_kabinet_prizgi_schrack_ventilator') | float }}°C). Trenutna temperatura {{states('sensor.schrack_t') | float }}°C. Trenutna temperatura kabineta {{states('sensor.kabinet_t') | float }}°C."
mode: single
Thank you for support…
kslb
(KSLBe)
September 7, 2021, 6:26am
2
So, this is not working for me…
Withouth that automation is working fine and text message is sended fine…
photo:
- file: "/share/fan_on.png"
tom_l
September 7, 2021, 7:18am
3
You cant use title
or message
when sending a photo. You have to use caption
.
action:
- service: notify.simon_telegram
data:
title: ' '
message: ' '
data:
photo:
- file: /share/fan_on.png
caption: "Vklopljen SCHRACK ventilator (več kot {{states('input_number.variable_kabinet_prizgi_schrack_ventilator') | float }}°C). Trenutna temperatura {{states('sensor.schrack_t') | float }}°C. Trenutna temperatura kabineta {{states('sensor.kabinet_t') | float }}°C."
1 Like
kslb
(KSLBe)
September 7, 2021, 11:18am
5
Tried:
# Vklopljen SCHRACK ventilator
- id: '19000'
alias: Vklopljen SCHRACK ventilator
description: ''
trigger:
- platform: state
entity_id: switch.schrack_fan
from: 'off'
to: 'on'
condition: []
action:
- service: notify.simon_telegram
data:
title: ''
message: ''
data:
photo:
- file: /share/fan_on.png
caption: "Vklopljen SCHRACK ventilator (več kot {{states('input_number.variable_kabinet_prizgi_schrack_ventilator') | float }}°C). Trenutna temperatura {{states('sensor.schrack_t') | float }}°C. Trenutna temperatura kabineta {{states('sensor.kabinet_t') | float }}°C."
mode: single
But I get error:
Logger: homeassistant.components.telegram_bot
Source: components/telegram_bot/__init__.py:797
Integration: Telegram bot ([documentation](https://www.home-assistant.io/integrations/telegram_bot), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+telegram_bot%22))
First occurred: 13:11:00 (4 occurrences)
Last logged: 13:16:41
* Can't send file with kwargs: {'title': 'SCHRACK', 'file': '/share/fan_on.png', 'caption': 'Vklopljen SCHRACK ventilator (več kot 25.0°C). Trenutna temperatura 28.2°C. Trenutna temperatura kabineta 25.1°C.'}
* Can't send file with kwargs: {'title': '', 'file': '/share/fan_on.png', 'caption': 'Vklopljen SCHRACK ventilator (več kot 25.0°C). Trenutna temperatura 28.2°C. Trenutna temperatura kabineta 25.1°C.'}
So now is another problem… going somewhere…
tom_l
September 7, 2021, 11:45am
6
Try putting your file in config/www
and sending it from there. If you have to create the www folder you will need to restart afterwards.
kslb
(KSLBe)
September 7, 2021, 11:50am
7
Yea, I solved it:
No whitelist needed… Thank you …
# Vklopljen SCHRACK ventilator
- id: '19000'
alias: Vklopljen SCHRACK ventilator
description: ''
trigger:
- platform: state
entity_id: switch.schrack_fan
from: 'off'
to: 'on'
condition: []
action:
- service: notify.simon_telegram
data:
title: 'SCHRACK'
message: "Vklopljen SCHRACK ventilator (več kot {{states('input_number.variable_kabinet_prizgi_schrack_ventilator') | float }}°C). Trenutna temperatura {{states('sensor.schrack_t') | float }}°C. Trenutna temperatura kabineta {{states('sensor.kabinet_t') | float }}°C."
data:
photo:
- file: /config/www/images/telegram/fan_on.png
caption: ''
mode: single