roleoroleo / sonoff-hack

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

Feature request - turning off IR LEDs #73

Closed vadimbz closed 1 month ago

vadimbz commented 2 years ago

Would it be possible to implement subj? I'm using the camera through glass, and not being able to get rid of IR defeats the purpose. Or is there a way to do it with ssh?

roleoroleo commented 2 years ago

There are 3 params that we could test.

[root@GK]# . /mnt/mmc/sonoff-hack/script/env.sh
[root@GK]# sqlite3 /mnt/mtd/db/ipcsys.db 'select * from t_sys_param where c_param_name="InfraredLamp";'
|InfraredLamp|2

Maybe we could try 0 or 1...

[root@GK]# . /mnt/mmc/sonoff-hack/script/env.sh
[root@GK]# sqlite3 /mnt/mtd/db/ipcsys.db 'select * from t_sys_param where c_param_name="LED1Mode";'
|LED1Mode|1
[root@GK]# sqlite3 /mnt/mtd/db/ipcsys.db 'select * from t_sys_param where c_param_name="LED2Mode";'
|LED2Mode|1
roleoroleo commented 2 years ago

Again:

[root@GK]# . /mnt/mmc/sonoff-hack/script/env.sh
[root@GK]# sqlite3 /mnt/mtd/db/ipcsys.db 'select * from t_sys_param where c_param_name="IRCUTMode";'
|IRCUTMode|2
[root@GK]# sqlite3 /mnt/mtd/db/ipcsys.db 'select * from t_sys_param where c_param_name="NoIRCUTStartTime";'
|NoIRCUTStartTime|19:00:00
[root@GK]# sqlite3 /mnt/mtd/db/ipcsys.db 'select * from t_sys_param where c_param_name="NoIRCUTEndTime";'
|NoIRCUTEndTime|07:00:00
[root@GK]# sqlite3 /mnt/mtd/db/ipcsys.db 'select * from t_sys_param where c_param_name="NoIRLEDStartTime";'
|NoIRLEDStartTime|07:00:00
[root@GK]# sqlite3 /mnt/mtd/db/ipcsys.db 'select * from t_sys_param where c_param_name="NoIRLEDEndTime";'
|NoIRLEDEndTime|19:00:00
vadimbz commented 2 years ago

Camera has to be rebooted after each parameter change, right?

vadimbz commented 2 years ago

If possible, I would like to keep monochrome night mode, and turn off just IR

roleoroleo commented 2 years ago

Camera has to be rebooted after each parameter change, right?

I don't know but I think it has to be rebooted.

vadimbz commented 2 years ago

I'm sorry, my knowledge of SSH is cursory, how exactly do I edit these? I'm getting the same output as you've shown, but I can't change values at any point.

roleoroleo commented 2 years ago

Ok, it's a sql client. There is a db with a table "t_sys_param" that contains all settings. With SELECT and UPDATE you can change a row in the table. For example:

sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=0 where c_param_name="InfraredLamp";'

set the value of the parameter InfraredLamp to 0. You should try different values. At the moment I tried the following values:

vadimbz commented 2 years ago
[root@GK]# sqlite3 /mnt/mtd/db/ipcsys.db 'select * from t_sys_param where c_param_name="LED1Mode";'
|LED1Mode|0
[root@GK]# sqlite3 /mnt/mtd/db/ipcsys.db 'select * from t_sys_param where c_param_name="LED2Mode";'
|LED2Mode|0

No dice, IR still on

[root@GK]# sqlite3 /mnt/mtd/db/ipcsys.db 'select * from t_sys_param where c_param_name="LED1Mode";'
|LED1Mode|2
[root@GK]# sqlite3 /mnt/mtd/db/ipcsys.db 'select * from t_sys_param where c_param_name="LED2Mode";'
|LED2Mode|2

Ditto - IR still on I'll try other parameters

vadimbz commented 2 years ago
[root@GK]# sqlite3 /mnt/mtd/db/ipcsys.db 'select * from t_sys_param where c_param_name="NoIRCUTStartTime";'
|NoIRCUTStartTime|00:00:00
[root@GK]# sqlite3 /mnt/mtd/db/ipcsys.db 'select * from t_sys_param where c_param_name="NoIRCUTEndTime";'
|NoIRCUTEndTime|00:01:00
[root@GK]# sqlite3 /mnt/mtd/db/ipcsys.db 'select * from t_sys_param where c_param_name="NoIRLEDStartTime";'
|NoIRLEDStartTime|00:01:00
[root@GK]# sqlite3 /mnt/mtd/db/ipcsys.db 'select * from t_sys_param where c_param_name="NoIRLEDEndTime";'
|NoIRLEDEndTime|00:00:00

No effect - IR still on. Are these correct queries (straight quotes)?

sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value="00:00:00" where c_param_name="NoIRCUTStartTime";'
sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value="00:01:00" where c_param_name="NoIRCUTEndTime";'
sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value="00:01:00" where c_param_name="NoIRLEDStartTime";'
sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value="00:00:00" where c_param_name="NoIRLEDEndTime";'
roleoroleo commented 2 years ago

Yes, the queries are correct.

vadimbz commented 2 years ago

Then it seems I'm out of options... other than wait for IRCUTMode to somehow kick in.

sanderbrauns commented 2 years ago

Not sure what the settings mean. But with these settings the IR leds seem to turn off:

sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=2 where c_param_name="InfraredLamp";' sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=1 where c_param_name="LED1Mode";' sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=1 where c_param_name="LED2Mode";' sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=1 where c_param_name="IRCUTMode";' sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=0 where c_param_name="NoIRCUTStartTime";' sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=0 where c_param_name="NoIRCUTEndTime";' sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=0 where c_param_name="NoIRLEDStartTime";' sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=0 where c_param_name="NoIRLEDEndTime";'

vadimbz commented 2 years ago

Not sure what the settings mean. But with these settings the IR leds seem to turn off:

Didn't work for me =(

rikki78 commented 1 year ago

Not sure what the settings mean. But with these settings the IR leds seem to turn off:

sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=2 where c_param_name="InfraredLamp";' sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=1 where c_param_name="LED1Mode";' sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=1 where c_param_name="LED2Mode";' sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=1 where c_param_name="IRCUTMode";' sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=0 where c_param_name="NoIRCUTStartTime";' sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=0 where c_param_name="NoIRCUTEndTime";' sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=0 where c_param_name="NoIRLEDStartTime";' sqlite3 /mnt/mtd/db/ipcsys.db 'update t_sys_param set c_param_value=0 where c_param_name="NoIRLEDEndTime";'

This worked for me

darkxst commented 1 year ago

IRCUT will be an infrared filter that would normally be on during the day to cut out excess glare (IR from daylight/sunlight) from saturating the sensor. It would then turn off to allow night vision to work ;) I don't expect those settings to have any effect on the IR LED's

darkxst commented 1 year ago

Can disable the visible status LED with the following blank file (reboot required) . touch /dayun/mtd/cfg/disable_ledshow

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.