Problem sending picture to telegram

Sending text works fine, tried both telegram_bot.send_photo and notify.telegram_notify

# Telegram bot
telegram_bot:
  platform: polling
  api_key: xxxx:xxxxxx
  allowed_chat_ids:
    -xxxxx
  - name: telegram_notify
    platform: telegram
    chat_id: -xxxxxxx
    api_key: xxxxxx:xxxxxxx

this is the 2 different scripts which gives the same error:

  telegram_livingrom_pic:
    alias: 'telegram_livingrom_pic'
    sequence:
      - service: notify.telegram_notify
        data:
          title: Home Assistant Security
          message: 'Living room picture.'
          data:
            photo:
              - file: /share/livingroom1.jpg
                caption: Living room picture
 
  telegram_livingrom_pic2:
    alias: 'telegram_livingrom_pic2'
    sequence:
      - service: telegram_bot.send_photo
        data_template:
          message: "Hello, I am HASS boat. The custom keyboard is activated."
          file: /share/0df8c88e-43a8-11e7-9e7a-d3820533e437.jpg

this is the error message:


Can't send file with kwargs: {'title': 'Home Assistant Security', 'message': 'Living room picture.', 'file': '/share/livingroom1.jpg', 'caption': 'Living room picture'}

02:12 components/telegram_bot/__init__.py (ERROR)

'/share/livingroom1.jpg' are not secure to load data from!

02:12 components/telegram_bot/__init__.py (WARNING)

Found the solution, it was the whitelisting that was the problem.

homeassistant:
  whitelist_external_dirs:
    - /share
    - /tmp
4 Likes

Dear, andersB, may you please guiding me where was whitelist_external_dirs
because i’m a newbie in homeassitant
many thanks for your helps

Yes sir, what can I help you with?

when i tried to open /config directories in hassio but i couldn’t find where to input

homeassistant:
  whitelist_external_dirs:
    - /share
    - /tmp

because, i got errors from frigate notify to telegram as bellows:
ERROR (SyncWorker_7) [homeassistant.components.telegram_bot] Can't send file with kwargs: {'disable_notification': False, 'caption': 'Movimento rilevato. Telecamera: Outdoor', 'url': 'http://homeassistant.local:8123/ccab4aaf_frigate-fa/ingress/api/frigate/notifications/1699935711.217585-zgiqkn/OUTDOOR/clip.mp4'}
many thanks for your kindly helps…

Have you created a bash script which take the snapshot from the camera? For example

/config/snapshot_livingroom.sh

I have to go now but will be back tonight.