twrecked / hass-aarlo

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

No connectivity binary sensor for Essential cameras #587

Closed ehendrix23 closed 3 weeks ago

ehendrix23 commented 2 years ago

I get the connectivity binary sensor for my doorbell and my 3 Aarlo Pro cameras. But I do not see it for my 2 Aarlo Essential cameras. Doorbell and all 5 cameras are connected to my Aarlo hub.

Debugging shows that motion binary sensor for example is created for all but not the connectivity binary sensors for the Essential cameras (garaga_1 and garage_2):

2022-04-25 07:40:01 INFO (MainThread) [custom_components.aarlo.binary_sensor] ArloBinarySensor: Motion Garage 2 created
2022-04-25 07:40:01 INFO (MainThread) [custom_components.aarlo.binary_sensor] ArloBinarySensor: Motion Garage 1 created
2022-04-25 07:40:01 INFO (MainThread) [custom_components.aarlo.binary_sensor] ArloBinarySensor: Motion Doorbell created
2022-04-25 07:40:01 INFO (MainThread) [custom_components.aarlo.binary_sensor] ArloBinarySensor: Motion Front yard created
2022-04-25 07:40:01 INFO (MainThread) [custom_components.aarlo.binary_sensor] ArloBinarySensor: Motion Driveway created
2022-04-25 07:40:01 INFO (MainThread) [custom_components.aarlo.binary_sensor] ArloBinarySensor: Motion Backyard created
2022-04-25 07:40:01 INFO (MainThread) [custom_components.aarlo.binary_sensor] ArloBinarySensor: Ding Doorbell created
2022-04-25 07:40:01 INFO (MainThread) [custom_components.aarlo.binary_sensor] ArloBinarySensor: Connected Arlo Hub created
2022-04-25 07:40:01 INFO (MainThread) [custom_components.aarlo.binary_sensor] ArloBinarySensor: Connected Front yard created
2022-04-25 07:40:01 INFO (MainThread) [custom_components.aarlo.binary_sensor] ArloBinarySensor: Connected Driveway created
2022-04-25 07:40:01 INFO (MainThread) [custom_components.aarlo.binary_sensor] ArloBinarySensor: Connected Backyard created
2022-04-25 07:40:01 INFO (MainThread) [custom_components.aarlo.binary_sensor] ArloBinarySensor: Connected Doorbell created

Doing a debug on pyaarlo I could not see much difference between the Pro and Essential cameras EXCEPT for this:

2022-04-25 07:48:57 DEBUG (ArloEventStream) [pyaarlo] mqtt: connected=0
2022-04-25 07:48:57 DEBUG (ArloEventStream) [pyaarlo] topcs=
[('d/8D4FTV-2400-336-120464169/out/cameras/A5620776A1436/#', 0),
 ('d/8D4FTV-2400-336-120464169/out/wifi/#', 0),
 ('d/8D4FTV-2400-336-120464169/out/subscriptions/#', 0),
 ('d/8D4FTV-2400-336-120464169/out/audioPlayback/#', 0),
 ('d/8D4FTV-2400-336-120464169/out/modes/#', 0),
 ('d/8D4FTV-2400-336-120464169/out/basestation/#', 0),
 ('d/8D4FTV-2400-336-120464169/out/siren/#', 0),
 ('d/8D4FTV-2400-336-120464169/out/devices/#', 0),
 ('d/8D4FTV-2400-336-120464169/out/storage/#', 0),
 ('d/8D4FTV-2400-336-120464169/out/schedule/#', 0),
 ('d/8D4FTV-2400-336-120464169/out/diagnostics/#', 0),
 ('d/8D4FTV-2400-336-120464169/out/automationRevisionUpdate/#', 0),
 ('d/8D4FTV-2400-336-120464169/out/audio/#', 0),
 ('d/8D4FTV-2400-336-120464169/out/activeAutomations/#', 0),
 ('d/8D4FTV-2400-336-120464169/out/lte/#', 0),
 ('d/8D4FTV-2400-336-120464169/out/cameras/A562077JA0945/#', 0),

In that list I can see 1 doorbell and 3 cameras which I assume are the Pro cameras which would mean the Essential cameras are not there. Not sure if this is causing the binary sensor not to be there or not. The model for the Essentials is: VMC2030B

twrecked commented 2 years ago

Currently we treat Essential cameras as standalone hubs. You are saying your Essential cameras are attached to your main hub? I think this breaks our current logic.

Can you go through the debug an look for the device lists. It will be shorty after an API call to users/devices?t=xxxx and will contain similar output to the topics list you posted. What you are looking for is the essential camera entity, you can search by name, and can you check its deviceId and parentId? Are they the same?

ehendrix23 commented 2 years ago

Yes, my Essential cameras are connected to my main hub same as my Pro cameras and my doorbell. Model for my Essential is: VMC2030B

deviceId and parentId are different. The parentId provided is the deviceId for my Hub.

Assuming you mean this (removed some items in between)

2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] set:ArloCamera/A5620776A1436/deviceId=A5620776A1436
2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] set:ArloCamera/A5620776A1436/deviceName=Garage 2
2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] set:ArloCamera/A5620776A1436/deviceType=camera
2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] set:ArloCamera/A5620776A1436/parentId=A9W1177AA0144
2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] parent is A9W1177AA0144
2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] set:ArloCamera/A562077JA0945/deviceId=A562077JA0945
2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] set:ArloCamera/A562077JA0945/deviceName=Garage 1
2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] set:ArloCamera/A562077JA0945/deviceType=camera
2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] set:ArloCamera/A562077JA0945/parentId=A9W1177AA0144
2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] parent is A9W1177AA0144

And here is for example one of my Aarlo Pro cameras:

2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] set:ArloCamera/A9X21771A0C2B/deviceId=A9X21771A0C2B
2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] set:ArloCamera/A9X21771A0C2B/deviceName=Front yard
2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] set:ArloCamera/A9X21771A0C2B/deviceType=camera
2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] set:ArloCamera/A9X21771A0C2B/parentId=A9W1177AA0144
2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] parent is A9W1177AA0144

And here is my HUB:

2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] set:ArloBase/A9W1177AA0144/deviceId=A9W1177AA0144
2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] set:ArloBase/A9W1177AA0144/deviceName=Arlo Hub
2022-04-28 18:39:54 DEBUG (SyncWorker_10) [pyaarlo] set:ArloBase/A9W1177AA0144/deviceType=basestation

It does not mention a "parent is xxx" after my HUB which I guess would be expected since there is none. :-)

Let me know how I can help. More then willing to help out, patch code, ... etc. :-)

twrecked commented 2 years ago
diff --git a/custom_components/aarlo/pyaarlo/camera.py b/custom_components/aarlo/pyaarlo/camera.py
index b7128b9..702d0cb 100644
--- a/custom_components/aarlo/pyaarlo/camera.py
+++ b/custom_components/aarlo/pyaarlo/camera.py
@@ -1374,7 +1374,7 @@ class ArloCamera(ArloChildDevice):
                 return True
         if cap in (CONNECTION_KEY,):
             # These devices are their own base stations so don't re-add connection key.
-            if self.model_id.startswith(
+            if self.parent_id == self.device_id and self.model_id.startswith(
                 (
                     MODEL_BABY,
                     MODEL_PRO_3_FLOODLIGHT,

If you feel comfortable can you try this diff? It should enable the sensor when the parent and device id are different.

ehendrix23 commented 2 years ago

Yep, now I can see 2 additional binary sensors for the essential cameras.

twrecked commented 2 years ago

Excellent. I'll push the fix later today.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 365 days with no activity. This issue will be automatically closed within 28 days if there is no further activity.

github-actions[bot] commented 3 weeks ago

This issue was closed because it has been inactive for 28 days since being marked as stale.