roleoroleo / sonoff-hack

Custom firmware for Sonoff GK-200MP2B camera
GNU General Public License v3.0
200 stars 45 forks source link

Test FTP connection #90

Closed omerinero closed 1 year ago

omerinero commented 2 years ago

Hello there,

I am using a different port than usual to establish my FTP connection. Is there any way to check that the connection is working correctly through the web?

gewinh commented 2 years ago

Don't think their is a way to test from web. but see "68" for commandline test. Also think that ftppush.sh hard codes port 21 echo -e "USER ${FTP_USERNAME}\r\nPASS ${FTP_PASSWORD}\r\nmkd ${FTP_DIR}\r\nquit\r\n" | nc -w 5 ${FTP_HOST} 21 | grep "${FTP_DIR}" FTP_DIR="${FTP_DIR}/" You could edit this file and try a different port

omerinero commented 2 years ago

Don't think their is a way to test from web. but see "68" for commandline test. Also think that ftppush.sh hard codes port 21 echo -e "USERFTPUSERNAME\r\nPASS{FTP_PASSWORD}\r\nmkdFTPDIR\r\nquit\r\n"|nc−w5{FTP_HOST} 21 | grep "${FTP_DIR}" FTP_DIR="${FTP_DIR}/" You could edit this file and try a different port

It worked over ssh and ftpput command line but still not seeing any new record file after motion event detected in my ftp server

roleoroleo commented 2 years ago

Try to run the command manually and check the output.

omerinero commented 2 years ago

Try to run the command manually and check the output.

yep, it actually worked by running

[root@GK]# echo -e "USER username\r\nPASS password\r\nmkd folder_name\r\nquit\r\n" | nc -w 5 local_ip_host 21 
220 FTP Server
331 Please specify the password.
230 Login successful.
257 "/folder_name" created
221 Goodbye.

then it is just a matter of understanding why it is not creating any records

roleoroleo commented 2 years ago

I mean try to run manually the ftppush.sh process.

omerinero commented 2 years ago

I mean try to run manually the ftppush.sh process.

This is the output I get when I run the ftppush.sh manually. I created with touch command a mp4 file with the same name pattern to have something that triggers the upload Looks like the connection gets refused (The FTP server is running inside a docker container)

2022-06-29 [15-37-11] [INFO] checkFiles
nc: can't connect to remote host (192.168.0.170): Connection refused
nc: can't connect to remote host (192.168.0.170): Connection refused
nc: can't connect to remote host (192.168.0.170): Connection refused
ftpput: can't connect to remote host (192.168.0.170): Connection refused
2022-06-29 [15-37-13] [ERROR] uploadToFtp: ftpput FAILED.
2022-06-29 [15-37-13] [ERROR] checkFiles: uploadToFtp FAILED - [/mnt/mmc/alarm_record/1970/01/01/ARC197100101020045.mp4]. Retrying in 45 s.
omerinero commented 2 years ago

I'm gonna reply myself.: After changing some network config in my docker-compose file I made it to run successfuly and I could see the mock file on FTP side.

FTP transfer working so now I can only wonder why it is not recording anything

2022-06-29 [15-50-10] [INFO] checkFiles
257 "/01" created
257 "/01//01" created
2022-06-29 [15-50-13] [INFO] checkFiles: uploadToFtp SUCCEEDED - [/mnt/mmc/alarm_record/1970/01/01/ARC197100101020045.mp4].
/mnt/mmc/sonoff-hack/script/ftppush.sh: line 293: rmdir: not found
/mnt/mmc/sonoff-hack/script/ftppush.sh: line 293: rmdir: not found
/mnt/mmc/sonoff-hack/script/ftppush.sh: line 293: rmdir: not found
roleoroleo commented 2 years ago

Try to use the original app to check the configuration of the cam.

omerinero commented 2 years ago

Try to use the original app to check the configuration of the cam.

Indeed, looks like it needs some extra steps with the original app to finish the setup.

Local record is enabled and motion sensitivy is high. Its creating a folder with today's date and thats it (/mnt/mmc/alarm_record/20220630) no record file inside the folder or if it creates one its 0 byte

omerinero commented 1 year ago

it's working now. I had to reformat the SD and start over again because something wasn't good. This time I started configuring the cam with the official app and afterwards I inserted the SD with the sonoff-hack. Thanks for your help :)