alienatedsec / yi-hack-v5

Even newer Custom Firmware for Xiaomi Cameras based on Hi3518ev200 Chipset. It includes free RTSP, ONVIF and other improvements based on the work by roleoroleo
GNU General Public License v3.0
798 stars 88 forks source link

Recording without cloud still with challenges - 0.4.0 #277

Closed Rushmed closed 1 year ago

Rushmed commented 1 year ago

Hi Sir.

I succesfully updated Baseline to 0.3.8 and YiHackV5 to 0.3.9 but recording only works with enabled cloud connection. image

Any idea?

alienatedsec commented 1 year ago

Have you enabled NTPD and restarted the cam afterwards?

Occasionally, I found it does not record after restarting if the time is not synced before the mp4record execution. We could move ntpd further up the chain. https://github.com/alienatedsec/yi-hack-v5/blob/08385ac5c234d8e68063bb51364d0d878274a059/src/static/static/home/yi-hack-v5/script/system.sh#L216-L219

You can try yourself by moving the above code in the system.sh to line L152 https://github.com/alienatedsec/yi-hack-v5/blob/08385ac5c234d8e68063bb51364d0d878274a059/src/static/static/home/yi-hack-v5/script/system.sh#L152

Rushmed commented 1 year ago

Yes NTPD is enabled and many restarts are done. Edited system.sh as you recomented but still no recording without cloud. With cloud enabled recording works. Of course recording without cloud is enabled. Also checked on page=snapshot that the time is correctly shown.

alienatedsec commented 1 year ago

Another thing you could try is to free up more space on the SD card. Set it to 30% and restart again.

Rushmed commented 1 year ago

Tried without success. Its a complete fresh SD installed. No files in record folder.

alienatedsec commented 1 year ago

I'll check on mine to confirm but it may not be today

Rushmed commented 1 year ago

Ur welcome Sir!

Rushmed commented 1 year ago

@alienatedsec Any result?

alienatedsec commented 1 year ago

I found a problem with the NTPD. It stops updating the time and currently my local time stopped on a day in July. My camera stopped recording without cloud on the 1st August. Will try to fix as soon as I can.

Porkenstien commented 1 year ago

Howdy, just thinking out loud here. We have a crontab in the Config Page, could we set a restart for NTPD to test??

**edit: should have been Config Page

alienatedsec commented 1 year ago

The ntpd was a false flag - it turns out that ./cloud & is not executing or crashing shortly after for some reason.

I got the cloudAPI_fake amended slightly, which seems to respond well - ./cloud & works ok when executed manually from the console, but the system.sh needs more work to check on the ./cloud & execution steps.

alienatedsec commented 1 year ago

Before anything, update to the 0.4.0b - it's necessary at this point.

Then, replace the files within /tmp/sd/yi-hack-v5 with those yi-hack-v5.zip and restart the camera. Let me know and I will follow up with another pre-release.

I also committed those changes here https://github.com/alienatedsec/yi-hack-v5/commit/35b1a8c4a720613736b1d767666d532ad28f03d7

Porkenstien commented 1 year ago

Ok, did update and uploaded the files in previous post by @alienatedsec. No change in recording, did the dance of turning Cloud features On/Off, recordings still only work with Cloud turned on.

FYI, after uploading the updates I noticed that the date stamp on most of the files are 12-31-1979 ???

alienatedsec commented 1 year ago

@Porkenstien it has been working for me out of the box.

Please can you post any screenshots? The config and cloudAPI_fake files?

Porkenstien commented 1 year ago

Ok, Screenshots showing date stamp irregularities, latest files uploaded and Events Page which shows nothing even after dancing and clapping in front of camera: Screenshot_20230809_082952 Screenshot_20230809_083204 Screenshot_20230809_083259

Porkenstien commented 1 year ago

One more screenshot of my Config Page: Screenshot_20230809_083853

alienatedsec commented 1 year ago

@Porkenstien you copied files to a wrong location

Please make sure you replace files in /tmp/sd

Rushmed commented 1 year ago

Before anything, update to the 0.4.0b - it's necessary at this point.

Then, replace the files within /tmp/sd/yi-hack-v5 with those yi-hack-v5.zip and restart the camera. Let me know and I will follow up with another pre-release.

I also committed those changes here 35b1a8c

Tested with 0.4.0c and the files you posted. Its working for me now!

Porkenstien commented 1 year ago

My apologies @alienatedsec ! It is working after putting the files in the proper directories. (A reminder that I shouldn't mess with tech' until after the my first pot of coffee!) Thanks for your hard work!

Rushmed commented 1 year ago

Reinstalled your new release 0.4.0c over WebUi and still everything fine. Than you Sir!

alienatedsec commented 1 year ago

While it is working better than before, I need to tune the cloudAPI_fake and update the wd_rtsp.sh to monitor the ./cloud & process as it crashed overnight and there is nothing to make it recover.

As of now - it is work in progress

alienatedsec commented 1 year ago

Following 0.4.0d the ./cloud & monitoring is working correctly and I can see some anomalies already. The time and date keep changing at the restart or the NTPD reliability is not there. It could be the reason why ./cloud is crashing. I will keep monitoring.

2023-08-10 07:59:09 - Starting RTSP watchdog...
2023-08-10 07:59:11 - No running processes, restarting ./cloud & ...
2023-08-10 08:43:23 - No running processes, restarting ./cloud & ...
2023-08-10 08:48:48 - No running processes, restarting ./cloud & ...
2023-08-10 08:50:25 - No running processes, restarting ./cloud & ...
2023-08-08 22:59:16 - Starting RTSP watchdog...
2023-08-08 23:00:43 - No running processes, restarting ./cloud & ...
Porkenstien commented 1 year ago

Are we seeing a buggy clock on the camera? Maybe a heat or cpu load giving the onboard clock issues. Has anyone other than myself seen the date stamp on files or directories show year 1969?

alienatedsec commented 1 year ago

Has anyone other than myself seen the date stamp on files or directories show year 1969?

@Porkenstien I don't think that is an issue - my /tmp/sd/yi-hack-v5 folder is dated 1980. It's likely because of the build process and steps to change ownership to avoid permission issues.

image

alienatedsec commented 1 year ago

Whenever I restart the camera (the line Starting RTSP watchdog...), the time is going back to 8th August. Still investigating but the ./cloud & process is not crashing as of now.

2023-08-10 07:59:11 - No running processes, restarting ./cloud & ...
2023-08-10 08:43:23 - No running processes, restarting ./cloud & ...
2023-08-10 08:48:48 - No running processes, restarting ./cloud & ...
2023-08-10 08:50:25 - No running processes, restarting ./cloud & ...
2023-08-08 22:59:16 - Starting RTSP watchdog...
2023-08-08 23:00:43 - No running processes, restarting ./cloud & ...
2023-08-08 22:59:14 - Starting RTSP watchdog...
g1za commented 1 year ago

Just updated to regular v. 0.4.0. I can tell local recording is working ok, even with cloud disabled. BUT the time is wrong; it is 2 hours behind (Timezone correctly set in the Config panel). Date is correct.

-- yi dome camera

Edit: I see the same (wrong) time is also displayed on the watermark of the snapshot. Edit2: and on the status page at local time entry. Actually here it is stated "UTC", so based on this the time could be considered correct, unless it was intended to be shown in local time.

Porkenstien commented 1 year ago

Whenever I restart the camera (the line Starting RTSP watchdog...), the time is going back to 8th August. Still investigating but the ./cloud & process is not crashing as of now.

2023-08-10 07:59:11 - No running processes, restarting ./cloud & ...
2023-08-10 08:43:23 - No running processes, restarting ./cloud & ...
2023-08-10 08:48:48 - No running processes, restarting ./cloud & ...
2023-08-10 08:50:25 - No running processes, restarting ./cloud & ...
2023-08-08 22:59:16 - Starting RTSP watchdog...
2023-08-08 23:00:43 - No running processes, restarting ./cloud & ...
2023-08-08 22:59:14 - Starting RTSP watchdog...

Would 08/08/2023 be the last reboot of the camera? Is the process or caching for the process retaining a date stamp? Could calling to kill ./cloud or RTSP process(es) before restarting clear any previous time stamps?

g1za commented 1 year ago

Just updated to regular v. 0.4.0. I can tell local recording is working ok, even with cloud disabled. BUT the time is wrong; it is 2 hours behind (Timezone correctly set in the Config panel). Date is correct.

-- yi dome camera

Edit: I see the same (wrong) time is also displayed on the watermark of the snapshot. Edit2: and on the status page at local time entry. Actually here it is stated "UTC", so based on this the time could be considered correct, unless it was intended to be shown in local time.

What I can tell after a few days of testing is that the camera is recording a lot, even without motion detection ("motion recording only" enabled via the app first and then re-enabled using roleoroleo's integration).

github-actions[bot] commented 1 year ago

This issue has been stale for 30 days - it will be closed within the next 7 days if not updated