Hi,
I got lucky today at my local Staples and snagged two Dlink DCS-935L IP Cameras. I have them up and running, and I can see them in HA with a static image that is changed every 10 seconds using the generic MJPEG stream. I am now trying to add Telegram in, as one of the webcams I have in my porch and would like it to send a message/picture when my doorbell is pressed. I have the automation working, and can successfully send a text only notification with Telegram and syncs to my devices. But, when I try to add the photo, I get this error in my HA log:
16-09-10 19:35:23 homeassistant.core: BusHandler:Exception doing job
Traceback (most recent call last):
File "/home/hass/.homeassistant/deps/telegram/inputfile.py", line 90, in __init__
self.mimetype = InputFile.is_image(self.input_file_content)
File "/home/hass/.homeassistant/deps/telegram/inputfile.py", line 170, in is_image
raise TelegramError('Could not parse file content')
telegram.error.TelegramError: Could not parse file content
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/hass/lib/python3.5/site-packages/homeassistant/core.py", line 852, in job_handler
func(*args)
File "/srv/hass/lib/python3.5/site-packages/homeassistant/core.py", line 717, in _execute_service
service(call)
File "/srv/hass/lib/python3.5/site-packages/homeassistant/core.py", line 572, in __call__
self.func(call)
File "/srv/hass/lib/python3.5/site-packages/homeassistant/components/notify/__init__.py", line 106, in notify_message
data=data)
File "/srv/hass/lib/python3.5/site-packages/homeassistant/components/notify/telegram.py", line 102, in send_message
self.send_photo(photo_data)
File "/srv/hass/lib/python3.5/site-packages/homeassistant/components/notify/telegram.py", line 126, in send_photo
photo=photo, caption=caption)
File "/home/hass/.homeassistant/deps/telegram/bot.py", line 121, in decorator
result = func(self, *args, **kwargs)
File "/home/hass/.homeassistant/deps/telegram/bot.py", line 147, in decorator
result = request.post(url, data, timeout=kwargs.get('timeout'))
File "/home/hass/.homeassistant/deps/telegram/utils/request.py", line 227, in post
data = InputFile(data)
File "/home/hass/.homeassistant/deps/telegram/inputfile.py", line 94, in __init__
self.mimetype = mimetypes.guess_type(self.filename)[0] or DEFAULT_MIME_TYPE
File "/usr/lib/python3.5/mimetypes.py", line 289, in guess_type
return _db.guess_type(url, strict)
File "/usr/lib/python3.5/mimetypes.py", line 114, in guess_type
scheme, url = urllib.parse.splittype(url)
File "/usr/lib/python3.5/urllib/parse.py", line 861, in splittype
match = _typeprog.match(url)
TypeError: expected string or bytes-like object
This is my lines in automation.yaml
- alias: 'Back Door Notify'
trigger:
platform: state
entity_id: binary_sensor.2_door_chime_sensor_2_1
state: 'on'
action:
service: notify.webcam_telegram
data:
message: "Someone is at the back door!"
title: "Home Assistant"
data:
photo:
- url: http://192.168.86.130/image/jpeg.cgi
username: xxxxxx
password: xxxxxx
Does anyone have any idea what I am doing wrong, or canāt I parse the URL to get the snapshot?
Thanks,