EliasKotlyar / Xiaomi-Dafang-Hacks

4.19k stars 1k forks source link

Auto night Detection: Sometimes works, sometimes doesn't #437

Closed saipsa closed 5 years ago

saipsa commented 6 years ago

There is no reproducible steps, it is random. Fails 40% of the time.

wridgers commented 6 years ago

Could be related to https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/issues/332

jthwho commented 6 years ago

@wridgers can you stop autonight and run it manually on the shell with the following: /system/sdcard/bin/autonight -v and see if you can capture a failure? Be sure to run it with the light sensor exposed to light and then covered (or in dark conditions where it should change).

saipsa commented 6 years ago

@jthwho I think I know why it fails sometimes.

I did like you said. current value and updated value were shown in output for few hours. Then it stopped. I think the process got killed or something.

packet_write_wait: Connection to 192.168.1.105 port 22: Broken pipe

jmtatsch commented 6 years ago

@saipsa that means that your ssh connection died. Most likely your computer fell asleep.

saipsa commented 6 years ago

@jmtatsch you are right. But the output to terminal stopped minutes (hours?) earlier than that.

When day to night happened, auto night mode didn't kick in. The night mode should have kicked in if the auto-night process was not killed.

I started it from command line and auto-night kicked in after averaging 5 values.

saipsa commented 6 years ago

@jthwho after updating, now auto night doesn't start autonight values are >400 in complete darkness with IR LED off. Previously it would be <100.

jthwho commented 6 years ago

@saipsa That's odd. Can you post a run of autonight -v with 60 seconds of dark and 60 seconds of light? The autonight application hasn't changed in a few months, so I expect it must be something in the update that changed the values.

saipsa commented 6 years ago

@jthwho I can't :( bricked my device.

trying to https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/issues/30

shinebar1001 commented 6 years ago

It seems that I've got a similar problem. In darkness autonight detects light and switches of the IR-LEDs. When this happens it records a weird value of 4193870.00 - probably a upper limit should be implemented?

Current value: 0.00
Window (5) Avg: 0.00
Current value: 0.00
Window (5) Avg: 0.00
Current value: 0.00
Window (5) Avg: 0.00
Current value: 0.00
Window (5) Avg: 0.00
Current value: 0.00
Window (5) Avg: 0.00
Current value: 4193870.00
Window (5) Avg: 838774.00
Night Mode Disabled
Current value: 4193870.00
Window (5) Avg: 1677548.00
Current value: 4193870.00
Window (5) Avg: 2516322.00
Current value: 4193870.00
Window (5) Avg: 3355096.00
Current value: 4193870.00
Window (5) Avg: 4193870.00
Current value: 0.00
Window (5) Avg: 3355096.00
Current value: 0.00
Window (5) Avg: 2516322.00
Current value: 0.00
Window (5) Avg: 1677548.00
Current value: 0.00
Window (5) Avg: 838774.00
Current value: 0.00
Window (5) Avg: 0.00
Night Mode Enabled
unmotivatedgene commented 6 years ago

Auto Night Mode is not enabling/disabling for me either

results of "autonight -v"

Current value: 756.48 // Total Darkness
Current value: 755.52
Current value: 754.44
Current value: 754.32
Current value: 754.44
Window (5) Avg: 755.04
Current value: 753.84          // Lights on
Window (5) Avg: 754.51
Current value: 753.12
Window (5) Avg: 754.03
Current value: 753.00
Window (5) Avg: 753.74
Current value: 752.04
Window (5) Avg: 753.29
Current value: 750.24

Messed around a bit and the light level seems to barely affect the value.

aartrost commented 6 years ago

@unmotivagedgene This happens because the new Dafang models do not contain a light sensor anymore. For more information see https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/issues/332.

nik0 commented 6 years ago

For the camera that does not have sensor anymore: can you test this https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/pull/557 This is software detection night and mode

Shadow00Caster commented 6 years ago

I am experiencing this issue on a Wyze Cam V2.

Version: 2018-08-03T20:20:27Z

Results from 'autonight -v'

complete darkness:
Current value: 667.08
Current value: 669.00
Current value: 666.48
Current value: 669.00
Current value: 667.56
Window (5) Avg: 667.82
Current value: 667.56
Window (5) Avg: 667.92
Current value: 663.12
Window (5) Avg: 666.74
Current value: 666.48
Window (5) Avg: 666.74

low light:
Current value: 665.52
Current value: 657.48
Current value: 662.16
Current value: 663.24
Current value: 660.84
Window (5) Avg: 661.85
Current value: 662.52
Window (5) Avg: 661.25
Current value: 660.96
Window (5) Avg: 661.94
Current value: 652.68
Window (5) Avg: 660.05

full brightness (room lit brightly at night):
Current value: 662.28
Current value: 656.16
Current value: 657.60
Current value: 653.64
Current value: 648.36
Window (5) Avg: 655.61
Current value: 647.40
Window (5) Avg: 652.63
Current value: 649.32
Window (5) Avg: 651.26

Any advice would be greatly appreciated, thanks.

jmtatsch commented 6 years ago

Your camera probably doesn’t have a light sensor.

Shadow00Caster commented 6 years ago

@jmtatsch

Ya I figured as much, doesn't look like any of the software based solutions for detection are working. I will just do through other automation means using triggering night mode on/off through MQTT and using a LUX sensor.

saipsa commented 6 years ago

@Shadow00Caster you can trigger it using cronjob too.

stale[bot] commented 5 years 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.