Hi all
I have a question regarding Telegram. I don’t get it working. It’s really strange.
What do I want: I want a motion image to be send through Telegram to my phone. This is my flow
alias: Send Telegram Motion Screenshot (test)
description: Source Dahua Camera
trigger:
- type: motion
platform: device
device_id: aaaaaaaaaaaaaaaaaaaaaaaa
entity_id: binary_sensor.00000_motion_alarm
domain: binary_sensor
condition: []
action:
- service: camera.snapshot
data:
filename: /screenshot/dahua_snapshot.jpg
target:
entity_id: camera.dahua_mediaprofile_channel1_mainstream
- service: notify.telegram_aaa
data:
message: test
data:
photo:
- file: /screenshot/dahua_snapshot.jpg
caption: Movement
mode: single
I also tried this:
action:
- service: notify.telegram_aaa
data:
title: Send an image
message: ''
data:
photo:
- url: http://192.168.168.168/cgi-bin/snapshot.cgi
username: username
password: password
authentication: digest
caption: Movement
The normal part:
- If I start the flows manually, the snapshot will be send. Even if I click it every 5 seconds. ALL THE TIME
- If in developer tools I change the state from the binary_sensor.00000_motion_alarm to on: The flow triggers and works. ALL THE TIME
- If I make a flow with only text to be send. This works always, also when the motion sensor has been triggered by onvif.
Now the strange part:
- Bot actions are NEVER working when the motion sensor has been triggered by a real event. Truly NEVER.
- When the sensor has been triggered by a real event, the snapshot in /screenshot/dahua_snapshot.jpg is ALWAYS updated to the new image.
I want to focus on the first option (saving the file to /screenshot/dahua_snapshot.jpg). If I look in the logging, I get these messages all the time if it fails.
2022-02-17 16:40:54 ERROR (SyncWorker_11) [homeassistant.components.telegram_bot] Error sending photo: Image_process_failed. Args: (), kwargs:{'chat_id': 1111111, 'photo': <_io.BufferedReader name='/screenshot/dahua_snapshot.jpg'>, 'caption': 'Movement', 'disable_notification': False, 'reply_markup': None, 'timeout': None, 'parse_mode': 'Markdown'}
Can anyone point me in a direction where I can solve this? I am just new with Home Assistant, but I can’t wrap my head around what I am doing wrong here.