Yi camera platform and notify

I have successfully got my Yi home 1080 camera working with the Yi platform. I can see the last video stored in the camera in the frontend.
But what I would like is to send this video through a notify service (Telegram in my case).
So, my question is how do I tell the notify service the path to the last video file in the camera?
Also, what should trigger that notification is a PIR detector in the same room. The camera starts recording that file for a minute when it detects motion. So, I think the automation should wait for at least a minute to get the file. How do I accomplish this?
One more thing: the files created with this camera are roughly 9 MB in size. How could I reduce the resolution when passing them to the notify service?
Sorry for asking so many questions.

Thanks in advance.

Well, I seem to have found the url to get what it seems to be the first frame of the last video as a jpg:


And for the video file:


I can send the photo to Telegram with this:

  "data": {
"photo": {
  "url": "https://xxxxx.duckdns.org:8123/api/camera_proxy/camera.camara_del_salon?api_password=xxxxx"
  "message": "Test",
  "title": "My message title"

But when I try to send the video with this:

  "data": {
"video": {
  "url": "https://xxxxx.duckdns.org:8123/api/camera_proxy_stream/camera.camara_del_salon?api_password=xxxxx"
  "message": "Test",
  "title": "My message title"

I get a bunch of errors related to ffmpeg and the message is not sent.

2018-01-13 13:48:59 ERROR (MainThread) [haffmpeg.core] FFmpeg fails all args must be str or bytes
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/haffmpeg/core.py", line 114, in open
  File "/usr/lib/python3.6/asyncio/subprocess.py", line 225, in create_subprocess_exec
stderr=stderr, **kwds)
  File "uvloop/loop.pyx", line 2368, in __subprocess_run
  File "uvloop/handles/process.pyx", line 564, in uvloop.loop.UVProcessTransport.new
  File "uvloop/handles/process.pyx", line 49, in uvloop.loop.UVProcess._init
  File "uvloop/handles/process.pyx", line 38, in uvloop.loop.UVProcess._init
  File "uvloop/handles/process.pyx", line 227, in uvloop.loop.UVProcess._init_options
  File "uvloop/handles/process.pyx", line 270, in uvloop.loop.UVProcess._init_args
TypeError: all args must be str or bytes
2018-01-13 13:48:59 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 410, in start
resp = yield from self._request_handler(request)
  File "/usr/lib/python3.6/site-packages/aiohttp/web.py", line 325, in _handle
resp = yield from handler(request)
  File "/usr/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 93, in impl
return (yield from handler(request))
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/ban.py", line 58, in ban_middleware
return (yield from handler(request))
  File "/usr/lib/python3.6/asyncio/coroutines.py", line 213, in coro
res = yield from res
  File "/usr/lib/python3.6/asyncio/coroutines.py", line 213, in coro
res = yield from res
  File "/usr/lib/python3.6/site-packages/homeassistant/components/http/__init__.py", line 430, in handle
result = yield from result
  File "/usr/lib/python3.6/site-packages/homeassistant/components/camera/__init__.py", line 387, in get
response = yield from self.handle(request, camera)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/camera/__init__.py", line 425, in handle
yield from camera.handle_async_mjpeg_stream(request)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/camera/yi.py", line 136, in handle_async_mjpeg_stream
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/aiohttp_client.py", line 121, in async_aiohttp_proxy_stream
data = yield from stream.read(buffer_size)
  File "/usr/lib/python3.6/site-packages/haffmpeg/core.py", line 156, in read
return self._proc.stdout.read(count)
AttributeError: 'NoneType' object has no attribute 'stdout'
2018-01-13 13:48:59 ERROR (SyncWorker_10) [homeassistant.components.telegram_bot] Can't load photo into ByteIO: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

Any suggestion?

Can you share how you got your Yi Camera to show an image in the front end?

I have done this:

  - platform: ring
  - platform: yi
    name: yihome
    password: *secret*
    ffmpeg_arguments: '-vf scale-800:450'

My ring shows an image, but the Yi camera block is displayed with the text (image not available).


First, you need the camera hacked with the yi-hack-v3:

And then you must enable the ftp server in the camera, which I found disabled after flashing. I do not remember to have done anything else.

Strange, I’ve done all that, still get nothing.

I also created a symlink at / of the camera from /root/tmp as discussed in another thread.
Also, it stopped working yesterday and I found out that the ip of the camera had changed. I do not know how to set up a fixed ip at the camera. I had to readjust my camera definition in configuration.yaml.

This may help - Yi cameras - HA now working with yi-hack-v3 firmware 0.1.5