GithubHelp home page GithubHelp logo

roleoroleo / yi-hack-allwinner Goto Github PK

View Code? Open in Web Editor NEW
437.0 24.0 67.0 3.51 MB

Custom firmware for Yi 1080p camera based on Allwinner platform

License: MIT License

Shell 23.71% C 29.33% Makefile 0.82% CSS 0.60% HTML 17.77% JavaScript 6.27% Awk 0.03% C++ 21.39% Batchfile 0.08%
camera rtsp hack custom firmware yi

yi-hack-allwinner's Introduction

Releases Downloads

yi-hack-Allwinner is a modification of the firmware for the Allwinner-based Yi Camera platform.

Table of Contents

Installation

Backup

It's not easy to brick the cam but it can happen. So please, make your backup copy: https://github.com/roleoroleo/yi-hack-Allwinner/wiki/Dump-your-backup-firmware-(SD-card)

Anyway, the hack procedure will create a backup for you.

Install Procedure

If you want to use the original Yi app, please install it and complete the pairing process before installing the hack.

Otherwise, check setep 4.

  1. Check if your cam is supported in the "Supported cameras" section and note the file prefix.
  2. Format an SD Card as FAT32. It's recommended to format the card in the camera using the camera's native format function. If the card is already formatted, remove all the files.
  3. Download the latest release from the Releases page based on the file prefix.
  4. Extract the contents of the archive to the root of your SD card.
|-- Factory/
|-- newhome/
|-- home_xxx.stage
  1. (Optional) If you want to set wifi credentials, rename the file Factory/configure_wifi.cfg.ori to Factory/configure_wifi.cfg and edit the file with your username and password.
  2. Insert the SD Card and reboot the camera.
  3. Wait for the camera to update. It will reboot a couple of times as the camera is rooted and the new firmware is applied. It can take up to an hour to update. Once the light is solid blue for at least a minute it is complete.
  4. Check the hack opening the web interface http://IP-CAM (where IP-CAM is the IP address of the cam assigned by your router).
  5. Check the FAQ if you have a problem: https://github.com/roleoroleo/yi-hack-Allwinner/wiki/FAQ

Online Update Procedure

  1. Go to the "Motion Events" web page
  2. Remove all unnecessary video files
  3. Go to the "Maintenance" web page
  4. Check if a new release is available
  5. Click "Upgrade Firmware"
  6. Wait for cam reboot

If you don't delete mp4 files, the upgrade procedure will take a long time.

Manual Update Procedure

Check the wiki: https://github.com/roleoroleo/yi-hack-Allwinner-v2/wiki/Manual-firmware-upgrade

Optional Utilities

Several optional utilities are avaiable, some supporting experimental features like text-to-speech.

Contributing and Bug Reports

See CONTRIBUTING


Features

This custom firmware contains features replicated from the yi-hack-MStar project and similar to the yi-hack-v4 project.

  • FEATURES
    • RTSP server - allows a RTSP stream of the video (high and/or low resolution) and audio (thanks to @PieVo for the work on MStar platform).
      • rtsp://IP-CAM/ch0_0.h264 (high res)
      • rtsp://IP-CAM/ch0_1.h264 (low res)
      • rtsp://IP-CAM/ch0_2.h264 (only audio)
    • ONVIF server (with support for stream, snapshot, ptz, presets, events and WS-Discovery) - standardized interfaces for IP cameras.
    • Snapshot service - allows to get a jpg with a web request.
    • Timelapse feature
    • MQTT events - Motion detection and baby crying detection through mqtt protocol.
    • MQTT configuration
    • Web server - web configuration interface.
    • SSH server - dropbear.
    • Telnet server - busybox.
    • FTP server.
    • FTP push: export mp4 video to an FTP server (thanks to @Catfriend1).
    • Authentication for HTTP, RTSP and ONVIF server.
    • Proxychains-ng - Disabled by default. Useful if the camera is region locked.
    • The possibility to change some camera settings (copied from official app):
      • camera on/off
      • video saving mode
      • detection sensitivity
      • motion detections (it depends on your cam and your plan)
      • baby crying detection
      • status led
      • ir led
      • rotate
      • ...
    • Management of motion detect events and videos through a web page.
    • View recorded video through a web page (thanks to @BenjaminFaal).
    • PTZ support through a web page (if the cam supports it).
    • PTZ presets.
    • The possibility to disable all the cloud features.
    • Swap File on SD.
    • Online firmware upgrade.
    • Load/save/reset configuration.

Performance

The performance of the cam is not so good (CPU, RAM, etc...). Low ram is the bigger problem. If you enable all the services you may have some problems. For example, enabling snapshots may cause frequent reboots. So, enable swap file even if this will waste the sd

Supported cameras

Currently this project supports only the following cameras:

Camera Firmware File prefix Remarks
Yi 1080p Home 9FUS 8.2.0* y20ga -
Yi 1080p Home 9FUS 12.2.0* y20ga -
Yi 1080p Home BFUS 8.2.0* y20ga -
Yi 1080p Home BFUS 12.2.0* y20ga -
Yi 1080p Home SFUS 8.2.0* y20ga -
Yi 1080p Home SFUS 12.2.0* y20ga -
Yi 1080p Home BFCN 8.2.0* y20ga -
Yi 1080p Home BFCN 12.2.0* y20ga -
Yi 1080p Home 9FUS 8.3.0* y25ga -
Yi 1080p Home IFUS 8.3.0* y25ga -
Yi Dome X BFUS 8.1.0* y30qa -
Kami Baby LFUS 1.3.0* y501gc beta version

USE AT YOUR OWN RISK.

Do not try to use a fw on an unlisted model

Do not try to force the fw loading renaming the files

Is my cam supported?

If you want to know if your cam is supported, please check the serial number (first 4 letters) and the firmware version. If both numbers appear in the same row in the table above, your cam is supported. If not, check the other projects related to Yi cams:

Home Assistant integration

Are you using Home Assistant? Do you want to integrate your cam? Try these custom integrations:

You can also use the web services in Home Assistant -- here's one way to do that. (This example requires the nanotts optional utility to be installed on the camera.) Set up a rest_command in your configuration.yaml to call one of the web services.

rest_command:
  camera_announce:
    url: http://[camera address]/cgi-bin/speak.sh?lang={{language}}&voldb={{volume}}
    method: POST
    payload: "{{message}}"

Create an automation and use yaml in the action to send data to the web service.

service: rest_command.camera_announce
data:
  language: en-US
  message: "All your base are belong to us."
  volume: '-8'

Build your own firmware

If you want to build your own firmware, clone this git and compile using a linux machine. Quick explanation:

  1. Download and install the SDK as described here
  2. clone this git: git clone https://github.com/roleoroleo/yi-hack-Allwinner
  3. Init modules: git submodule update --init
  4. Compile: ./scripts/compile.sh
  5. Pack the firmware: ./scripts/pack_fw.all.sh

Instead of installing the SDK on your host machine, there's also the option to use a devcontainer from within Visual Studio Code. Please ensure you have the Remote - Containers extension installed for this to work.

Unbricking

If your camera doesn't start, no panic. This hack is not a permanent change, remove your SD card and the cam will come back to the original state. If the camera still won't start, try the "Unbrick the cam" procedure https://github.com/roleoroleo/yi-hack-Allwinner/wiki/Unbrick-the-cam.


License

MIT

DISCLAIMER

NOBODY BUT YOU IS RESPONSIBLE FOR ANY USE OR DAMAGE THIS SOFTWARE MAY CAUSE. THIS IS INTENDED FOR EDUCATIONAL PURPOSES ONLY. USE AT YOUR OWN RISK.

Donation

If you like this project, you can buy roleo a beer :)

Click here or use the below QR code to donate via PayPal

yi-hack-allwinner's People

Contributors

benjaminfaal avatar catfriend1 avatar copro avatar elraro avatar enricoferro avatar gauthier12 avatar rogerb831 avatar roleoroleo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yi-hack-allwinner's Issues

cedarx.conf

hello.
i'm looking for parameters on my yi cam hacked and i saw a strange thing:

cedarx.conf have a parameters with syntax error:
[paramter] --> parameter ?
max_start_play_chache_size = 153600 --> chache or cache ?
partition is read only, so i can't try to fix
what do you think about ?

Turn on/off the cam with HA automation?

Hi @roleoroleo ,
many thanks for everything! Your work is great!!
I 've a question about using the hacked Yi home 1080p camera with HA. Is it possible to turn on/off the cam with an automation in home assistant?

Thanks ;-)

Web UI does not properly save and show current settings

Hello,
I just upgraded the firmware to 0.1.5, and since this version, the Web UI does not seem to show the actual current configuration (under /home/yi-hack/etc/system.conf) and also doesn't seem to save the settings when clicking on the save button.
But this bug only applies to the Configuration Tab inside the Web UI (as far as I can tell (!)).

the camera reboot when i request a snapshot

Hey,

http Webinterface under 8080 works, but when i go to snapshot - the camera reboot again...

i have flashed the new 0.1.4 and try it with the older 0.1.3 version - same Problem.
I take a another new Camera (came 4 today) and the same issue - first snapshot is ok, when i reload the Snapshot in the Webinterface, or on the http://IP-CAM:8080/cgi-bin/snapshot.sh the camera reboot..... :-/

And that is no change if the SD Card is inside or outside,
I disabled all other funktions, RTSP Server, ONVIF, SSH, FTP, Telnet, nothing helps....

Firmware Version | 0.1.3
Base Version | 8.2.0.0A_201912270941
Model Suffix | y20gam
Serial Number | BFUSY31IDQBAT....................
Local Time | Mon Apr 27 15:49:52 GMT 2020
Uptime | 0h 6m 19s
Load Average | 1.80 1.24 0.56
Free/Total Memory | 25772/61164 KB
Free SD Space | 99%

by, David

Edit: works for a half hour good with no reboot and more Snapshots, but in the next Minuten after....reboot :-/

Can't flash camera

I try to flash BFUS Yi Camera under 8.2.0.0A firmware with Allwinner hack, put file on the root of my sd card (try 3 micro sd 8G x 2 and 2G) but every time th camera boot directly and don't flash new fimware.
I've already try MStar verqion of the hack but I ind in the GIT issue this firmware was not supported.
I try many things to flash this camera but can't.

HTML Link for camera

As stated above, with this revised FW what is the direct HTML link for video and for snapshot? thanks.

Snapshot function delivers the same image multiple times

I noticed the behaviour with 0.1.5, but still present in 0.1.6.
Calling the snapshot function via the web interface or also directly via /home/yi-hack/bin/imggrabber multiple times results in the same output. It seems the file /dev/shm/fshare_frame_buf remains static after being once initialized.

I verified with ssh root@Yi-IP "/home/yi-hack/bin/imggrabber -o stdout" |md5sum and the hash stays constant over multiple calls.

Additional unix tools & security

Hi Roleo, thanks for your work on this project. Once I have my cameras working I'll be sure to make a donation for your efforts.

I've just received a set of the Yi-Home cams and they turn out to be the BFUSY31 type. Successfully backed up the original firmware using the backup-script-on-SD-card method and flashed to the 0.1.5 hack version. Seems to work well so far.

There are a few things I ran into and I was wondering on your opinion.

The MQTT doesn't seem to generate any events, likely because of this existing issue.

My goal is to implement a 'poor mans cloud' where the device will upload movement to an offsite location, or alternatively, have an offsite script download movement videos when MQTT events come in. The absolute best way to have this platform working would be to have it continuously record to SD card 24/7, and send movement videos off-site... but I'm not sure if that is possible (There are no separate movement-videos when 24/7 recording is enabled right?).

In order to just sync the record directory to an external location we'll need some tools, most suited would be rsync. Though I noticed that rsync is not currently available on the platform. Is there any way to add these to either /home/yi-hack/bin or by perhaps utilizing the space available on the SD card (and adding that bin folder to the PATH)?

Lastly I wasn't able to set the root password and I noticed / (including /etc) to be ro-mounted. Available space on that is 0 bytes as well, which explains why this is the case. Do you have any suggestions as to securing the camera - especially if we want to make services like sftp publicly available to have a remote script fetch recordings?

Your work on this project is much appreciated!

Flashing is very short, cant conect anymore

I flash mi yi 1080p home BFUSY31CG1 with 8.0.0XX firmware.
I put the SD card with the 2 folders and one file , then I power on the cam.
Blue led flashes and i heard thye relay "click", then blue led flashes a couple of seconds and turns yellow. after a few seconds, the "click" again, the cam reboots flashing blu led a few seconds and then it conect to network, but i cant acces anymore. I read the wiki webcodes and noone work.
I saw in the network but i cant conect any way,
The flasin proces is incomplete im afraid.
I tray version 1.4 and the same thing happens.
I have return to flash last version, , 1.5 , with identical result,I cant conect anymore.
I have another identical cam and saw in the wiki the process to bacup stock firmware, but im dont know how to flas it again on the cam that dont work.
But id like to have rtsp streamin to my computer, so it will be wonderfull if this firmware works for me , any ideas?

Sorry for mi english

Wifi often lost; SD card full

I've noticed two weird things.

Over the last few days I've left my play-around-with camera unplugged. When I plugged it back in yesterday it had lost the Wifi settings and required to be re-paired with the app. Considered it a fluke until the exact same thing happened again today.

Now, every time that I temporarily unplug it (with the SD card inserted) it loses the Wifi settings. It does seem to be related to the SD card, though I'm not sure in what way. After resetting the Wifi I'm able to unplug it, even with the SD card in there, without problems.

Do we know what causes the Wifi settings to be lost? When not connected I cannot check the state of the /tmp/wpa_supplicant.conf file. Who is responsible for putting that file there? (assuming /tmp/ is empty at boot and the file needs to be put there at startup). Is there some master version of that file somewhere that can also be reset using the pinhole button?

Secondly I noticed the SD card to be almost full, while I had set it to always keep 10% free. Looking at the system.sh script this does not work for me...at all. Does it work for others?

For me cron does not even exist:

/usr/sbin/crond -c /var/spool/cron/crontabs/
-ash: /usr/sbin/crond: not found

And also the cleanup script itself does not seem to work, as it relies on 'df -h'...while the df command that is installed does not seem to know that -h option. Its a little odd that I am running into this issue but others seemingly not?

/home/yi-hack/script/clean_records.sh 10
90
df: unrecognized option: h

Snapshot vs out of memory

This cam works in a very critical memory situation.

root@xiaoyi:~# /home/yi-hack/usr/bin/free
              total        used        free      shared  buff/cache   available
Mem:          61164       45520        3428        1908       12216        7444
Swap:             0           0           0

During normal operations the available memory is more or less 3 MB and the main process (rmm) occupies more than 60% of it.
Unfortunately, it is frequent to have out of memory problems so it is very difficult to develop new features.
For example, a malloc of a yuv image (3110400 bytes) is enough to have problems.
If you take a snapshot sequence the cam will restart.

Online firmware upgrade loop

Hi,
thanks for this awesome work !
Tried to upgrade the fw online (0.1.3 to 0.1.4) but, after blinking orange, then blue, it's start again from orange to blue... Indefinitily !
I removed the SD card while it was blinking blue, and re-installed 0.1.3 on the SD.
All works so far, but I'm afraid to test again...

update to 0.1.5 leads to invalid option in system.conf

Hello.

Performing the update from 0.1.4 to 0.1.5 via the web interface left behind the line
DISABLE_CLOUD=&PASSWORD
in system.conf for me. I can't tell what it was before while on 0.1.4., but probably it was =no.

Somehow this prevented changes made on the configuration page to be saved.
Manually changing the setting system.conf via ssh fixed this for me.

Update to 0.1.6 runs better, but with yi watermark on rstp

HI, roleoroleo:

After 0.1.6 online update rtsp runs better, but a yi watermark is shown over the video on rtsp.

I have a suggestion too, but i don´t know if its posible:
maybe a switch to disable autoswitch to night mode?

And a question too: the new option to swap, may benfit rtsp stream?

Many thanks.

Uploading video recording in semi-realtime

Separate topic as this is a fairly separate item.

I'd like to be able to send/upload the tmp-video file as its being written to. This to minimize the 1-minute delay that is introduced if you wait for the tmp-file to first be completed and renamed to its 'final' filename.

However as we have no control over when the tmp-file is rolled (about once per minute) I'd thought it would be great to make a hardlink. Uploading data from that hardlink should work even if the tmp-file is being rolled in the meantime. It basically allows to attach a 'final' filename to a recording still in progress.

Typically the SD card uses FAT, and unfortunately FAT doesnt support hard links. I'm guessing the camera does not support the newer unix filesystems...but maybe it does support something basic.

In /home/base/tools we only have the commands to create FAT file systems. The typical ways of checking support for filesystems does not seem to work well. Do we know what filesystems are supported other than FAT, squashfs, tmpfs all of which are not usable in this case?

Firmware 0.1.6 only telnet

I had update from 0.1.4 to 0.1.6,

after this, only telnet work.

Then I install 0.1.6 after reset, only telnet is open.

Install 0.1.4, then it work's with webinterface and rstp

Camera with parental control

Hello,

I have the camera already hacked with last version and working fine. As I have already done in all of my other cameras I would like to block internet access enabling parental control. Nobody knows who is watching my image so I prefer to do this.The problem I have found is that if I block internet access, after some minutes, camera restarts and I stop receiving the image in my local server (inside my network) including the snapshot can be taken through web interface. In the moment I enable internet access, It works like a charm.
Could you have a look to this issue?

Regards,

Camera continuously rebooting after hack when replugged on power outlet

Hello,

After having configured the camera with the Yi Home App, I installed the version 0.1.6 of the Allwinner hack (the camera was connected to the USB plug of the computer):
everything was working fine: Http access to the configuration page on port 8880, RTSP stream through port 554 and the cam was still visible from the Yi Home App.

  1. I unplugged the camera from the PC to plug it directly to the power outlet using the stock power unit.
  2. Then the camera was endlessly rebooting (Steady Orange light -> Blinking Blue light -> Steady Orange -> Blinking blue, etc...). The microSD containing the AllWinner firmware was still in the device.
  3. When reconnecting the camera to the PC, it was booting normally and working again (Yi Home App, RTSP access, SSH, SCP) but the Http page on port 8080 is no longer accessible
    I repeated steps 2. and 3. several times and got the same results.
    I tried to reset the device or removing the microSD from the device, without any improvement.

Can you provide guidance to troubleshoot and fix that issue?

Thanks

RTSP performance

After configuration, enabling only ONVIF and RTSP (both with low Q) I loose camera connection randomly and camera reboots also from time to time. It seems a lack of performance. Are you aware about it? Do your know what can be done to improve it?

MQTT "Cannot open directory"

Trying to work out the mqtt-home assistant stuff. I have other MQTT devices around my house all working as expected.

After activating MQTT on the camera I wasn't receiving the motion_start or motion_stop signals.

Found this

#3

and did the suggested

root@yi-hack:~# killall mqttv4
root@yi-hack:~# LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/yi-hack/lib
root@yi-hack:~# ####/home/yi-hack/bin/mqttv4

Now I get this on screen

CALLBACK MOTION START
Client yi-cam sending PUBLISH (d0, q1, r1, m16, 'yicam/motion', ... (12 bytes))
Client yi-cam received PUBACK (Mid: 15)
Client yi-cam received PUBACK (Mid: 16)
SENDING FILES LIST
Cannot open directory: 2020Y04M23D12H
Client yi-cam sending PUBLISH (d0, q1, r1, m17, 'yicam/files', ... (85 bytes))
Client yi-cam received PUBACK (Mid: 17)
CALLBACK MOTION STOP
Client yi-cam sending PUBLISH (d0, q1, r1, m18, 'yicam/motion', ... (11 bytes))
CALLBACK MOTION START
Client yi-cam sending PUBLISH (d0, q1, r1, m19, 'yicam/motion', ... (12 bytes))
Client yi-cam received PUBACK (Mid: 18)
Client yi-cam received PUBACK (Mid: 19)
SENDING FILES LIST
Cannot open directory: 2020Y04M23D12H

Wondering if the "Cannot open directory" is what's causing the problems.

Thank you for any help you can provide.

RTSP Stream Artifacting and Distorting

Project Version

0.1.2

Description

During viewing and recording the the RTSP Stream, I noticed significant artifacting and distorting of the following clip.
tmp.mp4.zip

Viewing the file in VLC leads to the image showing as distortion, while viewing in QuickTime Player the clips shows as artifacting at the top and a black/green screen at the bottom.

FFMPEG -version

ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.17)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
libavutil      56. 31.100 / 56. 31.100
libavcodec     58. 54.100 / 58. 54.100
libavformat    58. 29.100 / 58. 29.100
libavdevice    58.  8.100 / 58.  8.100
libavfilter     7. 57.100 /  7. 57.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  5.100 /  5.  5.100
libswresample   3.  5.100 /  3.  5.100
libpostproc    55.  5.100 / 55.  5.100

VLC Version

3.0.8

QuickTime Player Version

10.5 (1015.2.1)

BFUSY31 cam impossible to hack

Hi Roleo,
I have a Yi home 1080p with BFUSY31... with firmware 8.2.0.0A_201912270941.
I downloaded the y20gam_0.1.5.tgz file from https://github.com/roleoroleo/yi-hack-Allwinner/releases, formatted the SD using Fat32 (I tried with a 64Gb SD first and then with a 16Gb SD). I put the y20gam_0.1.5.tar file (what i have inside the archive) into the SD and then I turn on the cam but nothing happens.

The problem is that the cam start as normal withou flashing the firmware. The yellow led start to flash but after that became blu. If I reset the cam before to put the SD, when it turn on starts speaking "Waiting to connect" .

Can you help me?

Many thanks

Here the content of the SD card
image

Repair 'interrupted' mp4 video files

I'm trying to find a way to make 'cut off' mp4 files playable. These are files that were copied from the camera while the Yi software was still writing to them. So far without much luck unfortunately.

The video data is there. But from what I understand the mp4 format can have some 'metadata' at the end of the file, and this would be required to play the video.

There are some tools and services that theoretically can do this for you. I've tried these:

And various online recovery services. None of these seem to work...I didn't get a working video files from any of these. Most likely some crucial mp4 parameters, specific to this camera/model, need to be used in this repair process.

Has anybody tried this, or already know of another way to repair interrupted mp4 video from the Yi home cam?

RTSP - Set or limit fps?

Hi,

Keep up the great work!

My question (or feature request) is:
Is there a way to set or limit the frames per second of the RTSP streams?

v0.1.6 - MQTT motion NOT send ON (motion start message)

i've configured MQTT Motion Topic as
Topic Suffix : motion
Motion Start Message : on
Motion Stop Message : off
Topic Suffix for video list message : files

################# etc/mqttv4.conf
(...)
MQTT_PREFIX=yicamdos

# -----------------------------------------------------------------------------
# Set the topics where the messages will be published
# The final topic will be MQTT_PREFIX/TOPIC_MOTION
# -----------------------------------------------------------------------------
TOPIC_MOTION=motion
TOPIC_MOTION_FILES=files
TOPIC_BABY_CRYING=baby

# -----------------------------------------------------------------------------
# Set the topics messages
# -----------------------------------------------------------------------------
MOTION_START_MSG=on
MOTION_STOP_MSG=off
BABY_CRYING_MSG=crying

# -----------------------------------------------------------------------------
# Other settings
# -----------------------------------------------------------------------------
MQTT_KEEPALIVE=120
MQTT_QOS=1
MQTT_RETAIN=1
------------------ log # python3 mqtt-data-logger.py -b ?.?.?.? -u ? -P ? -t "yicamdos/#" -t "yicamuno/#" 
Python version is sys.version_info(major=3, minor=5, micro=3, releaselevel='final', serial=0)
Log Directory = mlogs
Log records per log = 5000
Max logs = Unlimited
initialising clients
Logging JSON format
starting storing only changed data
{"topic": "yicamdos/motion_sensor", "time": [2020, 5, 16, 11, 34, 0, 5, 137, 1], "message": "motion_stop"}
{"topic": "yicamdos/motion_files", "time": [2020, 5, 16, 11, 34, 0, 5, 137, 1], "message": {"start": "1970-01-01T01:00:00+0100", "end": "2020-05-16T09:44:01+0200", "files": ["2020Y05M16D09H/44M00S60.mp4", "2020Y05M16D09H/43M00S60.mp4"]}}
{"topic": "yicamdos/motion", "time": [2020, 5, 16, 11, 34, 0, 5, 137, 1], "message": "off"}
{"topic": "yicamdos/files", "time": [2020, 5, 16, 11, 34, 0, 5, 137, 1], "message": {"start": "1970-01-01T01:00:00+0100", "end": "2020-05-16T10:45:30+0200", "files": ["2020Y05M16D10H/45M00S60.mp4", "2020Y05M16D10H/44M27S32.mp4"]}}
{"topic": "yicamuno/motion_sensor", "time": [2020, 5, 16, 11, 34, 0, 5, 137, 1], "message": "motion_stop"}
{"topic": "yicamuno/motion_files", "time": [2020, 5, 16, 11, 34, 0, 5, 137, 1], "message": "{\n\"start\":\"1970-01-01T01:00:00+0100\",\n\"end\":\"2020-05-15T22:16:26+0200\",\n\"files\": ]\n}\n"}
{"topic": "yicamuno/motion", "time": [2020, 5, 16, 11, 34, 0, 5, 137, 1], "message": "off"}
{"topic": "yicamuno/files", "time": [2020, 5, 16, 11, 34, 0, 5, 137, 1], "message": "{\n\"start\":\"1970-01-01T01:00:00+0100\",\n\"end\":\"2020-05-16T11:32:32+0200\",\n\"files\": ]\n}\n"}
{"topic": "yicamuno/files", "time": [2020, 5, 16, 11, 34, 43, 5, 137, 1], "message": "{\n\"start\":\"1970-01-01T01:00:00+0100\",\n\"end\":\"2020-05-16T11:33:33+0200\",\n\"files\": ]\n}\n"}
{"topic": "yicamuno/files", "time": [2020, 5, 16, 11, 35, 45, 5, 137, 1], "message": "{\n\"start\":\"1970-01-01T01:00:00+0100\",\n\"end\":\"2020-05-16T11:34:35+0200\",\n\"files\": ]\n}\n"}
{"topic": "yicamuno/files", "time": [2020, 5, 16, 11, 36, 48, 5, 137, 1], "message": "{\n\"start\":\"1970-01-01T01:00:00+0100\",\n\"end\":\"2020-05-16T11:35:38+0200\",\n\"files\": ]\n}\n"}
------------------ log MQTT Home Assistant
Mensaje 35 recibido en yicamuno/motion a las 11:23: off QoS: 0 - Retain: false
Mensaje 34 recibido en yicamuno/files a las 11:22: {"start":"1970-01-01T01:00:00+0100", "end":"2020-05-16T11:21:32+0200", "files": ]} QoS: 0 - Retain: false
Mensaje 33 recibido en yicamuno/motion a las 11:22: off QoS: 0 - Retain: false
Mensaje 32 recibido en yicamuno/files a las 11:21: {"start":"1970-01-01T01:00:00+0100", "end":"2020-05-16T11:20:30+0200", "files": ]} QoS: 0 - Retain: false
Mensaje 31 recibido en yicamuno/motion a las 11:21: off QoS: 0 - Retain: false

Password Reset

How can I reset the password if my ssh is disabled? My password isn't working and I can't access the web interface. I've locked out myself I think.

Snapshot with high resolution starts shows the same still image after a while

Hello,
Thanks for a great work on hacking this camera!
It works well for me most of the time, though i'm experiencing some weird issue with image snapshot in high resolution when camera runs for a day or so.

I use it with Home Assistant by defining it as generic camera in such a way:

- platform: generic
  name: Living Room Panoramic Camera
  stream_source: rtsp://192.168.2.54:554/ch0_0.h264
  still_image_url: http://192.168.2.54:8080/cgi-bin/snapshot.sh?res=high&watermark=yes
  verify_ssl: false

As you can see, i set res to "high".

In lovelace i define it like so:

- aspect_ratio: 50%
  camera_view: live
  entity: camera.living_room_panoramic_camera
  type: picture-entity

With such a definition Home Assistant query camera's snapshot endpoint now and then when you are looking at it via UI.

After ~day camera starts showing outdated image that never change (watermark changes though and rtsp works as well). The only way to fix it is to reboot the camera.
If i switch back to "low" res, it works without any issues.

Is it a bug or just some misconfiguration on my side?

P.S.: Is there any chance to implement "mid" res suppose? Low res resolution is too small, high res is fine, but quite slow.

Regards, Alex

Unable to flash

I have just got one of these to fiddle with - was hoping to install the yi-hack-v4 firmware, but realised on arrival that it was the new 9FUS version. For some reason, despite the version and firmware matching those described in the readme, I cannot get to to flash. Probably something I am doing wrong, but thought I would post here in case it is an issue.

Details
Camera: YI 1080p home camera, model 9FUSY31ZWT
Firmware: 8.2.0.0A_201912270941
SD card: 16GB Sandisk ultra

Steps taken

  1. Camera powered on, intial set-up completed with the Yi app to connect to WiFi
  2. SD card inserted and formatted using the camera itself (FAT32)
  3. Camera powered off, SD card inserted in PC, contents of archive copied to root of SD card (home_y20gam.stage and "Factory" and "newhome" folders.
  4. SD card inserted to camera, camera powered on.

I have tried this a few times. The camera comes on, yellow light shows for around 30 secs, then reboots again. At that point the camera seems to boot normally, blue light flashes then steady and the camera is accessible through the Yi app. The firmware upload does not appear to work.

Happy to troubleshoot further if you let me know what info you need.

Can't use last hack and yi home app

Hello and thanks for the great hack and all this new improvements.
I have a problem to use my camera with yi home app when i apply your hack.
Innfact for the app my camera if out of line so I can't use the app feature and can't stream the video to a google home for exemple.What i'm doing wrong ?
In first time I think it the password authentification but when I restore to default (none) I have no more app connexion.

How to compile firmware

While trying to compile things I did notice that a special SDK is needed to compile thing. compile.sh references /opt/yi/toolchain-sunxi-musl/toolchain, but I cannot really find where I could get this toolchain. Can someone give a hint where to get this?

add way to change starting port

can you add a way for us to set the port before installing the firmware? i have stuff that uses port 8080 so i have to disable it every time i want to set up a camera.

When using the UI to reboot a Camera, it redirects before shutdown

Camera: 9FUS Allwinner
Hack Version: 0.1.4

When using the UI to reboot the camera, the UI retries the connection before the webserver has successfully shutdown, leading it to redirect and it to drop the connection.

Maybe we can wait 10s, or some other defined value that we know, to wait before checking.

Home Assistant Integration

Hello @roleoroleo,

First I want to say a huge thanks for putting this together and maintaining it. I was able to get 4x BFUS* cameras flashed with the custom firmware, and running RTSP/ONVIF with very little effort thanks to all the hard work. Everything works smoothly (other than the known stream artifact issue).

I am using the wildly popular Home Assistant platorm, and was able to get the snapshots & streams working through the platform using the ONVIF component. Awesome.


The Goal

Although ONVIF is useful, direct integration with the Yi Camera platform is much preferred, for several reasons.

One main reason is so the binary sensors are registered, allowing use of the cameras as occupancy/motion sensors. This enables running automated routines based on these triggers (i.e. in-home security system triggers, turning lights on automatically, etc.)

Additionally, using the Yi Camera component would also theoretically allow access the direct camera stream, avoiding the need to use RTSP/ONVIF. This would also circumvent the current issues with distortion.

The Problem

The Home Assistant Integration requires the FTP server to be enabled, with a password set. Without a password set, it will not work. However, running the passwd command ultimately results in the following failure:

passwd: /etc/passwd: Read-only file system
passwd: can't update password file /etc/passwd

As you referenced in another issue, the rootfs is readonly for the new cameras. However, this essentially means that it is not possible to integrate these newer cameras with Home Assistant using the Yi Camera component.

Is there any chance that either yourself or the community are willing to pursue this further? Home Assistant integration would be incredibly useful.

Thanks for your time.

MQTT problem in 0.1.5

There is s problem in 0.1.5.
The cam doesn't send mqtt messages because of an error in mqttv4 daemon.

NTP server via web admin interface?

I like to run my cam without any internet connection. Regarding time service I'd like to use an internal ntp server. I can set this manually in the /home/yi-hack/etc/system.conf
NTP_SERVER={local ip address}

Could this be added to the web admin interface for a later version?

MQTT Daemon Not Connecting to MQ Broker

Yi-Hack-Allwinner Version: 0.1.2

Description:

Using the web interface to configure the MQTT then rebooting the camera does not show that the camera is connecting to the MQ Broker.

In this case, I'm using Mosquitto MQ running on a Raspberry Pi under Docker. Connecting to port 1883.

Checking the Mosquitto logs, I don't see a connection attempt to the broker.

Notification on baby crying (audio) instead of movement (video)

Hello,
I received two of the Alwinner versions of the Yi 1080p Home Camera from amazon.de today. The first one I already flashed with v0.1.4, working nicely.

I wonder if I can get a notification based on audio? Maybe via mqtt? Then it would be very usefull as babycam. My kid moves quite a lot during sleep, motion detecion will either give loads of false positives (if too sensitive) or will not trigger at all (if not sensitive enough). On the other hand audio level should be quite easy.

Greetings

Changing the WLAn being used

Hello, thanks for this wonderful project. I'm wondering though how do I change the wireless network being used by the camera? I need to change the location of the camera and there is a different network there.
thanks.

Reset password UI

After the reboot for the upgrade 0.1.5, I can't access to the control panel UI.
my password doesn't work.
Is there a way to reset it ?

Thanks

Adjust bitrate

Hi roleoroleo,
Thank you for bringing yi-hack to the allwinner chipset!

Do you think there is a possibility to adjust the bitrate of video stored in the sdcard?
I wasn't able to find a config file on the camera related to that.

Thank you for your insight!

High Quality RTSP does not work in the daytime

I have two Yi Home 1080P cameras, both of which are the same "9FUS" version.

The one that is having issues is on base version 8.2.0.0A_201912270941. During the night, the high quality feed works fine. However, during the day, the high quality feed doesn't work, and when I play it though VLC, I can hear the audio, but I don't get video. The low quality feed works fine; both audio and video work.

I have tried to turn off the IR light setting, but it doesn't seem to fix anything. This camera was recently converted, so 0.1.6 was the first version installed on it.

My other camera is on base version 8.2.0.0A_201912121707. I've been using the hack on this camera for quite a while, so it was updated to 0.1.6 within the settings. The camera has no issues with the high quality RTSP feed working in the day or night.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.