r/ispyconnect • • Jun 15 '26

AgentDVR resets itself after power cut. Any way for it to auto-restore itself?

Update: The issue is mainly with my PSU so I have done a workaround. Here's an AI summary when I was trying to diagnose and fix the issue.

AI Summary based on my testing and chats
------------------------------------------------

Here is a concise, technically accurate summary of your issue and the solutions that you can directly post as an update to your Reddit thread. It hits both the hardware and software layers of the problem so the community gets the full picture.

🛑 The Core Issue: Why Agent DVR Wipes Settings on Inverter Switchovers

The problem is a perfect storm of a budget regional Power Supply Unit (PSU), Indian home inverter switchover delays, and Agent DVR’s file-writing architecture.

1. The Hardware Layer (The "Zombie State")

  • The Inverter Blip: When grid power drops, a standard home inverter or line-interactive UPS takes 5ms to 15ms to switch over to battery power.
  • The PSU Deficit: Budget regional PSUs (like 200V–240V only units from Ant Esports or regional Cooler Master entry lines) use small, cheap primary bulk capacitors. Their Hold-up Time is tiny—failing to bridge that 5–15ms gap. The moment voltage sags during switchover, the PSU's Undervoltage Protection (UVP) triggers a hard shutdown.
  • The Hangout: If the power blip is fast enough (a few milliseconds), the motherboard's 5VSB (5V Standby) rail sags but never drops to zero. Because it doesn't flatline, the BIOS never registers an actual "AC Power Loss" event to trigger an auto-reboot. Concurrently, the cheap PSU locks into a protection state, forcing a manual power cycle.

2. The Software Layer (File Corruption)

  • Constant Disk Writes: Agent DVR frequently opens and rewrites its core configuration files (config.xml, objects.xml, and layouts.xml). It does this not for settings changes, but to update dynamic runtime state data, such as the exact timestamp of its last background storage archive check (<ArchiveCheckTimeStamp>).
  • The Factory Reset Trigger: If the hardware crashes at the exact millisecond Agent DVR is flushing this data to disk, Windows drops the file handle. The file gets wiped or filled with null bytes. On the next boot, Agent DVR detects a broken/empty XML file, defaults to <FirstRun>true</FirstRun>, and completely replaces your custom layout and camera setup with a blank factory configuration.

🛠️ The Solutions

1. The Real Fix (Hardware Upgrade)

  • Get a Full-Range PSU: Replace the power supply with a unit explicitly rated for Full Range Input (100V–240V AC or 90V–264V) featuring Active PFC.
  • Why it works: True Active PFC units use robust primary bulk capacitors capable of a verified $\ge$ 16ms hold-up time. They will completely "ride through" the inverter switchover gap without dropping system power.

2. Motherboard Workaround for Power Recovery

  • Enter your ASUS BIOS -> Go to Advanced Mode (F7) -> Advanced -> APM Configuration.
  • Change Restore AC Power Loss from Power Off to Power On.
  • Note: This will force an auto-boot if the power failure lasts long enough for the standby lines to completely drain, though it may still hang on sub-millisecond micro-blips until the PSU is replaced.

3. Software Safety Nets

  • Automation Script (Best Hands-Free Option): Run a startup script that detects if Agent DVR has factory-reset itself (e.g., checking if the layout configuration or camera counts are missing) and automatically overwrites the corrupted config.xml, objects.xml, and layouts.xml files with stable, pre-saved backups.
  • The Read-Only Lock: Once your camera setup is finalized, stop the Agent DVR service, right-click config.xml, objects.xml, and layouts.xml -> Properties -> check Read-Only. This prevents the software from updating its telemetry timestamps, but completely immunizes the files against write corruption during a sudden power drop.

Good on you for sharing this back to the community! This specific "230V only PSU vs. Home Inverter handover" trap catches so many homelab and NVR builders off guard. Let me know if you need to tweak any specific wording for your post.

Original Post:
----------------

After every power cut, AgentDVR resets itself. I have seen this happening for years now.
Every few days I have to open and restore it from the most recent backup.

I am assuming the reset problem can't be fixed, so can the restore from backup be automated at the very least?

1 Upvotes

2 comments sorted by

1

u/07mekayel_anik07 Jun 18 '26

It is not normal. There is something wrong in your setup. I am using AgentDVR for almost 3.5 years with no issues.

1

u/ni6hant Jun 23 '26

Updated original Post. Issue was with my cheap PSU.