Telegram - picture configuration

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"

image

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…

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"

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

Great… I will try it…

Thank you…

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… :slight_smile:

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.

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