Yi component "Image not available"

I’m trying to get my Yi Dome 1080p camera to work. The hack-v3 is working fine. App is working and video is being recorded. However, in HASS, I’m getting “Image not available”.

Configuration:

camera:
  - platform: yi
    name: Living Room
    host: 192.168.1.152
    password: !secret yi_cam
    ffmpeg_bin: /usr/bin/ffmpeg

Put the log in debug for component.camera and only see this in the log.

2017-12-23 22:16:02 DEBUG (MainThread) [homeassistant.components.camera.yi] Received configuration: OrderedDict([(‘platform’, ‘yi’), (‘name’, ‘Living Room’), (‘host’, ‘192.168.1.152’), (‘password’, ‘redacted’), (‘ffmpeg_bin’, ‘/usr/bin/ffmpeg’), (‘username’, ‘root’), (‘port’, 21), (‘path’, ‘/tmp/sd/record’)])

If I ftp to that directory, I see the following:

/tmp/sd/record # ls -al
total 2368
drwxr-xr-x 5 root root 32768 Dec 24 04:24 .
drwxr-xr-x 4 root root 32768 Dec 24 03:47 …
drwxr-xr-x 2 root root 32768 Dec 24 03:00 2017Y12M24D02H
drwxr-xr-x 2 root root 32768 Dec 24 04:00 2017Y12M24D03H
drwxr-xr-x 2 root root 32768 Dec 24 04:24 2017Y12M24D04H
-rwxr-xr-x 1 root root 2252800 Dec 24 04:24 tmp.mp4.tmp

The YMD folders all have the mp4 in them.

Put some more work into it this morning. Still the same problem. When I call camera.snapshot, the file is created correctly in /home/homeassistant/.homeassistant/snaps/filename.jpg". However, the file created has 0 length and is empty. Debug logs:

2017-12-24 11:48:58 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1835396176: Received {‘id’: 11, ‘type’: ‘call_service’, ‘service’: ‘snapshot’, ‘service_data’: {‘filename’: ‘/home/homeassistant/.homeassistant/snaps/file2.jpg’, ‘entity_id’: ‘camera.living_room’}, ‘domain’: ‘camera’}
2017-12-24 11:48:58 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=camera, service_call_id=1972814128-48, service=snapshot, service_data=filename=/home/homeassistant/.homeassistant/snaps/file2.jpg, entity_id=camera.living_room>
2017-12-24 11:48:58 DEBUG (MainThread) [haffmpeg.core] Start FFmpeg with [‘ffmpeg’, ‘-i’, ‘ftp://root:[redacted]@192.168.1.152:21/tmp/sd/record/2017Y12M24D17H/47M37S.mp4’, ‘-an’, ‘-frames:v’, ‘1’, ‘-c:v’, ‘mjpeg’, ‘-f’, ‘image2pipe’, ‘-’]
2017-12-24 11:48:59 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1972814128-48>
2017-12-24 11:48:59 DEBUG (MainThread) [homeassistant.components.websocket_api] WS 1835396176: Sending {‘type’: ‘result’, ‘success’: True, ‘result’: None, ‘id’: 11}

More info. Seems the system quietly explodes if there is an & in the password for the camera. Changed the password and removed the random characters. FTP works now, but getting this when attempting to process the command manually:

ffmpeg -i ftp://root:[redacted]@192.168.1.152:21/tmp/sd/record/2017Y12M24D17H/47M37S.mp4 -an -frames:v 1 -c:v mjpeg -f image2pipe -

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x54d9a270] moov atom not found
ftp://root:[redacted]@192.168.1.152:21/tmp/sd/record/2017Y12M24D17H/47M37S.mp4: Invalid data found when processing input

Sheesh. Finally got it. To get it to work, on the camera, I had to create a symbolic link in the root home directory to /tmp. Since the files are stored in the root of the camera in /tmp, HASS was accessing the file in /root/tmp. Created the link with

ln -s /tmp tmp

It works now! Little undocumented bug for the Yi setup there. I hope the symbolic link on the Yi filesystem survives a reboot.

7 Likes

You fix worked thanks a lot. The only problem is we have to sym link every time the camera reboots.

I’ve tested multiple times and have not had to recreate the symlink. For me, it’s been permanent.

@cexshun wow you are my hero… have been trying to get it to work for the past 2 days… thanks!!

Thank you! It solved my problem! :slight_smile:

This worked perfectly for me. Maybe there should be a note added to the documentation for the Yi component?

Glad it’s working for everyone. Seems I wasn’t the only one to get a new Yi camera for Christmas.:rofl:

1 Like

Using the symlink I got my Yi Home 1080p camera to work. However, as far as I can see there is no live feed in HASS. Is that correct? When would video show up in HASS?

Thanks for it man,
Solve my problem with YI Dome

how do i do this… running HASSIO?!

Thanks

Hi mate

I added the symbolic link to root directory of the camera but I’m still not seeing anything in Ha. Camera not available…

I can see mp4s in the tmp/sd/record dir but ha isn’t displaying.

Any ideas?

Now getting permission denied now. I updated my pub key and did an update after following another thread.

Any help would be appreciated

Have you tried manually FTPing to the camera from the Pi to make sure everything is working? I find it best to troubleshoot 1 aspect at a time and verify it’s working.

Also, if your FTP password has special characters, it will break. My password had an & in it, and it was causing errors.

Thanks for your advice - I’ll try it in a bit!

No special characters, just capitals and numbers.

Here’s what I wrote in another thread for some background info. (haven’t tested ftp yet - Mrs on laptop!)

This is my config:

ffmpeg: ffmpeg_bin: /usr/bin/ffmpeg
camera:
- platform: yi
name: Baby Cam
host: '192.168.0.29'
user: root
password: ***
path: /tmp/sd/record
- platform: local_file
file_path: /home/pi/screenshot.png

Here is the error i get (iv hit a few now!) And in Homeassistant im getting - ‘Image not aviaiable’

2018-01-28 20:20:01 ERROR (MainThread) [haffmpeg.core] FFmpeg fails program arguments must be a bytes or text string, not NoneType

I have put the symobilc link on the camera
i have added the path to the recordings in config…yaml
I can see the mp4s in sd/recordings/ with datestamped files
i have installed ffmpeg
i can see another local file image using the camera component
i have added the ffmpeg component with the location of where its installed: using:

sudo find -name ffmpeg

OK, it sounds like FTP may be fine and the issue is with FFMPEG or your config somewhere. When you can test FTP, we’ll know more. Here’s my config, and it’s working with 2 cameras currently.

  - platform: yi
    name: Living Room
    host: 192.168.1.152
    password: !secret yi_cam
    ffmpeg_bin: /usr/bin/ffmpeg
    ffmpeg_arguments: '-pred 1 -vf scale=800:450'

Edit: Here’s the command that is executed when HASS attempts to pull the video. This command will help troubleshooting a lot.

ffmpeg -i ftp://root:*****@192.168.1.152:21/tmp/sd/record/2017Y12M24D17H/47M37S.mp4 -an -frames:v 1 -c:v mjpeg -f image2pipe -

Replace **** with your password. Change IP to your camera IP address. Change the path and mp4 to an actual file that exists on the device.

1 Like

Thanks mate.

Right done all that, i get illegal instruction. The file definitely exists as copied the URL into IE and it downloads it:

ftp://****@192.168.0.29:21/tmp/sd/record/2018Y01M27D19H/30M00S.mp4 </code

Any other ideas?