EliasKotlyar / Xiaomi-Dafang-Hacks

4.17k stars 1k forks source link

Feedback / Support - Issue #7

Closed EliasKotlyar closed 6 years ago

EliasKotlyar commented 6 years ago

This issues is for support and/or general discussions. Open up an issue if you want to have something improved.

jmtatsch commented 6 years ago

@EliasKotlyar I cannot get HLS working with safari, are you sure that it should work?

The playlist seems to exist:

curl http://192.168.180.30:8554/unicast.m3u8
#EXTM3U
#EXT-X-ALLOW-CACHE:NO
#EXT-X-MEDIA-SEQUENCE:38485
#EXT-X-TARGETDURATION:5
#EXTINF:5,
unicast?segment=38485
#EXTINF:5,
unicast?segment=38490
#EXTINF:5,
unicast?segment=38495
#EXTINF:5,
unicast?segment=38500

but I am unable to download one of the segments:

curl -v "http://192.168.180.30:8554/unicast?segment=38500"
*   Trying 192.168.180.30...
* TCP_NODELAY set
* Connected to 192.168.180.30 (192.168.180.30) port 8554 (#0)
> GET /unicast?segment=38500 HTTP/1.1
> Host: 192.168.180.30:8554
> User-Agent: curl/7.54.0
> Accept: */*
> 
< HTTP/1.1 405 Method Not Allowed
< Date: Fri, Dec 29 2017 10:40:13 GMT
* no chunk, no close, no size. Assume close to signal end
Shaktohh commented 6 years ago

Hello, My Dafang just crashed when i sent the turn left command. (IR light and cut was on, rtsp mjpeg was on (x2 vlc)) I couldn't connect anymore to ftp, ssh, apache Is there a place to check the log ?(I had to power off / on the camera)

blackgearit commented 6 years ago

@EliasKotlyar I've changed the SD card also, nothing is changed..

EliasKotlyar commented 6 years ago

@markus0m : I corrected this, now the flip is also horizontal @jmtatsch : It should work out of the box with the config which is in action.cgi. Have you changed it somehow? Which RTSP do you mean : the MJPEG or the H264? The MJPEG dont support HLS.

@Shaktohh : You can find logs in /var/log. It seems that it run out of memory and then stopped working. @blackgearit : I need to try to implement the "host"-mode

Shaktohh commented 6 years ago

Log had disapeared after the reboot, i already checked them with a cat /var/log*/*

dmolner commented 6 years ago

All is working very good for me. Is possible a instruction for make a video? Example -> Start video and late move the cam 360º and finish de video.

Happy new Year for all

ChickenWingDildo commented 6 years ago

I've been following this work for a while and finally tried to apply the CFW to one of my cameras.

I tried two different SD cards and both had the same outcome. Not working :)

I formatted them in windows (tried both FAT and FAT32) put only demo.bin on them and put them in the camera. Made sure there are no hidden files or folders on the card.

When I boot with the setup button held I've tried holding for 1, 3, 5, 10, 30 seconds. All of them do the same thing except the 30 seconds which resets the camera into setup mode.

I basically get a normal boot no matter what and then base rotation. I can't seem to get the camera to read demo.bin.

When I pull the card out of the camera and put it back into my PC windows complains that the drive needs to be fixed and there is a time_lapse folder on the card. I assume that means it didn't apply any CFW.

I tried booting without the card to see if maybe it was just super fast flashing, but I don't get the blue light either.

Any other suggestions.

Shaktohh commented 6 years ago

Check your sd card partitions (maybe you haven't only one) ?

ChickenWingDildo commented 6 years ago

@Shaktohh I went into the disk manager and deleted all the partitions on the card and then made a single 100MB partition which I was using. That was my first thought :)

Chris-Nbg commented 6 years ago

@EliasKotlyar

I flashed custom firmware 1.2 and are able to access the camera via xxx.xxx.xxx.24/cgi-bin/status.cgi. Controlling LEDs and motors does work. Unfortunately I don't get any picture or stream, e.g. using Get Image - Normal yields an error message at xxx.xxx.xxx.24/cgi-bin/currentpic.cgi?width=1920&height=1080 telling me that the picture cannot be displayed because it has errors. The log file at xxx.xxx.xxx.24/cgi-bin/action.cgi?cmd=showlog yields:

sh: 1: unknown operand sh: 1: unknown operand Segmentation fault xxx.xxx.xxx.25 - - [01/Jan/1970:00:08:14 +0000] "GET /cgi-bin/currentpic.cgi?width=1920&height=1080 HTTP/1.1" 200 0 "http://xxx.xxx.xxx.24/cgi-bin/status.cgi" "Mozilla/5.0 (Windows NT 6.1; rv:57.0) Gecko/20100101 Firefox/57.0"

I'm using Windows 7 & Firefox Quantum. Any hints on how to proceed?

Thanks a lot!

markus0m commented 6 years ago

@Chris-Nbg You can't use currentpic while a stream is started. Maybe that's your problem?

@EliasKotlyar Any chance of making both work? Pausing streams while retrieving a still image would be fine.

Chris-Nbg commented 6 years ago

@markus0m My procedure is:

Thx.

Edit:

Connecting via SSH yields:

login as: root
root@xxx.xxx.xxx.24's password:
[root@DAFANGHACKS:~]# /system/sdcard/bin/ossplay /usr/share/notify/CN/init_ok.wav
[root@DAFANGHACKS:~]# /system/sdcard/bin/h264Snap > /system/sdcard/video.h264
Segmentation fault
[root@DAFANGHACKS:~]#

Audio record/playback works flawlessly.

lukeIam commented 6 years ago

me again - the one with the bricked cam...

I soldered pins to the serial port and now have access to the uboot shell. Here is the boot-log: https://gist.github.com/lukeIam/42e318f61df871e6ae83b8a12877b213

Anyone has a idea how to fix that sfc erase error? I get this error on boot, with the sdupdate command in uboot and with saveenv.

I also tried to reflash the firmware manually with (idea: rewrite everything except uboot):

fatload mmc 0:1 0x32000000 demo.bin
sf update 0x32040000 0x40000 0xa90000

It writes without errors but I still get the same error messages 😢 @EliasKotlyar Can you may help me with the offset addresses?

Edit (11.04.2018): Finally solved it and documented the steps and offsets here: https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/master/hacks/unbrick.md

kk246 commented 6 years ago

I am impressed with the amount of progress you have made over the original samtap/xiaofang project for the dafang. Is it possible to use the binaries from your project on the dafang? I am particularly interested in trying the new rtsp server and local recording. (remote recording onto a nas would be even better)

EliasKotlyar commented 6 years ago

@lukelam: Grab the binarys from: https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/tree/master/firmware_original/5.5.1.177

and then flash them using the following table: https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/master/hacks/firmware-dump.md

It should start working then.

@kk246 The Dafang and the Xiaofang are not based on the same chipset, and you cannot exchange binarys. However it should be possible to compile some of the software to the other hardware.

@Chris-Nbg : That seems really strange. Maybe its a hardware failure. If you remove the sdcard - does your camera work normally?

Chris-Nbg commented 6 years ago

@EliasKotlyar Problem solved!

I never tried to use it with MiHome. What I noticed after flashing the custom firmware is that it stopped rotating the base during startups, even with the sdcard removed. It did rotate during that single startup before flashing. I didn't care much because rotating via command was still possible.

Today I moved the camera to a different location, hooked it to a different power supply and let it sit there for a while. I noticed that the base resumed rotating during startup and went through the MiHome installation procedure.

Now it's working great with the custom firmware, even connected to the first power supply.

pplucky commented 6 years ago

Hello everyone.

First of all, great work from @EliasKotlyar on getting this customer firmware working on this Xiaomi camera. Priceless work. Thanks a lot.

I have a couple of questions regarding the installation/usage of this customer firmware: 1 - The usage of this firmware totally detaches it from communicating with Xiaomi server? 2 - Is it possible to revert back to stock firmware after installing this customer firmware? Is there a process for that? 3 - If I turn on the camera without SD card or with SD card without run.sh, it runs on stock firmware. Does this make the camera appear in Mi Home app? 4 - In here, how long should setup button be pressed on step 5, or can it be released after doing step 6? 5 - Demo.bin file is to be deleted from SD card, once these steps are completed successfully? 6 - To install customer firmware in a stock firmware, both 'Installation of the custom firmware with the microSD bootloader' and 'Installation of the new Firmware' need to be done one after the other, right? 7 - Do yellow/blue lights in the camera mean anything in the customer firmware installation process?

Sorry for so many questions, but I couldn't find any answers for these and would be quite helpful before jumping in this customer firmware.

Thanks once again for helping out.

lukeIam commented 6 years ago

Grab the binarys from: https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/tree/master/firmware_original/5.5.1.177

and then flash them using the following table: https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/master/hacks/firmware-dump.md

It should start working then.

@EliasKotlyar I tried just that 😉 I don't know the offsets of the firmeware-image. So my idea was to skip 0x40000 in the image and in flash to skip the bootloader and then writing everything 1to1 (the flash command for that is in the last post) , but it didn't work...

Chris-Nbg commented 6 years ago

@pplucky

4 - I released the button about three seconds after plug in 5 - yes 6 - yes

jumperelu commented 6 years ago

Do you have any issues with the stock firmware on which if you unplug the camera from power and then plug it back again the SD card get formatted and all your recordings are lost? Thank you!

dmolner commented 6 years ago

Hello,

Some times my Dafang after calibrate horizontal not move and I need move manual. I think they is bloked in right possition

elminister83 commented 6 years ago

@blackgearit i've had the same problem, github for windows change the end of line character in all the config file, copy the file from zip download to sd make the magic.

blackgearit commented 6 years ago

@elminister83 will try.. I not believe that it works because I've copied the repo files to sd even from a Ubuntu machine, but I'll try..

blackgearit commented 6 years ago

@elminister83 thanks, man... now it works! @EliasKotlyar for me, the problem is solved, now i can see the hacks page... will test.

Lucas0511 commented 6 years ago

Sorry guys for this basic question, but I cant format SDHC cards with FAT...you are using old microSD cards then? Win10, Explorer does not show the FAT option, and DOS level on 16GB card it fails.

MasterPIC commented 6 years ago

@Lucas0511 Did you try FAT32?

Lucas0511 commented 6 years ago

@MasterPIC No, I thought it has to be FAT only.

blackgearit commented 6 years ago

Hi, I'm using mjpeg stream server, but seems that the camera doesn't switch automatically to night mode.. Even with command on web control panel ir led on, the stream is black at night

MasterPIC commented 6 years ago

@Lucas0511 you can use FAT32... @blackgearit you've to click also on IR Cut button to remove the IR Cut filter in front of the sensor...

MasterPIC commented 6 years ago

@EliasKotlyar Is a file editor stored on SD? I'm currently reading files by Putty but I'm still removing the card to modify them... Thanks and sorry for the dumb question.

jmtatsch commented 6 years ago

@MasterPIC use vi from busybox

Usage: busybox [function [arguments]...] or: busybox --list[-full] or: busybox --install [-s] [DIR] or: function [arguments]...

BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable.  Most people will create a
link to busybox for each function they wish to use and BusyBox
will act like whatever it was invoked as.

Currently defined functions: arping, ash, awk, blkid, cat, chmod, chown, cp, cut, date, dd, depmod, devmem, df, dhcprelay, diff, dirname, dmesg, dnsd, dnsdomainname, du, dumpleases, echo, egrep, env, false, fdflush, fdformat, fdisk, fgrep, find, flash_eraseall, flashcp, flock, free, freeramdisk, fsync, getopt, getty, grep, groups, gunzip, gzip, halt, head, hostid, hostname, hush, hwclock, id, ifconfig, init, insmod, kill, killall, killall5, klogd, linux32, linux64, linuxrc, ln, logger, login, logread, ls, lsmod, lsof, lsusb, makedevs, md5sum, mdev, mkdir, mkdosfs, mkfs.vfat, mknod, mkswap, mktemp, modinfo, modprobe, mount, mountpoint, mv, netstat, nslookup, pgrep, pidof, ping, pkill, pmap, poweroff, printf, ps, pstree, pwd, readahead, readlink, reboot, rev, rm, rmdir, rmmod, route, sed, seq, setarch, sh, sleep, sum, swapoff, swapon, switch_root, sync, sysctl, syslogd, tail, tar, telnetd, time, timeout, top, touch, tr, true, tty, ttysize, udhcpc, udhcpd, umount, usleep, vi, vlock, watch, watchdog, wc, wget, whois, xargs, zcat`

lolouk44 commented 6 years ago

@MasterPIC I know this is intended for @EliasKotlyar and I also would like to know the answer, but thought I'd share what I do which is less cumbersome than what you do: I keep a local copy of the SD and use an FTP site to send over my changes, this avoids having to take the card out and back in and potentially corrupting the SD

MasterPIC commented 6 years ago

@jmtatsch and @lolouk44 I'm obviously appreciating your help! Thanks again!

blackgearit commented 6 years ago

@MasterPIC thanks, so the "night mode" is not managed automatically with the custom firmware, right?

MasterPIC commented 6 years ago

@blackgearit no, it isn't. I'm going to add a single command to switch both IR cut and IR led. Maybe assigning it to "home" button in TinyCam can be useful to quickly set&reset night mode...

MasterPIC commented 6 years ago

action.cgi file:

#!/bin/sh

echo "Content-type: text/html"
echo ""

source func.cgi

setgpio(){
GPIOPIN=$1
echo $2 > /sys/class/gpio/gpio$GPIOPIN/value
}

night_vision_toggle(){
if [ $( cat /sys/class/gpio/gpio25/value ) -eq "1" ];
  then
    setgpio 25 0
    setgpio 26 1
    setgpio 49 1
  else
    setgpio 25 1
    setgpio 26 0
    setgpio 49 0
fi
}

echo "<br/>"
export LD_LIBRARY_PATH=/system/lib
export LD_LIBRARY_PATH=/thirdlib:$LD_LIBRARY_PATH
if [ -n "$F_cmd" ]; then
  case "$F_cmd" in
  showlog)
    echo "Contents of all log files:<br/>"
    echo "<pre>"
    tail /var/log/*
    echo "</pre>"
    ;;
  reboot)
    echo "Rebooting device...<br/>"
    /sbin/reboot
    ;;
  blue_led_on)
    setgpio 38 1
    setgpio 39 0
    ;;
  blue_led_off)
    setgpio 39 1
    ;;
  yellow_led_on)
    setgpio 38 0
    setgpio 39 1
    ;;
  yellow_led_off)
    setgpio 38 1
    ;;
  ir_led_on)
    setgpio 49 0
    ;;
  ir_led_off)
    setgpio 49 1
    ;;
  ir_cut_on)
    setgpio 25 1
    setgpio 26 0
    ;;
  ir_cut_off)
    setgpio 25 0
    setgpio 26 1
    ;;
  night_vision_toggle)
    night_vision_toggle
    ;;
  motor_left)
    /system/sdcard/bin/motor -d l -s 100
    ;;
  motor_right)
    /system/sdcard/bin/motor -d r -s 100
    ;;
  motor_up)
    /system/sdcard/bin/motor -d u -s 100
    ;;
  motor_down)
    /system/sdcard/bin/motor -d d -s 100
    ;;
  motor_vcalibrate)
     /system/sdcard/bin/motor -d v -s 100
  ;;
  motor_hcalibrate)
     /system/sdcard/bin/motor -d h -s 100
  ;;
  audio_test)
    /system/sdcard/bin/ossplay /usr/share/notify/CN/init_ok.wav
    ;;
  h264_start)
    /system/sdcard/bin/busybox nohup /system/sdcard/bin/v4l2rtspserver-master -S &>/dev/null &
    ;;
  mjpeg_start)
    /system/sdcard/bin/busybox nohup /system/sdcard/bin/v4l2rtspserver-master -fMJPG &>/dev/null &
  ;;
  xiaomi_start)
    busybox insmod /driver/sinfo.ko  2>&1
    busybox rmmod sample_motor  2>&1
    #/system/sdcard/bin/busybox insmod /driver/sinfo.ko
    #rmmod sample_motor
    #cd /
    /system/sdcard/bin/busybox nohup /system/bin/iCamera &  &>/dev/null &
  ;;
  rtsp_stop)
        killall v4l2rtspserver-master
    ;;
   settz)
    tz=$(printf '%b' "${F_tz//%/\\x}")
    if [ $(cat /etc/TZ) != "$tz" ]; then
    echo "Setting TZ to '$tz'...<br/>"
    echo "$tz" > /etc/TZ
    echo "Syncing time...<br/>"
    /system/sdcard/bin/busybox ntpd -q -n -p time.google.com 2>&1
    fi
    hst=$(printf '%b' "${F_hostname//%/\\x}")
    if [ $(cat /system/sdcard/config/hostname.conf) != "$hst" ]; then
    echo "Setting hostname to '$hst'...<br/>"
    echo "$hst" > /system/sdcard/config/hostname.conf
    hostname $hst
    fi
    if [ $? -eq 0 ]; then echo "<br/>Success<br/>"; else echo "<br/>Failed<br/>"; fi
    ;;
  *)
    echo "Unsupported command '$F_cmd'"
    ;;
  esac
  fi

echo "<hr/>"
echo "<button title='Return to status page' onClick=\"window.location.href='status.cgi'\">Back</button>"

status.cgi file:

#!/bin/sh

echo "Content-type: text/html"
echo ""

cat << EOF
<!DOCTYPE html>
<html>
<head>
<title>Fang Hacks</title>
<style type="text/css">
body { background-color: #B0E0E6; font-family: verdana, sans-serif; }
.err { color: red; }
hr { height: 1px; border: 0; border-top: 1px solid #aaa; }
button, input[type=submit] { background-color: #ddeaff; }
.tbl { border-collapse: collapse; border-spacing: 0;}
.tbl th { text-align: left; vertical-align: top; font-weight: bold; padding: 10px 5px; border-style: solid; border-width: 1px; overflow: hidden; word-break: normal; }
.tbl td { padding: 10px 5px; border-style: solid; border-width: 1px; overflow: hidden; word-break: normal; }
</style>
</head>
<body>

EOF
source header.cgi
cat << EOF
<br/>
<br/>
</div>
</p>
<hr/>
<button title='Reboot the device' type='button' onClick="window.location.href='action.cgi?cmd=reboot'">Reboot</button>
<button title='Manage scripts' type='button' onClick="window.location.href='scripts.cgi'">Manage scripts</button>
<button title='Network' type='button' onClick="window.location.href='network.cgi'">Network</button>
<button title='View /tmp/hacks.log' type='button' onClick="window.location.href='action.cgi?cmd=showlog'">View log</button>
<hr/>
<table class='tbl'>
<tr>
  <th>Date:</th>
  <td>
      <form style="margin: 0px" action="/cgi-bin/action.cgi?cmd=settz" method="post">
        $(date)
        <label style="margin-left: 1em" for="tz">TZ:</label>
        <input id="tz" name="tz" type="text" size="25" value="$(cat /etc/TZ)"/>
        <label  for="hostname">Hostname:</label>
        <input id="hostname" name="hostname" type="text" size="15" value="$(hostname)"/>
        <input type="submit" value="Set"/>
      </form>
  </td>
</tr>
<tr>
  <th>Version:</th>
  <td>$(cat /etc/os-release | cut -d'=' -f2)</td>
</tr>

<script>
function call(url){
        var xhr = new XMLHttpRequest();
        xhr.open('GET', url, true);
        xhr.send();
}
</script>

<tr>
  <th>Blue LED:</th>
  <td>
  <button title='' type='button' onClick="call('action.cgi?cmd=blue_led_on')">On</button>
  <button title='' type='button' onClick="call('action.cgi?cmd=blue_led_off')">Off</button>
  </td>
</tr>
<tr>
  <th>Yellow LED:</th>
  <td>
  <button title='' type='button' onClick="call('action.cgi?cmd=yellow_led_on')">On</button>
  <button title='' type='button' onClick="call('action.cgi?cmd=yellow_led_off')">Off</button>
  </td>
</tr>
<tr>
  <th>IR LED:</th>
  <td>
  <button title='' type='button' onClick="call('action.cgi?cmd=ir_led_on')">On</button>
  <button title='' type='button' onClick="call('action.cgi?cmd=ir_led_off')">Off</button>
  </td>
</tr>
<tr>
  <th>IR Cut:</th>
  <td>
  <button title='' type='button' onClick="call('action.cgi?cmd=ir_cut_on')">On</button>
  <button title='' type='button' onClick="call('action.cgi?cmd=ir_cut_off')">Off</button>
  </td>
</tr>
<tr>
  <th>Night Vision</th>
  <td>
  <button title='' tipe='button' onClick="call('action.cgi?cmd=night_vision_toggle')">Night vision toggle</button>
  </td>
</tr>
<tr>
  <th>Motor:</th>
  <td>
  &nbsp;&nbsp;&nbsp;&nbsp;<button title="" type="button" onclick="call('action.cgi?cmd=motor_up')">&nbsp;Up&nbsp;</button>
  <br>
  <button title="" type="button" onclick="call('action.cgi?cmd=motor_left')">Left</button>&nbsp;
  <button title="" type="button" onclick="call('action.cgi?cmd=motor_right')">Right</button>
  <br>
  &nbsp;&nbsp;&nbsp;<button title="" type="button" onclick="call('action.cgi?cmd=motor_down')">Down</button>

&nbsp;&nbsp;&nbsp;
    <button title='' type='button' onClick="call('action.cgi?cmd=motor_vcalibrate')">Calibrate Vertical</button>
  <button title='' type='button' onClick="call('action.cgi?cmd=motor_hcalibrate')">Calibrate Horizontal</button>
  </td>

</tr>

<tr>
  <th>Audio:</th>
  <td>
  <button title='' type='button' onClick="call('action.cgi?cmd=audio_test')">Test</button>
  </td>
</tr>

<tr>
  <th>Get Image</th>
  <td>
   <a href='currentpic.cgi?width=1920&height=1080' target='_blank'><button title='' type='button' onClick="">Normal</button></a></br>
   <a href='currentpic.cgi?width=1920&height=1080&nightvision=1' target='_blank'><button title='' type='button' onClick="">Nightvision</button></a></br>
   <a href='currentpic.cgi?width=1920&height=1080&flip=1' target='_blank'><button title='' type='button' onClick="">Flip</button></a></br>

  </td>
</tr>

<tr>
  <th>Start H264 RTSP</th>
  <td>
  <button title='' type='button' onClick="call('action.cgi?cmd=h264_start')">Start</button>
  <button title='' type='button' onClick="call('action.cgi?cmd=rtsp_stop')">Stop</button>
  <br>
EOF

PATH="/bin:/sbin:/usr/bin:/media/mmcblk0p2/data/bin:/media/mmcblk0p2/data/sbin:/media/mmcblk0p2/data/usr/bin"

IP=$(ifconfig wlan0 |grep "inet addr" |awk '{print $2}' |awk -F: '{print $2}')
echo "Path to feed : <a href='rtsp://$(echo $IP):8554/unicast'>rtsp://$(echo $IP):8554/unicast</a></br>"
echo "HLS : <a href='http://$(echo $IP):8554/unicast.m3u8'>http://$(echo $IP):8554/unicast.m3u8</a></br>"
echo "MPEG-DASH : <a href='http://$(echo $IP):8554/unicast.mpd'>http://$(echo $IP):8554/unicast.mpd</a></br>"
cat << EOF

  </td>
</tr>

<tr>
  <th>Start MJPEG RTSP</th>
  <td>
  <button title='' type='button' onClick="call('action.cgi?cmd=mjpeg_start')">Start</button>
  <button title='' type='button' onClick="call('action.cgi?cmd=rtsp_stop')">Stop</button>
EOF

PATH="/bin:/sbin:/usr/bin:/media/mmcblk0p2/data/bin:/media/mmcblk0p2/data/sbin:/media/mmcblk0p2/data/usr/bin"

IP=$(ifconfig wlan0 |grep "inet addr" |awk '{print $2}' |awk -F: '{print $2}')
echo "Path to feed : <a href='rtsp://$(echo $IP):8554/unicast'>rtsp://$(echo $IP):8554/unicast</a></br>"
cat << EOF

  </td>
</tr>

<tr>
  <th>Start original Xiaomi Software:</th>
  <td>
  <button title='' type='button' onClick="call('action.cgi?cmd=xiaomi_start')">Start</button>
  </td>
</tr>

<tr>
  <th>Process list:</th>
  <td><pre>$(ps)</td>
</tr>
<tr>
  <th>Mounts:</th>
  <td><pre>$(mount)</td>
</tr>

</table>
</div>
</body>
</html>
EOF

Then you can add the following line to the xml file passed to TinyCam: <request name="PtzMoveHome">/cgi-bin/action.cgi?cmd=night_vision_toggle</request>

I hope it helps

blackgearit commented 6 years ago

@MasterPIC thanks, can i toggle the IR or control other features via curl from another machine in the network? curl -X GET http://CAMIP/cgi-bin/action.cgi?cmd=night_vision_toggle

EDIT: yeah, confirm that i can send curl GET commands to action.cgi, so maybe i can control the camera pan tilt and night mode via Home Assistant on Rpi...

EDIT2: but with IR_LED and IRCUT to on, the image is violet ^^ image

MasterPIC commented 6 years ago

@blackgearit In IR mode the video should be converted to grayscale; anyway without mono conversion you get pretty the "same" information...

MasterPIC commented 6 years ago

@EliasKotlyar Could gpio81 be related to the light sensor useful for IR autoswitch?

digitalsalat commented 6 years ago

After some time with try and error I got the cam to work on my Synology surveillance station. For me it did the trick to edit the run.sh and add before the echo in the last line:

/system/sdcard/bin/v4l2rtspserver-master

to autorun the rtsp server.

digitalsalat commented 6 years ago

Now I'd like to get the camera movement controls to work in Surveillance station - is anyone in progress there?

hubmon commented 6 years ago

From log file. ==> /var/log/boa.log <== sh: bad number cat: can't open '/media/mmcblk0p2/data/etc/udhcpd.conf': No such file or directory cat: can't open '/media/mmcblk0p2/data/etc/hostapd.conf': No such file or directory cat: can't open '/media/mmcblk0p2/data/etc/hostapd.conf': No such file or directory ./network.cgi: line 372: iwconfig: not found Is this expected behavior?

marclais commented 6 years ago

Now I'd like to get the camera movement controls to work in Surveillance station - is anyone in progress there?

I'd also like to see this happen. Any chance of support for this?

msj33 commented 6 years ago

Just got the Dafang here and flashed firmware without any major issues.....

Can access both webpage and capture pictures and streams...........so far so good.....but its all manually controlled :-(

I would really like to some more automated capture here..........so thinking about integrating it with Home Assistant.

Goal: 1: Detect Motion 2: Capture video/picture to Cloud. 3: Notify

Any wiki regarding triggering the different functionalities from command line? (Including continous poll for motion detection?)

/Morten

lolouk44 commented 6 years ago

@msj33 You'll probably need a third party app to analyse the stream. I personally use motion. See this post that might help: https://community.home-assistant.io/t/hacking-the-xiaomifang-wifi-camera/18579/42

msj33 commented 6 years ago

@lolouk44 Cool, thx - Actually just got night vision toggles up and running....so on my way here :-)

What is needed to get ffmpeg up and running on the cam? Just some copy of files or does it need specific compilation for the hardware?

lolouk44 commented 6 years ago

It's not recommended to run ffmpeg or motion directly on the can as resources are sparse. You should really set up motion on a separate server and pull the RTSP feed from the camera

kszere commented 6 years ago

On Xiaofang works with nginx (RSTP) and FFMPEG and Motion. For Dafang not available package.

shinebar1001 commented 6 years ago

I thought about ffmpeg for fetching a single Image from the stream to enable a snapshot-functionality. The Problem is, that we have to update the build-chain and build a Version of ffmpeg for the dafang. But that will take some time.

modstan commented 6 years ago

I am trying to play stream rtsp://IP:8554/unicast with vlc. Vlc shows video stream, but there is no audio stream. Can somebody help me to get audio stream?