Turning camera Off (simulating power button) by Wi-Fi API?

ChampaRando

Member
Joined
Jun 12, 2021
Messages
74
Reaction score
23
Location
Right behind you
Country
Australia
Hi. As you know A139 uses a newer form of Novatek Chip which has an API. (i.e. https://drive.google.com/file/d/1INKvAJI2LoqXeKIFTDOp7_3RwY0j_fdU/view).
Does anyone know how to turn off the A139 via Wi-Fi automatically (without pressing the power button)? It's useful to automatically turn OFF the camera in garage for example, where parking mode is not needed.

I saw this CMD in the Novatek Web API:
1627125527722.png

I am not exactly sure what this does. I dont want to do this and permanently make my device turn off after 1/2/3 minutes lol. Does anyone know what this is doing?
 

kamkar

Well-Known Member
Joined
Oct 11, 2013
Messages
30,205
Reaction score
16,999
Country
Denmark
Dash Cam
10 years, many dashcams
It would be nice to have geo-fencing in dashcams, so we could specify places where it should or should not be active in parking guard for instance.

Personally i dont mind much if i had to manual turn off parking guard, say in a garage if i had one, but i would also embrace automatic operation in this case ( a guy being very selective in which modern technologies he adopt / often being blamed for being a tin hat wearer, which is far from true )

My geek-level are fairly low on these matters so not able to offer up some advise in this regard.
 
OP
C

ChampaRando

Member
Joined
Jun 12, 2021
Messages
74
Reaction score
23
Location
Right behind you
Country
Australia
There is a geo-fencing option in the newest beta, but for me that's not enough because I sometimes park right outside my driveway if my wife is home, so I need parking mode OUTSIDE. I have a permanent raspberry Pi running linux. I have a script setup in that pi to capture my blackvue and my a139 footage automatically and backup to a large NAS in my house. So once I am finished with that, I want to send a CMD to turn the camera OFF else if its outside the garage, ill leave it running. I have methods to detect if car is inside or not, that was easy because the camera wifi signal does not reach raspberry pi if its outside garage, so a simple logic in C++ solved my issue of raspberry pi detecting if car is inside or outside garage. Just need to solve auto power off via wifi/remote method.

I am sure there would exist one but I do not want to run any random command which will ruin the camera haha.

I have noticed, if we manually press the power button and turn it off, it shuts down (great). And if the car is back up (ACC is ON again), the camera re-powers up. This behaviour is perfect! Only thing is I cannot make my raspberry pi go in and press a button :p. SO I need some automatic way to do so.
 
Last edited:

kamkar

Well-Known Member
Joined
Oct 11, 2013
Messages
30,205
Reaction score
16,999
Country
Denmark
Dash Cam
10 years, many dashcams
I would like to backup new footage over wifi, but only if it could be done fast, i dont want to get home and then wait several hours before i can get to my footage to pick and share the crazy stuff i recorded today.
I also think given the option i would prefer to just backup the event folder and not everything on the card, even if i do acknowledge that the option to do that would be good for a lot of other people, not least in the commercial sector.

And even if this entail that i would have to put a wifi extender in the other end of my apartment, as my routers are in one side of the apartment block / apartment and my car is parked in the back yard 20 M or so from my 2 floor apartment, so are barely able to detect my wifi down there. ( on my phone outside the car )
 
OP
C

ChampaRando

Member
Joined
Jun 12, 2021
Messages
74
Reaction score
23
Location
Right behind you
Country
Australia
Haha yeah I have two issues I need to solve.

For A139:

1. Wi-Fi station mode should connect to LAN automatically, but it turns off in parking mode. We then have to enable wifi AP mode again by pressing button in park mode. I need to automate this.

2. I need to find a way to turn it off after I finish backing up videos.

I have actually setup a simple script using a C++ code I wrote. A139 has a web api. There is a command that lists all file paths. To send commands just send a web request (like ?/CMD=xxxx). Then I use that list, download files only in the folder "RO" because they are locked/event files. The speed is really fast over 5GHz. 90Mbit+ (roughly 10MBps) that's heaps good. Event files are only small and if I do it every night, it's around 130MB data per night, takes roughly 2 3 minutes!!!

But again, I tested this script with car on, to make it. Now to deploy and make it useful, need to somehow let a139 turn on wifi automatically so my pc can download and then shut it off.

In my garage, I have a router.
The a139 can connect to it easily as a client in station mode but issue is, in parking mode station mode turns off. Bummer.
Then another option is, normal wifi AP mode. I can make my raspberry pi connect to camera's wifi AP, but again, this is turned off and manually needs to be turned on by pressing wifi button. Bummer. My pi cannot press buttons.

Has anyone solved any of these issues?
 

kamkar

Well-Known Member
Joined
Oct 11, 2013
Messages
30,205
Reaction score
16,999
Country
Denmark
Dash Cam
10 years, many dashcams
The station mode and the model itself ( a139 ) are pretty new, so pretty sure no one have looked very much at this.

I am myself a wifi hater, the wifi on my internet router is rarely turned on, but i do have a closed loop where i do have the wifi on most of the time.
On my phone which i equally dislike and only carry so my old sick mother can get in touch with me, wifi / BT / GPS are off when i dont need those. this is where many go tinfoil hat :)
But for me it is simple i see and interact with very few people IRL, so i can tell and get any gossip when i see those on a regular basis, i was without phone for a good many years after the turn of the century and it was quite nice.
If i get or have to make over 3 phone calls a week, it is a bad week for me on the phone front.
 

SawMaster

Well-Known Member
Joined
Apr 10, 2015
Messages
9,081
Reaction score
7,906
Location
SC
Country
United States
Dash Cam
Numerous and ever-changing
You can let the low-voltage setting in the HWK turn things off. There's also the parking mode timer setting. Novatek seems to be more easily 'modded' than other FW's and you might find more info on the 4PDA Russian forum. Hard to 'brick' a Novatek but nothing is impossible; usually a FW reload will get things going again.

Phil
 
OP
C

ChampaRando

Member
Joined
Jun 12, 2021
Messages
74
Reaction score
23
Location
Right behind you
Country
Australia
Oh okay. I do have the HWK, set at 12 volts to prevent total discharge. I just wanted something to turn off parking mode at home to minimise battery drain, because I do not really need it in the garage.

Yeah parking mode timer is useful, but then it will apply to every location and it wont distinguish between my garage and elsewhere :p.

Do you have any idea of what that auto power off CMD does?
 
OP
C

ChampaRando

Member
Joined
Jun 12, 2021
Messages
74
Reaction score
23
Location
Right behind you
Country
Australia
Okay so I went and tried it myself. It is not really what I want it to do. Here what the command 3007 (the posted attachment above) does;

I basically set the parameter 1 (so POWER_1MIN).
1. In parking mode: The camera turns OFF after 1 minute. So it is useless. From the time the camera enters parking mode, after 1 minute, the whole camera shuts off. This is probably what Parking Timer does. This means even if I parked it outside, camera shuts off after 1 minute. So not what I needed exactly.

2. In normal mode/with ACC ON: Even worse. Every 1-1.5 minutes, the camera rebooted. I believe the NOVATEK firmware forces a shutdown just like in parking mode, but then viofo might have a setting which causes the camera to boot again. Then novatek causes another shutdown, viofo another boot. So essentially every 1/1.5 minutes camera rebooted and video corrupted.

So to fix it, had to re-flash the firmware. So that command is useless :(

We need another way to turn off remotely (just like the power physical switch does). Obviously one way is connecting a wire to the button's circuit inside the camera, which can simulate the actions, but this involves opening the camera (void of warranty) and on top, I am not an electrical technician/engineer :( So a software based would be easier.
 
Last edited:

Nath

Well-Known Member
Joined
Aug 8, 2017
Messages
811
Reaction score
472
Country
Germany
Dash Cam
Dual A139-3CH, Dual Viofo A129Pro-2CH
Since Novatek's SDK is pretty much something not in reach for mere humans, as I said in A139 firmware thread, you can get access and modify multiple things via internal UARTs which are not protected (one is for bootloader with commands, the second is for linux terminal).

Btw, you shouldn't be worried about voiding your warranty, because there is no seal which you can break and the disassembly is quite straight forward.

And since the jack connectors are not "closed" you can run the wires even like this. :LOL:
20210728_104414.jpg
 
Last edited:
OP
C

ChampaRando

Member
Joined
Jun 12, 2021
Messages
74
Reaction score
23
Location
Right behind you
Country
Australia
Haha damn looks cool.
I just haven't done any UART/low-level binary/assembly language code or any electrical stuff really so I am hopefully not gonna mess with that just yet :p (id end up bricking or burning something if I do it with 0 knowledge XD)
I've only really done high level coding so that's my level XD.
 

joe384

Well-Known Member
Joined
Aug 29, 2019
Messages
518
Reaction score
262
Location
Essex
Country
United Kingdom
Dash Cam
2 x DR590W-2CH, Cellink B
Since Novatek's SDK is pretty much something not in reach for mere humans, as I said in A139 firmware thread, you can get access and modify multiple things via internal UARTs which are not protected (one is for bootloader with commands, the second is for linux terminal).

The linux terminal sounds interesting!
 
OP
C

ChampaRando

Member
Joined
Jun 12, 2021
Messages
74
Reaction score
23
Location
Right behind you
Country
Australia
Yeah do you have a small example of how you got into the terminal? (I know other camera brands have Telnet lol, I have got into those cams, haven't explored Viofo) but I am sure telnet and UART is totally different. Sounds cool.

How would it be? Have you tried it?
 

Nath

Well-Known Member
Joined
Aug 8, 2017
Messages
811
Reaction score
472
Country
Germany
Dash Cam
Dual A139-3CH, Dual Viofo A129Pro-2CH
@ChampaRando There is nothing special you have to do, except disassemble it and solder three wires (gnd, tx, rx) to small pads on the PCB. UART is basically just a regular com port which uses 3.3V TTL.

And as mentioned before, the terminal is not protected, you're root right away.
 

joe384

Well-Known Member
Joined
Aug 29, 2019
Messages
518
Reaction score
262
Location
Essex
Country
United Kingdom
Dash Cam
2 x DR590W-2CH, Cellink B
Yeah do you have a small example of how you got into the terminal? (I know other camera brands have Telnet lol, I have got into those cams, haven't explored Viofo) but I am sure telnet and UART is totally different. Sounds cool.

How would it be? Have you tried it?

I am sure @Nath will have more info but if it is 3.3v TTL you can pick up these almost anywhere:


This gives you a com port which you can then use some terminal software (like PuTTY)
 

joe384

Well-Known Member
Joined
Aug 29, 2019
Messages
518
Reaction score
262
Location
Essex
Country
United Kingdom
Dash Cam
2 x DR590W-2CH, Cellink B
@ChampaRando Have you seen this thread?


It doesn't not solve the wifi issue but is a way to turn dashcam on/off.

I can't find an information on the power consumption of the board though
 
OP
C

ChampaRando

Member
Joined
Jun 12, 2021
Messages
74
Reaction score
23
Location
Right behind you
Country
Australia
@ChampaRando Have you seen this thread?


It doesn't not solve the wifi issue but is a way to turn dashcam on/off.

I can't find an information on the power consumption of the board though
Umm seems interesting. I can try that for my Thinkware. For Viofo, I messaged Viofo Support and they said that the CMD I mentioned above can be used to turn it off and then I mentioned to them the issues I had above. SO I recommended to them to maybe upon every camera boot, in the firmware, make the firmware automatically set AUTO_POWEROFF to never, upon every boot, so that way. I go in garage, set auto power off to 1 after I finish, and camera turns off. Then upon next boot, the camera switches this function off, so all the issues above are eliminated.

Only thin was, they said this is a good idea and they can give me a custom firmware (sad not for everyone), and they are busy so can do it in few weeks. Haven't heard back lol so hoping they at least try this, as it's 10x simpler and probably less power consumption because no extra equipment.

I am also thinking to make my own DIY for external battery rather than a cellink, so I might try to implement something in my battery DIY where I can cut power from the battery output myself via wifi, in which case, this thread's mention small Wifi relay board can help :D

Thanks for that :D
 

HonestReview

Well-Known Member
Joined
Feb 9, 2019
Messages
3,020
Reaction score
666
Country
Sweden
Okay so I went and tried it myself. It is not really what I want it to do. Here what the command 3007 (the posted attachment above) does;

I basically set the parameter 1 (so POWER_1MIN).
1. In parking mode: The camera turns OFF after 1 minute. So it is useless. From the time the camera enters parking mode, after 1 minute, the whole camera shuts off. This is probably what Parking Timer does. This means even if I parked it outside, camera shuts off after 1 minute. So not what I needed exactly.

2. In normal mode/with ACC ON: Even worse. Every 1-1.5 minutes, the camera rebooted. I believe the NOVATEK firmware forces a shutdown just like in parking mode, but then viofo might have a setting which causes the camera to boot again. Then novatek causes another shutdown, viofo another boot. So essentially every 1/1.5 minutes camera rebooted and video corrupted.

So to fix it, had to re-flash the firmware. So that command is useless :(

We need another way to turn off remotely (just like the power physical switch does). Obviously one way is connecting a wire to the button's circuit inside the camera, which can simulate the actions, but this involves opening the camera (void of warranty) and on top, I am not an electrical technician/engineer :( So a software based would be easier.

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
 

Nigel

Well-Known Member
Joined
Jul 7, 2014
Messages
14,079
Reaction score
7,212
Location
Devon
Country
United Kingdom
Dash Cam
Gitup F1+G3ꞈꞈꞈꞈꞈ Viofo A139ꞈꞈꞈꞈꞈ Blueskysea B4K+B2K
I am not exactly sure what this does.
I suspect it tells the camera to turn off if it is left in standby for t time, ie not recording, so not very useful for your use!

You need a command, not a setting.
 
OP
C

ChampaRando

Member
Joined
Jun 12, 2021
Messages
74
Reaction score
23
Location
Right behind you
Country
Australia
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! :D 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 :p Idea is perfect.
 
Top