I have successfully setup the Telegram integration and created a bot that sends a picture from my doorbell camera (I am using the Amcrest integration for my AD410 doorbell) when motion is detected. I have found a issue/bug when using different camera sources:
When the snapshot is taken with the main camera, I get an error (see below).
When I setup a camera proxy and use it, the picture is sent successfully.
* Error sending photo: Image_process_failed. Args: (), kwargs: {'chat_id': 441726636, 'photo': <_io.BufferedReader name='/config/www/tmp/doorbell.jpg'>, 'caption': None, 'disable_notification': False, 'reply_markup': None, 'timeout': None, 'parse_mode': 'Markdown'}
Any idea what is going wrong here? The log is not very helpful.
My automation (this camera entity results in the error above):
alias: Doorbell Motion (Telegram)
description: ''
trigger:
- platform: state
entity_id:
- binary_sensor.doorbell_motion_detected
from: 'off'
to: 'on'
condition:
- condition: template
value_template: >-
{{ (as_timestamp(now()) -
as_timestamp(states.automation.doorbell_motion_telegram.attributes.last_triggered
| default(0)) | int > 60)}}
- condition: time
before: '22:00:00'
after: '06:00:00'
action:
- service: camera.snapshot
data:
filename: /config/www/tmp/doorbell.jpg
target:
entity_id:
- camera.doorbell
- service: notify.telegramgroup
data:
message: Motion Detected
data:
photo:
- file: /config/www/tmp/doorbell.jpg
My automation (this camera entity results in a successful notification):
alias: Doorbell Motion (Telegram)
description: ''
trigger:
- platform: state
entity_id:
- binary_sensor.doorbell_motion_detected
from: 'off'
to: 'on'
condition:
- condition: template
value_template: >-
{{ (as_timestamp(now()) -
as_timestamp(states.automation.doorbell_motion_telegram.attributes.last_triggered
| default(0)) | int > 60)}}
- condition: time
before: '22:00:00'
after: '06:00:00'
action:
- service: camera.snapshot
data:
filename: /config/www/tmp/doorbell.jpg
target:
entity_id:
- camera.doorbell_cropped
- service: notify.telegramgroup
data:
message: Motion Detected
data:
photo:
- file: /config/www/tmp/doorbell.jpg