twrecked / hass-aarlo

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

Motion detection disable intermittently doesn’t work #478

Open NickM-27 opened 3 years ago

NickM-27 commented 3 years ago

I am using the Camera: enable motion detection for Arlo essential cam and that works as expected and sets the cameras to Armed in the app reliably. However, Camera: disable motion detection does not seem to do anything many times. Do I need to run a wake command first or something?

NickM-27 commented 3 years ago

@twrecked do you have any advice on this? Today none of my cameras responded to the disable motion detection service call

twrecked commented 3 years ago

Can you turn on debug logs and send me the logs around the time it fails?

This would be a good level to try:

logger:
  default: info
  logs:
    custom_components.aarlo: debug
    custom_components.aarlo.alarm_control_panel: debug
    custom_components.aarlo.camera: debug
    pyaarlo: debug

And are you using the camera.enable_motion_detection service?

NickM-27 commented 3 years ago

When I use the camera.enable_motion_detection service at sunset it works very dependably. However for some reason the camera.disable_motion_detection does not work dependably. I just enabled those logs and will see if it reproduces itself.

twrecked commented 3 years ago

Let me know what happens. The motion detection enable and disable code just arms and disarms the base stations so there might be a clash there. You say you have Essential cameras, what other kinds do you have?

NickM-27 commented 3 years ago

@twrecked I have 3 essential cams, a wire-free doorbell, and a 2nd gen chime. No base station at all.

NickM-27 commented 3 years ago

@twrecked Okay this time the camera.enable_motion_detection failed, this is what I see in the error log:

Logger: engineio.client
Source: /usr/local/lib/python3.9/site-packages/engineio/asyncio_client.py:559
First occurred: 7:47:30 AM (39 occurrences)
Last logged: 8:43:27 AM

packet queue is empty, aborting

more complete log around that:

2021-08-11 08:43:50 DEBUG (ArloEventStream) [pyaarlo] Fetching device list after ev-reconnect
2021-08-11 08:43:52 DEBUG (ArloEventStream) [pyaarlo] sseclient-error=ConnectionError
2021-08-11 08:43:55 INFO (MainThread) [aioambient.websocket] Watchdog triggered – sleeping for 900 seconds
2021-08-11 08:43:55 DEBUG (ArloEventStream) [pyaarlo] Fetching device list after ev-reconnect
2021-08-11 08:43:57 DEBUG (ArloEventStream) [pyaarlo] sseclient-error=ConnectionError
2021-08-11 08:44:01 DEBUG (ArloEventStream) [pyaarlo] Fetching device list after ev-reconnect
2021-08-11 08:44:03 DEBUG (ArloEventStream) [pyaarlo] sseclient-error=ConnectionError
2021-08-11 08:44:06 DEBUG (ArloEventStream) [pyaarlo] Fetching device list after ev-reconnect
2021-08-11 08:44:08 DEBUG (ArloEventStream) [pyaarlo] sseclient-error=ConnectionError
2021-08-11 08:44:12 DEBUG (ArloEventStream) [pyaarlo] Fetching device list after ev-reconnect
2021-08-11 08:44:14 DEBUG (ArloEventStream) [pyaarlo] sseclient-error=ConnectionError
2021-08-11 08:44:17 DEBUG (ArloEventStream) [pyaarlo] Fetching device list after ev-reconnect
2021-08-11 08:44:19 DEBUG (ArloEventStream) [pyaarlo] sseclient-error=ConnectionError
2021-08-11 08:44:23 DEBUG (ArloEventStream) [pyaarlo] Fetching device list after ev-reconnect
2021-08-11 08:44:25 DEBUG (ArloEventStream) [pyaarlo] sseclient-error=ConnectionError
2021-08-11 08:44:28 DEBUG (ArloEventStream) [pyaarlo] Fetching device list after ev-reconnect
2021-08-11 08:44:31 DEBUG (ArloEventStream) [pyaarlo] sseclient-error=ConnectionError
2021-08-11 08:44:34 DEBUG (ArloEventStream) [pyaarlo] Fetching device list after ev-reconnect
2021-08-11 08:44:36 DEBUG (ArloEventStream) [pyaarlo] sseclient-error=ConnectionError
2021-08-11 08:44:39 DEBUG (ArloEventStream) [pyaarlo] Fetching device list after ev-reconnect
2021-08-11 08:44:42 DEBUG (ArloEventStream) [pyaarlo] sseclient-error=ConnectionError
2021-08-11 08:44:45 DEBUG (ArloEventStream) [pyaarlo] Fetching device list after ev-reconnect
2021-08-11 08:44:47 DEBUG (ArloEventStream) [pyaarlo] sseclient-error=ConnectionError
2021-08-11 08:44:50 DEBUG (ArloEventStream) [pyaarlo] Fetching device list after ev-reconnect
2021-08-11 08:44:53 DEBUG (ArloEventStream) [pyaarlo] sseclient-error=ConnectionError
2021-08-11 08:44:54 ERROR (MainThread) [engineio.client] packet queue is empty, aborting
NickM-27 commented 3 years ago

I do see multiple of those long type that I put above so maybe I pasted the wrong thing, let me know if there is a specific log that I can look for

NickM-27 commented 3 years ago

I also see this which is very interested:

2021-08-11 08:47:30 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2021-08-11 08:47:30 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2021-08-11 08:47:30 DEBUG (SyncWorker_1) [pyaarlo] no mode change needed

Almost like it isn't checking the correct camera for motion_detection state? Or perhaps because it is looking at "base stations" it only sees the group as one item?

twrecked commented 3 years ago

The sseclient-error=ConnectionError errors aren't normal. You might seem them occasionally but not at the frequency you're getting them. Is there any aarlo debug just before they start happening?

To your second point, each device will provide its own base station. If you check the modes in the app should it have changed?

For reference, you should see this when the mode changes:

2021-08-11 10:40:22 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2021-08-11 10:40:22 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2021-08-11 10:40:22 DEBUG (SyncWorker_5) [pyaarlo] set:ArloBase/XXXXXXXXXXXX/activeSchedule=None
2021-08-11 10:40:22 DEBUG (SyncWorker_5) [pyaarlo] Front Base:new-mode=disarmed,id=mode0
2021-08-11 10:40:22 DEBUG (SyncWorker_5) [pyaarlo] deduced v2 api
2021-08-11 10:40:22 DEBUG (SyncWorker_5) [pyaarlo] v2 arming
NickM-27 commented 3 years ago

@twrecked It should have changed to armed but it doesn't. I just ran again and just seeing

2021-08-11 10:36:09 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2021-08-11 10:36:09 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2021-08-11 10:36:09 DEBUG (SyncWorker_3) [pyaarlo] no mode change needed

If I manually change the mode in the app and then run camera.disable_motion_detection it works and I get these logs:

2021-08-11 10:38:29 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2021-08-11 10:38:29 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2021-08-11 10:38:29 DEBUG (SyncWorker_6) [pyaarlo] set:ArloBase/A4730B76A2ECE/activeSchedule=None
2021-08-11 10:38:29 DEBUG (SyncWorker_6) [pyaarlo] Driveway:new-mode=disarmed,id=mode0
2021-08-11 10:38:29 DEBUG (SyncWorker_6) [pyaarlo] v2 arming
2021-08-11 10:38:31 DEBUG (ArloEventStream) [pyaarlo] Fetching device list after ev-reconnect
2021-08-11 10:38:32 DEBUG (ArloEventStream) [pyaarlo] unhandled response automation/active - {'to': 'https://vzweb17-prod.vz.netgear.com', 'from': 'A4730B76A2ECE', 'transId': '477499d5-0d83-4aca-adf7-ea937737fcf0!A294A302!1628696309319', 'resource': 'automation/active', 'action': 'is', 'properties': {}}
2021-08-11 10:38:32 DEBUG (ArloEventStream) [pyaarlo] unhandled response basestation/connectivity - {'from': 'A4730B76A2ECE', 'action': 'is', 'resource': 'basestation/connectivity', 'properties': {'connectivity': [{'type': 'wifi', 'connected': True, 'ssid': 'Mowen The LAN 2.4', 'signalStrength': 3, 'ipAddr': '192.168.50.123'}]}, 'transId': 'A4730B76A2ECE!d75955fc!1628696311'}
2021-08-11 10:38:32 DEBUG (ArloEventStream) [pyaarlo] sending states to A4730B76A2ECE
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] Driveway BASE got states
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] state change
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] mode0<=M=>disarmed
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIdToName/mode0=disarmed
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeNameToId/disarmed=mode0
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIsSchedule/mode0=False
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIsSchedule/disarmed=False
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] mode1<=M=>armed
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIdToName/mode1=armed
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeNameToId/armed=mode1
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIsSchedule/mode1=False
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIsSchedule/armed=False
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] schedule.1<=S=>Arm camera M-F 8-5
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIdToName/schedule.1=Arm camera M-F 8-5
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeNameToId/arm camera m-f 8-5=schedule.1
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIsSchedule/schedule.1=True
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIsSchedule/arm camera m-f 8-5=True
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] Driveway schedule cleared
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/activeSchedule=None
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] Driveway mode change mode0
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/activeMode=disarmed
2021-08-11 10:38:32 DEBUG (ArloBackgroundWorker) [pyaarlo] Driveway CAMERA got one states
2021-08-11 10:38:34 DEBUG (ArloEventStream) [pyaarlo] sseclient-error=ConnectionError
2021-08-11 10:38:37 DEBUG (ArloEventStream) [pyaarlo] Fetching device list after ev-reconnect

So something weird with it being done by HA twice in a row where I guess it thinks the mode hasn't changed?

twrecked commented 3 years ago

I should have asked, can you turn on verbose debug too:

aarlo:
  ...
  verbose_debug: True
NickM-27 commented 3 years ago

Okay, just updated that, any specific log I should be looking for?

twrecked commented 3 years ago

It will show you what it's trying to send and what is coming back. Might give a clue as to what is going wrong.

NickM-27 commented 3 years ago

Alright so this is what I get:


2021-08-11 17:23:18 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2021-08-11 17:23:18 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2021-08-11 17:23:18 DEBUG (SyncWorker_6) [pyaarlo] no mode change needed
2021-08-11 17:23:20 DEBUG (ArloEventStream) [pyaarlo] sseclient-error=ConnectionError
2021-08-11 17:23:23 DEBUG (ArloEventStream) [pyaarlo] Fetching device list after ev-reconnect
2021-08-11 17:23:23 DEBUG (ArloEventStream) [pyaarlo] get+response running
2021-08-11 17:23:23 DEBUG (ArloEventStream) [pyaarlo] request-url=https://myapi.arlo.com/hmsweb/users/devices?t=1628720603805
2021-08-11 17:23:23 DEBUG (ArloEventStream) [pyaarlo] request-params=
{}
2021-08-11 17:23:23 DEBUG (ArloEventStream) [pyaarlo] request-headers=
{}
2021-08-11 17:23:24 DEBUG (ArloEventStream) [pyaarlo] request-end=200
2021-08-11 17:23:24 DEBUG (ArloEventStream) [pyaarlo] request-body=
{'data': [{'arloMobilePlan': False,
'cvrEnabled': False,
'dateCreated': 1615643233944,
'deviceId': 'A4730A7KA94E0',
'deviceName': 'Front Porch',
'deviceType': 'camera',
'displayOrder': 1,
'interfaceSchemaVer': '3',
'interfaceVersion': 'i002',
'lastImageUploaded': 'true',
'lastModified': 1628720603915,
'mediaObjectCount': 240,
'modelId': 'VMC2030A',
'owner': {'firstName': 'Nick',
'lastName': 'Mowen',
'ownerId': 'JYV5-336-55162572'},
'parentId': 'A4730A7KA94E0',
'presignedFullFrameSnapshotUrl': 'https://arlos3-prod-z2.arlo.com/63f9a09497e44ed28d5017411e4de58c/JYV5-336-55162572/A4730A7KA94E0/fullFrameSnapshot.jpg?AWSAccessKeyId=AKIA2BAHQO5QZGD7VOMI&Expires=1628807003&Signature=TQ4hd9ylqTFD7RRyfQmwYtV%2FU%2F8%3D',
'presignedLastImageUrl': 'https://arlos3-prod-z2.arlo.com/63f9a09497e44ed28d5017411e4de58c/JYV5-336-55162572/A4730A7KA94E0/recordings/1628709726892_thumb.jpg?AWSAccessKeyId=AKIA2BAHQO5QZGD7VOMI&Expires=1628807003&Signature=1rp8YxfiFH4%2B7SIFwRBE5xeHi4A%3D',
'presignedSnapshotUrl': 'https://arlos3-prod-z2.arlo.com/63f9a09497e44ed28d5017411e4de58c/JYV5-336-55162572/A4730A7KA94E0/snapshot.jpg?AWSAccessKeyId=AKIA2BAHQO5QZGD7VOMI&Expires=1628807003&Signature=PHUCjQQbOsgxiJabdUyAc4CbmzM%3D',
'state': 'provisioned',
'timeZone': 'America/Chicago',
'uniqueId': '**********',
'userId': '**********',
'userRole': 'ADMIN',
'xCloudId': '***********'},
{'arloMobilePlan': False,
'cvrEnabled': False,
'dateCreated': 1615609476528,
'deviceId': 'A4730B76A2ECE',
'deviceName': 'Driveway',
'deviceType': 'camera',
'displayOrder': 2,
'interfaceSchemaVer': '3',
'interfaceVersion': 'i002',
'lastImageUploaded': 'true',
'lastModified': 1628720603915,
'mediaObjectCount': 141,
'modelId': 'VMC2030A',
'owner': {'firstName': 'Nick',
'lastName': 'Mowen',
'ownerId': '*************'},
'parentId': '*************',
'presignedFullFrameSnapshotUrl': 'https://arlos3-prod-z2.arlo.com/63f9a09497e44ed28d5017411e4de58c/JYV5-336-55162572/A4730B76A2ECE/fullFrameSnapshot.jpg?AWSAccessKeyId=AKIA2BAHQO5QZGD7VOMI&Expires=1628807003&Signature=Cg7dehyyRRtC%2BpPOfk%2FEJVcL66c%3D',
'presignedLastImageUrl': 'https://arlos3-prod-z2.arlo.com/63f9a09497e44ed28d5017411e4de58c/JYV5-336-55162572/A4730B76A2ECE/recordings/1628651157360_thumb.jpg?AWSAccessKeyId=AKIA2BAHQO5QZGD7VOMI&Expires=1628807003&Signature=8XBMkpvlRXdSGXLUWTIzdJD43A0%3D',
'presignedSnapshotUrl': 'https://arlos3-prod-z2.arlo.com/63f9a09497e44ed28d5017411e4de58c/JYV5-336-55162572/A4730B76A2ECE/snapshot.jpg?AWSAccessKeyId=AKIA2BAHQO5QZGD7VOMI&Expires=1628807003&Signature=jpovlL7pt23odp9uxA%2FNlzvJzSY%3D',
'state': 'provisioned',
'timeZone': 'America/Chicago',
'uniqueId': '*************',
'userId': '************',
'userRole': 'ADMIN',
'xCloudId': '************'},
{'arloMobilePlan': False,
'cvrEnabled': False,
'dateCreated': 1615642633786,
'deviceId': '************',
'deviceName': 'Back Yard',
'deviceType': 'camera',
'displayOrder': 3,
'interfaceSchemaVer': '3',
'interfaceVersion': 'i002',
'lastImageUploaded': 'true',
'lastModified': 1628720603915,
'mediaObjectCount': 30,
'modelId': 'VMC2030A',
'owner': {'firstName': 'Nick',
'lastName': 'Mowen',
'ownerId': '**********'},
'parentId': '************',
'presignedFullFrameSnapshotUrl': 'https://arlos3-prod-z2.arlo.com/63f9a09497e44ed28d5017411e4de58c/JYV5-336-55162572/A4730B7YA2AFD/fullFrameSnapshot.jpg?AWSAccessKeyId=AKIA2BAHQO5QZGD7VOMI&Expires=1628807003&Signature=wgQDYUH5Jhm2wh8WTpo9ZbjCVAY%3D',
'presignedLastImageUrl': 'https://arlos3-prod-z2.arlo.com/63f9a09497e44ed28d5017411e4de58c/JYV5-336-55162572/A4730B7YA2AFD/recordings/1628670723390_thumb.jpg?AWSAccessKeyId=AKIA2BAHQO5QZGD7VOMI&Expires=1628807003&Signature=PAYyEd0E%2BZtQEqQEml4Nok8NYF4%3D',
'presignedSnapshotUrl': 'https://arlos3-prod-z2.arlo.com/63f9a09497e44ed28d5017411e4de58c/JYV5-336-55162572/A4730B7YA2AFD/snapshot.jpg?AWSAccessKeyId=AKIA2BAHQO5QZGD7VOMI&Expires=1628807003&Signature=DV%2FsQV3OwaPOijr%2FYJYLlmZCDLo%3D',
'state': 'provisioned',
'timeZone': 'America/Chicago',
'uniqueId': '**********',
'userId': '**************',
'userRole': 'ADMIN',
'xCloudId': '****************'},
{'arloMobilePlan': False,
'automationRevision': 0,
'connectivity': {'connected': True,
'mepStatus': 'unknown',
'signalStrength': '3',
'type': 'wifi'},
'cvrEnabled': False,
'dateCreated': 1614883450545,
'deviceId': 'A8M10CWG00CD5',
'deviceName': 'Front Doorbell',
'deviceType': 'doorbell',
'displayOrder': 4,
'interfaceSchemaVer': '3',
'interfaceVersion': 'i001',
'lastImageUploaded': 'true',
'lastModified': 1628720603915,
'mediaObjectCount': 206,
'modelId': 'AVD2001A',
'owner': {'firstName': 'Nick',
'lastName': 'Mowen',
'ownerId': '**********'},
'parentId': '************',
'presignedFullFrameSnapshotUrl': 'https://arlos3-prod-z2.arlo.com/63f9a09497e44ed28d5017411e4de58c/JYV5-336-55162572/A8M10CWG00CD5/fullFrameSnapshot.jpg?AWSAccessKeyId=AKIA2BAHQO5QZGD7VOMI&Expires=1628807003&Signature=geoAlwyfzCzanBHgF%2FT7IzVw8FQ%3D',
'presignedLastImageUrl': 'https://arlos3-prod-z2.arlo.com/63f9a09497e44ed28d5017411e4de58c/JYV5-336-55162572/A8M10CWG00CD5/recordings/1628709728079_thumb.jpg?AWSAccessKeyId=AKIA2BAHQO5QZGD7VOMI&Expires=1628807003&Signature=XTyGHSO923q7FtsuaP8asfARw4k%3D',
'presignedSnapshotUrl': 'https://arlos3-prod-z2.arlo.com/63f9a09497e44ed28d5017411e4de58c/JYV5-336-55162572/A8M10CWG00CD5/snapshot.jpg?AWSAccessKeyId=AKIA2BAHQO5QZGD7VOMI&Expires=1628807003&Signature=v1kvMtUsnsrZ18NeN1zROO9Bq4M%3D',
'properties': {'hwVersion': 'AVD2001Aer1.2',
'modelId': 'AVD2001A',
'olsonTimeZone': 'America/Chicago'},
'state': 'provisioned',
'timeZone': 'America/Chicago',
'uniqueId': '*************',
'userId': '**************',
'userRole': 'ADMIN',
'xCloudId': '****************'}],
'success': True}
2021-08-11 17:23:24 DEBUG (ArloEventStream) [pyaarlo] packet-in=
{'status': 'connected'}
NickM-27 commented 3 years ago

Not seeing any extra info around the "no mode change needed"

twrecked commented 3 years ago

It looks like it's reconnecting, I just don't know why the alarm is in the wrong state.

Have you tried turning on the alarm_control_panel option for Arlo. It might be nice to see what they show.

And the other thing that might be useful is the traffic around the time you see the first ConnectionError.

And can you paste your config, with the sensitive bits removed obviously.

NickM-27 commented 3 years ago

My config:

aarlo:                                                                                                                                                                       
  username: !secret arlo_username                                                                                                                                            
  password: !secret arlo_password                                                                                                                                            
  refresh_devices_every: 24                                                                                                                                                  
  stream_timeout: 2                                                                                                                                                                                                                                                                                 
  verbose_debug: True
  tfa_details...removed for sharing purposes but it is enabled

camera:                                                                                                                                                                      
  - platform: aarlo                                                                                                                                                          

binary_sensor:                                                                                                                                                               
  - platform: aarlo                                                                                                                                                          
    monitored_conditions:                                                                                                                                                    
    - motion                                                                                                                                                                 
    - sound                                                                                                                                                                  
    - ding                                                                                                                                                                   
    - connectivity                                                                                                                                                           

sensor:                                                                                                                                                                      
  - platform: aarlo                                                                                                                                                          
    monitored_conditions:                                                                                                                                                    
    - last_capture                                                                                                                                                           
    - recent_activity                                                                                                                                                        
    - captured_today                                                                                                                                                         
    - battery_level                                                                                                                                                          

media_player:                                                                                                                                                                
  - platform: aarlo                                                                                                                                                          

alarm_control_panel:                                                                                                                                                         
  - platform: aarlo                                                                                                                                                          
    away_mode_name: armed                                                                                                                                                    
    home_mode_name: disarmed                                                                                                                                                 
    trigger_time: 30                                                                                                                                                         
    alarm_volume: 8
NickM-27 commented 3 years ago

So a few notes here: Using the camera: motion_detection service in Home Assistant will only work once per camera. If I arm with the service and then try to disarm with the service it will not work and this is reproducible.

Also, at first the Alarm Control Panel service would not do anything but after setting them all in the arlo app and then using the ~Alarm Control Panel service they all seem to work as expected~. Actually, it also can only be run once and then it won't have any affect

twrecked commented 3 years ago

I'm wondering if home_mode_name: disarmed is causing some confusion. disarmed is the default for disarming an alarm and I'm not sure how my internal code will handle that.

NickM-27 commented 3 years ago

Okay, to be clear I only just added that to the config

NickM-27 commented 3 years ago

This is the first connection error

2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] mode0<=M=>disarmed
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIdToName/mode0=disarmed
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeNameToId/disarmed=mode0
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIsSchedule/mode0=False
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIsSchedule/disarmed=False
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] mode1<=M=>armed
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIdToName/mode1=armed
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeNameToId/armed=mode1
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIsSchedule/mode1=False
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIsSchedule/armed=False
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] schedule.1<=S=>Arm camera M-F 8-5
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIdToName/schedule.1=Arm camera M-F 8-5
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeNameToId/arm camera m-f 8-5=schedule.1
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIsSchedule/schedule.1=True
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/A4730B76A2ECE/modeIsSchedule/arm camera m-f 8-5=True
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] notify+response running
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] post+response running
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] request-url=https://myapi.arlo.com/hmsweb/users/devices/notify/A4730B76A2ECE
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] request-params=
{'action': 'get',
'from': 'FFHRM-336-56139250_web',
'publishResponse': False,
'resource': 'cameras',
'to': 'A4730B76A2ECE',
'transId': 'web!b03c00b1-d0b1-4119-852f-84593bb3df13'}
2021-08-11 19:53:20 DEBUG (ArloBackgroundWorker) [pyaarlo] request-headers=
{'xcloudId': 'SH7KA-2740-336-117213084'}
2021-08-11 19:53:20 DEBUG (ArloEventStream) [pyaarlo] sseclient-error=ConnectionError
2021-08-11 19:53:21 DEBUG (ArloBackgroundWorker) [pyaarlo] request-end=200
2021-08-11 19:53:21 DEBUG (ArloBackgroundWorker) [pyaarlo] request-body=
{'success': True}
2021-08-11 19:53:21 DEBUG (ArloBackgroundWorker) [pyaarlo] notify+response running
2021-08-11 19:53:21 DEBUG (ArloBackgroundWorker) [pyaarlo] post+response running
2021-08-11 19:53:21 DEBUG (ArloBackgroundWorker) [pyaarlo] request-url=https://myapi.arlo.com/hmsweb/users/devices/notify/A4730B76A2ECE
NickM-27 commented 3 years ago

Update on what I wrote above, the alarm_control_panel also only runs once inside of HA before it stops having an effect.

twrecked commented 3 years ago

You ok editing code or playing around with python? I'm wondering if the camera resources call is breaking it. (I don't have an essential camera so can't test this stuff.)

In custom_components/aarlo/pyaarlo/__init__.py, in the function def _refresh_bases comment out lines 321 to 339. All the self._be.notify() stuff

If you don't feel comfortable doing that another option would be to point the camera somewhere boring and share it with me - steve.herrell@gmail.com - and I can try some tests here.

NickM-27 commented 3 years ago

Yeah I am an Android dev for a living, mostly do kotlin stuff but I am familiar with python. My only question is, since I installed via HACS do I need to get rid of that and pull in the code directly or am I still able to edit after pulling it in from HACS?

NickM-27 commented 3 years ago

Okay I updated the code, will restart HA and see what happens

twrecked commented 3 years ago

Excellent!

No, you should be able to edit it directly from inside your config directory. When you restart it will pick up the changes.

To make things easier, this is the diff, patch -p1 at the same level as your configuration should work. I don't know if this will work but the disconnect happened after this.

diff --git a/custom_components/aarlo/pyaarlo/__init__.py b/custom_components/aarlo/pyaarlo/__init__.py
index eb694f8..90759ba 100644
--- a/custom_components/aarlo/pyaarlo/__init__.py
+++ b/custom_components/aarlo/pyaarlo/__init__.py
@@ -318,25 +318,25 @@ class PyArlo(object):
     def _refresh_bases(self, initial):
         for base in self._bases:
             base.update_modes(initial)
-            self._be.notify(
-                base=base,
-                body={"action": "get", "resource": "cameras", "publishResponse": False},
-                wait_for="response",
-            )
-            self._be.notify(
-                base=base,
-                body={
-                    "action": "get",
-                    "resource": "doorbells",
-                    "publishResponse": False,
-                },
-                wait_for="response",
-            )
-            self._be.notify(
-                base=base,
-                body={"action": "get", "resource": "lights", "publishResponse": False},
-                wait_for="response",
-            )
+            #  self._be.notify(
+                #  base=base,
+                #  body={"action": "get", "resource": "cameras", "publishResponse": False},
+                #  wait_for="response",
+            #  )
+            #  self._be.notify(
+                #  base=base,
+                #  body={
+                    #  "action": "get",
+                    #  "resource": "doorbells",
+                    #  "publishResponse": False,
+                #  },
+                #  wait_for="response",
+            #  )
+            #  self._be.notify(
+                #  base=base,
+                #  body={"action": "get", "resource": "lights", "publishResponse": False},
+                #  wait_for="response",
+            #  )

     def _refresh_modes(self):
         self.vdebug("refresh modes")
twrecked commented 3 years ago

It's got late here, I'll check in in the morning.

NickM-27 commented 3 years ago

Okay yeah that fixed the bunches of ConnectionError I was getting, just see one here or there now. I am still seeing an issue where using call service alarm control panel: disarm and then alarm control panel: arm in HA it does not work saying that it is already in that state. Maybe I can just remove that check and it will work? I see why you would want to check that

NickM-27 commented 3 years ago

Sure no problem!

NickM-27 commented 3 years ago

Okay after that change, naturally, it works plenty of times in a row. So it seems like for some reason either self or _id_to_name is getting a stale value (I think, since on first load it works correctly)

twrecked commented 3 years ago

It could well fix the issue. Keep me posted.

The problem is we have to reverse engineer the web interface and sometimes doing one thing wrong for a camera can blow the whole thing up.

If you fancy taking a look at what happens log into the website with Chrome and open the developer tools. You can see most of the request/responses but, for some reason, the event stream is missing.

NickM-27 commented 3 years ago

Yeah that did fix it. I'll try to comb through the python and see if I see anything. It's probably a matter of stale data somewhere. Maybe self mode isn't getting updated (since it always works the first time)

twrecked commented 3 years ago

You can try this:

aarlo:
  ...
  refresh_modes_every: 10

And you should see it update if you change it in the Arlo app.

NickM-27 commented 3 years ago

Alright, changing that and I will get back to you

NickM-27 commented 3 years ago

@twrecked So I can confidently say that that fixed things for me. Are you going to change any code or just an issue with my setup? If the latter I can close the issue

twrecked commented 3 years ago

I'll fix the issue. I'll try and get a new build out later this week.