This far exceeds any level of experience that I possess, since I have zero patience for programming and/or code. But a couple questions.
1. So how is the Pi connected to the Viofo A139? Via Wifi (connecting to camera continuously) or Station Mode (Camera connects to Pi)?
2. What are you using for an internet source to transfer videos from Pi --> NAS? Or is Pi set to connect to home router upon entering garage and a command is setup to automatically transfer videos?
3. Viofo has the Wifi turn off automatically upon entering parking mode. Wouldn't the solution here be to enable Wifi / Station Mode during Parking Mode. And then a command be issued by the Viofo A139 to Turn off Wifi if connection not Present for "X Minutes". And a 2nd Command to Turn off Camera via a timer Option with shorter intervals during parking mode in the actual Viofo App.
Seems the solution would be to permit Wifi / Station Mode
So basically, doesn't have to be a Pi, you can legit have a small useless Android phone running, and use Tasker or any automation app on anything lol!
Even on windows or even linux NAS' with terminal.
1. This is the issue. My method is ready, but its currently not live. Because Viofo never has Auto WiFi ON or station mode in parking mode (like Thinkware & Blackvue), I cannot connect automatically. This is one thing I am hoping they fix down the line. So as for now, i manually have to press the wifi button before I leave the car after parking and then my Pi pings that IP every 3 minutes. So it'll ping it, and it'll say "Oh hey, the a139 is reachable, it must be back, let's proceed".
2. I just transfer it all locally (its only event/locked videos, so ends up around 200MB max per day, sometimes even 100MB). So giving an example for my thinkware, whenever my 24/7 pi server, is able to ping the camera (be it thinkware/viofo/blackvue), it will know hey it's online. Then the script continues by just getting the list of files in event folder, checks each file and downloads the file that has not been downloaded. That's all it is. All LAN transfer, no WAN.
3. Exactly what it should be. See currently, Wi-Fi turns OFF after entering parking mode (bummer). But if we manually turn it on, if its inactive for 5 minutes, wifi auto turns off. Perfect. I suggested that, maybe just like Thinkware/Blackvue, upon parking mode, just DO NOT turn off wifi. Wait for 5 minutes, if no connection, turn it off, if something is connected, then just leave it until it disconnects then 5 mins after wifi off. Simple.
This is damn easy to implement in the firmware it can literally be like (in pseudocode);
"If parking mode = true, setWifi=True. Wait 5 minutes, if connection established, wait for disconnection, else turn wifi off".
Roughly 5-10 lines of code only. This way, battery is saved and all things are established! Yeah I am just hoping & waiting for Viofo to enable station mode in parking mode OR at least have Wi-Fi auto turn on in parking mode, so I can start my script. I made my script, its all ready to go LOL, just needs wifi. I tested it with manually turning wifi on, but now to make it automatic, need Viofo XD. Same idea / same script I use for my blackvue. Works flawlessly.
Also for the turning off camera part, that's exactly what the solution is. If the CMD worked properly, in a perfect world, I would automatically connect to camera (hoping Viofo makes auto wifi on someday), then I download my stuff. Then once down, Pi can just send a cmd to turn camera off (boom! power save!). Then next time car ignition turns on, camera is back on (this happens, but powering off remotely is the problem). And this way, if I park for example in a mall, it will never shutdown (wifi will shutdown after 5 minutes, but camera is still on) because my pi isn't there to send a Power Off CMD
Idea is perfect.