twrecked / hass-aarlo

Asynchronous Arlo Component for Home Assistant
GNU Lesser General Public License v3.0
399 stars 79 forks source link

False motion detection related to aarlo_request_snapshot (+ time_zone old settings problem) #312

Open septeven opened 4 years ago

septeven commented 4 years ago

Hello, I've been encountering false positive for a while now, and I haven't figured out how to stop them to occur. I have Arlo Pro 2 cameras.

First, what I mean by false positive is false motion detection state of my binary_sensor.aarlo_motion_camera where it seems like there's no motion really detected by the camera itself (Arlo app is NOT reporting any motion detection for those false one).

I recently figured out that the aarlo motion binary_sensor turn on a few seconds only after the aarlo_request_snapshot service has been called - BUT not every time though, which probably makes the troubleshooting more difficult - sure thing is that it seems related as you can see on the screenshot I've attached below.

my aarlo_request_snapshot automation:

  - alias: '[SECURITY] Update Arlo Cameras Snapshot'
    initial_state: on
    trigger:
      - platform: time_pattern
        minutes: '/30'
    condition:
    - condition: time
      after: '06:00:00'
      before: '01:00:00'
    action:
      - service: camera.aarlo_request_snapshot
        entity_id: camera.aarlo_cave

Look how (false positive) motion is detected a few seconds after the snapshot is taken ..., it is confirmed with the fact that there is no motion detected between 1am and 6am which is because my automation is not running during that specific time window (see automation above). On this screenshot, you can also see that it's not occuring every time the service is called but frequently though (I just circled the 3 one related, but you can easily see on the right that it keeps happening every 30 minutes....)

Capture d’écran 2020-09-14 à 18 14 53 copie

Also, It's not causing me any problem, but I don't understand why only one of my four cameras have the correct timezone setup "time_zone: Europe/Brussels" where the three others have kept my older setting "time_zone: America/New_York" (I was living in Toronto until last year when I moved to France)

twrecked commented 4 years ago

I'll take a look at the motion.

As for the timezone, we print the value that Arlo sends us. I have the same issue with one of my cameras, the things shows as "America/Bogota" but the base station is showing as "America/Toronto". All times will be displayed as the timezone set for Home Assistant.

twrecked commented 4 years ago

Sorry for the delay, real life got in the way.

You still seeing these phantom events? Can you turn on debugging and look at the logs around when one happened? This should be good:

logger:
  default: info
  logs:
    custom_components.aarlo: debug
    custom_components.aarlo.camera: debug
    pyaarlo: debug
septeven commented 3 years ago

So sorry @twrecked for the very late response, I've been busy lately and had no time to spend on this. As per you're asking, yes, I do still have those false events, I've just turn on debugging as you suggested and I'll be back asap with some news.

septeven commented 3 years ago

Hey @twrecked Could you please tell me what you need me to copy/paste here (and if there's any sensitive details that I should take off of it). Thanks

twrecked commented 3 years ago

Start by looking for this:

    motionDetected=True

It will appear in a line with a timestamp. The XXXXXXs here are my hidden serial number.

2021-01-31 01:51:26 DEBUG (ArloEventStream) [pyaarlo] set:ArloCamera/XXXXXXXXXXXX/motionDetected=True

Then we need to look at the logs just above that to see why it triggered. In mine it looks like:

2021-01-31 00:21:36 DEBUG (ArloEventStream) [pyaarlo] packet-in=                                                                       
{ 'action': 'is',                                                                                                                      
  'from': 'XXXXXXXXXXXX',                                                                                                             
  'properties': {'motionDetected': True},                                                                                              
  'resource': 'cameras/XXXXXXXXXXX',                                                                                                 
  'transId': 'XXXXXXXXXX'}  

But, I've just noticed I have a bug in the door bell code that returns a false positive for motion. So look for cases that aren't preceded by the motionDetected packet. I'll dig into this bug a little more. If you don't have packets you might need to add verbose_debug: True to your aarlo config.

septeven commented 3 years ago

I do see the same logs than yours when the false event occurs, with 'motionDetected' set to True... What does that mean, does that help you to figure it out ?

I really do believe that it is directly related to when the snapshot is taken, which makes the camera detecting motion then.... but again, the Arlo app is not recording any video, so that means the motion detection is only occurring from aarlo side ....

twrecked commented 3 years ago

If your seeing the log with motion set to true that means it might be coming from Arlo. Can you send me the logs from around the time of the events happening. You can either remove the serial numbers or paste the log to here, the serial numbers will still be there but only I'll be able to see them.