twrecked / hass-aarlo

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

Doorbell Silent Mode (Chime and Call) #385

Open krelltunez opened 3 years ago

krelltunez commented 3 years ago

I previously had working toggles for the "silent mode" for the Arlo Video Doorbell's chimes and calls using this add-on. I used this in a "naptime" automation that silences all Echo devices and the Doorbell, as well as my phone notifications. At some point, the toggles for the doorbell stopped working. I am not certain when this happened, so I can't pinpoint it to an HA release. It may have corresponded with one of the latest hass-aarlo updates but I cannot say that with any degree of certainty.

Any idea how I could troubleshoot this? I'm pretty good with Home Assistant but have never done a ton of troubleshooting before. I've got no idea what the next steps might be here, but I'm happy to try!

Also curious whether anyone else is seeing this? I know there may not be many users that have the doorbell.

twrecked commented 3 years ago

Either I broke it or Arlo changed it. I'll take a look.

But if you want to poke around in the debug - see here how to turn it on.

edit: looks like its working here for me

krelltunez commented 3 years ago

I'll see what I can see. When I click the toggle on, it looks as if it worked, but about 2-3 seconds later it goes back to being off.

krelltunez commented 3 years ago

I haven't debugged yet as I'll need to wait until I can devote more attention to that. But, I've played a bit with the HA toggles while staring at the Arlo app on my phone. Some strange behavior to report:

  1. Going into the app, I found that silent mode was already on. This made me think the toggles were partially working, and I was right...
  2. Clicking the "Silent Mode Chime" toggle on does indeed turn on silent mode within Arlo. Since the HA toggle immediately resets to off, though, I'm unable to turn it back off using HA. I have to do that in the Arlo app itself. (Also, note that when I click this toggle in HA, it turns on silent mode for BOTH chime and calls.)
  3. Clicking the "Silent Mode Chime Call" toggle also turns it on. Same issue turning it off though - I need to go into the Arlo app to toggle it off again. (Strangest of all, this toggle turns on silent mode only for the chime, NOT for calls - even though this is the "Call" toggle in HA.)

I've got it switched off for now until I can test further later today. If the above gives you any ideas about what might be going on, please let me know.

Thanks!!

krelltunez commented 3 years ago

I set up debugging and the packet dumping. Unfortunately, I don't see any exceptions or errors/tracebacks. All I see in the log related to the "silent" switches is the following (when I toggle the switches):

2021-02-06 10:45:09 DEBUG (SyncWorker_27) [custom_components.aarlo.switch] Turning on silent mode for Front Door Silent Mode Chime 2021-02-06 10:45:12 DEBUG (SyncWorker_25) [custom_components.aarlo.switch] Turning on silent mode for Front Door Silent Mode Chime Call

There is nothing after those log entries to indicate something went wrong. FYI, since the toggle immediately goes back to "off" the only option I have it to turn silent mode on (i.e., I cannot turn it off as described above).

The packets.dump file is more like trying to read Greek to me, so I'm not sure what to report back.

twrecked commented 3 years ago

I probably need to get some packets from you to work out what is going wrong. It's working great for me (I actually have some of the doorbells).

Before we got to logs, questions:

I'll poke around here some more.

krelltunez commented 3 years ago

Okay... let me see if I can answer those questions:

  1. It's the Arlo Video Doorbell (https://www.arlo.com/en-us/products/arlo-video-doorbell/default.aspx)
  2. I don't know what this means. Where would I find admin mode? Is this in my Arlo account or somewhere else?
  3. Here are the two entity IDs: switch.aarlo_front_door_silent_mode_chime switch.aarlo_front_door_silent_mode_chime_call

Also, just so you know, in the instructions about debugging, I started to not understand things once I got to the "Hiding Sensitive Data" section. If I need to encrypt stuff before sending it, I may need to work that out.

krelltunez commented 3 years ago

Regarding 2 above, I checked in the Arlo app where I granted access to HASS and "Front Door" (my doorbell) is checked and below the device listing I have "Allow Access Rights" turned on. Is that what you meant by "admin mode"?

twrecked commented 3 years ago

Sorry, those docs assume you are comfortable with python and running pyaarlo, the sister software to this.

The logs contain your serial numbers, which isn't particularly sensitive, but it's nice to hide in a public forum. You can paste your logs into here and only I will be able to view them but they will still contain your serial number.

If you can get me the logs from around when you make the doorbell silent and it flips back that would be great.

krelltunez commented 3 years ago

OK, I flipped the toggles at 19:12:33 and 19:12:37 according to the HA log:

2021-02-06 19:12:33 DEBUG (SyncWorker_9) [custom_components.aarlo.switch] Turning on silent mode for Front Door Silent Mode Chime 2021-02-06 19:12:37 DEBUG (SyncWorker_25) [custom_components.aarlo.switch] Turning on silent mode for Front Door Silent Mode Chime Call

And here's the encrypted packets.dump output starting a few minutes before that (I don't see any corresponding timestamps but I don't really know what I'm looking at):

-----BEGIN PYAARLO DUMP----- REMOVED -----END PYAARLO DUMP-----

Please tell me if I did this the wrong way. Thanks!

twrecked commented 3 years ago

You did it perfectly. Unfortunately there was nothing I could see there.

Can you send me the log - it's where you keep your config and call homeassistant.log - from around the time your press the button and it flips back.

krelltunez commented 3 years ago

Sure I'll clean the log to remove non-Arlo stuff and send later this morning. That said, I didn't see anything in the logs related to this except the lines showing that the mode was turned on.

Do you think removing and re-adding the doorbell (and the entities as a result) to HA would do anything? I could do that pretty easily I think.

krelltunez commented 3 years ago

As an aside, I am using your lovelace alpha frontend. That couldn't have anything to do with this, could it?

twrecked commented 3 years ago

The alpha release shouldn't have anything to do with this (shouldn't being the key work) although you've given me a good idea, the ability to mute the chime from the lovelace card.

Can you past your logger config? I want to make sure we've got everything turned on we need.

krelltunez commented 3 years ago

That would be cool!

Here's what I have turned on:

Debugging for Arlo Video Doorbell problem

logger: default: info logs: custom_components.aarlo: debug custom_components.aarlo.switch: debug pyaarlo: debug

Please let me know if I was overzealous excluding stuff I didn't think was applicable.

Thanks!

twrecked commented 3 years ago

That looks good. If you get those logs tidied and sent I'll take a look.

It could be to do with recent changes; we stopped pinging video doorbells so much, I'm just having a hard time working out how that would affect it.

Do you see any log looking like this. The silentMode is the important bit:

2021-02-05 15:03:44 DEBUG (ArloEventStream) [pyaarlo] set:ArloDoorBell/XXXXXXXXX/silentMode={'active': False, 'call': True}

You could try removing and re-adding the aarlo switch piece.

krelltunez commented 3 years ago

Nope, no ArloEventStream logs relating to the doorbell. Only SyncWorker ones. See lines 1069, 1070, 1150, and 1151 for the times when I toggled the switches. What I did was rebooted (after installing the latest version of your add-on), waited a bit, and then hit the toggles.

How do I remove and re-add the switch piece? In the config.yaml file? Anyway, here's my tidied up log (retaining all lines having to do with Arlo):

-----BEGIN PYAARLO DUMP----- REMOVED -----END PYAARLO DUMP-----

twrecked commented 3 years ago

It looks like I'm not getting the packet back I expect. Sorry but we need to turn on more debug.

Add this to your aarlo config:

aarlo:
 verbose_debug: True

And what we are looking for is the packets going in and out just after the "Turning on silent mode for ....". I have the original non-video doorbell and on my system it looks like:

2021-02-07 11:28:56 DEBUG (SyncWorker_33) [custom_components.aarlo.switch] Turning on silent mode for Back Door Bell Silent Mode Chime Call
2021-02-07 11:28:56 DEBUG (SyncWorker_33) [pyaarlo] notify+ sent
2021-02-07 11:28:56 DEBUG (ArloBackgroundWorker) [pyaarlo] post+response running
2021-02-07 11:28:56 DEBUG (ArloBackgroundWorker) [pyaarlo] request-url=https://myapi.arlo.com/hmsweb/users/devices/notify/XXXXXXXXXXX
2021-02-07 11:28:56 DEBUG (ArloBackgroundWorker) [pyaarlo] request-params=
{'action': 'set',
 'from': '3952NM-336-7759821_web',
 'properties': {'silentMode': {'active': True, 'call': True}},
 'publishResponse': True,
 'resource': 'doorbells/XXXXXXXXXXX',
 'to': 'XXXXXXXXXXX',
 'transId': 'web!XXXXXXXXXXX'}
2021-02-07 11:28:56 DEBUG (ArloBackgroundWorker) [pyaarlo] request-headers=
{'xcloudId': 'RMKGBFKM-1005-140-6162386'}
2021-02-07 11:28:56 DEBUG (ArloBackgroundWorker) [pyaarlo] request-end=200
2021-02-07 11:28:56 DEBUG (ArloBackgroundWorker) [pyaarlo] request-body=
{'success': True}
2021-02-07 11:28:56 DEBUG (ArloEventStream) [pyaarlo] packet-in=
{ 'action': 'is',
  'from': 'XXXXXXXXXXX',
  'properties': {'silentMode': {'active': True, 'call': True}},
  'resource': 'doorbells/XXXXXXXXXXX',
  'to': '3952NM-336-7759821_web',
  'transId': 'web!XXXXXXXXXXX'}
2021-02-07 11:28:56 DEBUG (ArloEventStream) [pyaarlo] sending doorbells/XXXXXXXXXXX to XXXXXXXXXXX
2021-02-07 11:28:56 DEBUG (ArloEventStream) [pyaarlo] Back Door Bell DOORBELL got one doorbells/XXXXXXXXXXX
2021-02-07 11:28:56 DEBUG (ArloEventStream) [pyaarlo] set:ArloDoorBell/XXXXXXXXXXX/silentMode={'active': True, 'call': True}
2021-02-07 11:28:56 DEBUG (ArloEventStream) [pyaarlo] Back Door Bell: child got doorbells/XXXXXXXXXXX event **
2021-02-07 11:28:56 DEBUG (ArloEventStream) [pyaarlo] Back Door Bell: got doorbells/XXXXXXXXXXX event **
2021-02-07 11:28:56 DEBUG (ArloEventStream) [pyaarlo] doorbells/XXXXXXXXXXX:XXXXXXXXXXX bounded device!
krelltunez commented 3 years ago

OK, I'll turn that on and reboot. I expect that I'll get back to this later this evening.

Thanks for all your help. Hopefully we can figure this out!!

krelltunez commented 3 years ago

Bad news - I'm obviously not the expert here, but I see the request going out, but I don't see the packet coming back in. You'll see that I toggled both switches and neither got back anything. Included ~500 lines for good measure but I don't see any "packet-in" events related to the doorbell or silent mode.

So... should I remove/re-add? What do you recommend, removing the doorbell completely (from the HA Arlo user I set up) and re-adding it? Or modifying my config.yaml somehow (perhaps to remove the "doorbell_silence" line)?

switch:

Here's the log:

MOVED TO FILE Log.txt

twrecked commented 3 years ago

I can see the issue. We're not getting the response I'm expecting back. I'll take a look at how to fix it.

I guess something changed, hence not seeing this before.

You don't need to remove the switch, the problem is my code.

jesserockz commented 3 years ago

I don't use silent mode but I can give it a try when I have some time.

Also @krelltunez you might want to paste the encrypted text into a file and upload it into your comment. It takes ages to scroll past on mobile =)

twrecked commented 3 years ago

@jesserockz Thanks for taking a look; the problem @krelltunez is seeing is the silentMode never comes back from Arlo. I guess I'm looking for confirmation. I have a fix that looks good just want to make sure.

jesserockz commented 3 years ago

Ok here is what I see:

Change ...silent_mode_chime to be on and it goes on -> off -> on - I think just a delay in server feedback as it turns on live in the mobile app at the same time as the "second" on. ...silent_mode_chime_call turns on at the same time as the "second" on as well.

If I switch the silent switch in the Arlo app then the switches in HA toggle at the same time to the correct state.

So for me the switches are working as intended.

I have the AVD2001 - Wire Free Doorbell connected directly to WiFi

krelltunez commented 3 years ago

Also @krelltunez you might want to paste the encrypted text into a file and upload it into your comment. It takes ages to scroll past on mobile =)

Thanks for the tip. I'm new to providing logs so pardon the bad form!

Change ...silent_mode_chime to be on and it goes on -> off -> on - I think just a delay in server feedback as it turns on live in the mobile app at the same time as the "second" on. ...silent_mode_chime_call turns on at the same time as the "second" on as well.

Difference is mine goes on -> off and never comes back on. And, of course because it doesn't show as on in HA, toggling it in the Arlo app does not show anything in HA.

twrecked commented 3 years ago

It should be fixed in 0.7.0.10 by pr #386

krelltunez commented 3 years ago

I was SO excited... alas, I'm still seeing the same - the toggle goes on -> off and stays off, despite the fact that it did actually turn on silent mode on the doorbell.

Anything I can do? Obviously if this is working for you and others, mine must be some glitch specific to my setup.

twrecked commented 3 years ago

Can you send me the logs around the time you silence the chimes. I guess I must have missed something.

krelltunez commented 3 years ago

Here you go - starting with the switch toggle and including everything afterwards for a couple minutes. Please let me know if you need more. Thanks. HA Log Encrypt.txt

twrecked commented 3 years ago

It's doing what I expect it to do; I must have missed a step. Leave it with me.

I noticed the switch was missing some debug which I've added in. This might be a bit of a grind finding out what is happening but this should give me a better idea. I'll push a new update.

krelltunez commented 3 years ago

Just installed 0.7.0.11 and gave it another shot. Same behavior, toggle doesn't stay on.

EDIT: Adding logs.

HA Log Encrypt.txt

twrecked commented 3 years ago

Thanks. There is definitely something strange going on. We both get the same packet and handle it differently. I think something isn't getting set up correctly.

edit: found it, I went to the hard work of passing the packet back then I got it wrong... Give me a few minutes.

twrecked commented 3 years ago

Hopefully this 0.7.0.12 will fix it. I wasn't passing the packet back correctly so the switch didn't know what to do with it.

krelltunez commented 3 years ago

BINGO! It works!!!

twrecked commented 3 years ago

Excellent!

dejan2101 commented 3 years ago

Don't know if there is any connection but i'm getting this log error:

Logger: homeassistant.components.binary_sensor Source: custom_components/aarlo/pyaarlo/doorbell.py:112 Integration: Binary sensor (documentation, issues) First occurred: 10:14:24 PM (2 occurrences) Last logged: 10:14:24 PM

Error adding entities for domain binary_sensor with platform aarlo Error while setting up aarlo platform for binary_sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 315, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 506, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 531, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 323, in _async_write_ha_state attr.update(self.device_state_attributes or {}) File "/config/custom_components/aarlo/binary_sensor.py", line 126, in device_state_attributes attrs['chimes_silenced'] = self._device.chimes_are_silenced File "/config/custom_components/aarlo/pyaarlo/doorbell.py", line 112, in chimes_are_silenced return self._load(SILENT_MODE_KEY).get(SILENT_MODE_ACTIVE_KEY, False) AttributeError: 'NoneType' object has no attribute 'get'

Any idea what am i doing wrong? Sorry if it's not connected to that bug, didn't want to open new issue if it is :)

twrecked commented 3 years ago

That's something I just added... I'll take a look.

twrecked commented 3 years ago

Can you try v0.7.0.13

Thanks.

dejan2101 commented 3 years ago

It does set up binary sensors now, thanks! But now they are not showing the right state

twrecked commented 3 years ago

Which sensors? Just the ding ones?

dejan2101 commented 3 years ago

the motion

twrecked commented 3 years ago

What is it showing?

dejan2101 commented 3 years ago

It's off (clear) all the time, even when there is motion (and a video in app).

twrecked commented 3 years ago

This is the doorbell device? Because if so, I took out some code that was generating false positives but I guess I needed to refine it instead.

I'll get a fix in later.

twrecked commented 3 years ago

Do you know what firmware you are on?

dejan2101 commented 3 years ago

Yeah, it's doorbell. FW 1.14.0.0_809_9259536_c33dc90

PS oh, and i can't seem to be able to switch modes on alarm control panel in HA - but it does switch in HA when i change it in the app

twrecked commented 3 years ago

I'll correct it and push the fix later.

I'm on 1.2; so that may explain the difference.

twrecked commented 3 years ago

Can you try 0.7.0.14; I've restored the connectionState is a motionDetected code.

krelltunez commented 3 years ago

Hi again. I'm using 0.7.0.14 and I want to report back on some behavior.

As an aside, I'm able to arm/disarm the panel within HA and it's immediately reflected in the Arlo app.

Regarding the doorbell chime/call, some observations:

  1. I am able to control it via HA. On/off is working now (but see below).

  2. If I toggle it in the Arlo app, it does not reflect in HA. This includes turning it on or off; no matter what, the state of the toggles in HA remain unchanged. For me, this is OK because I seldom go into the Arlo app (thanks to how awesome this integration is!). But others might be having a similar issue.

  3. I'm confused about the way the toggles work. I suspect these are NOT issues with HA , but rather with Arlo.

Pictures of the various Arlo settings screen are below if anyone is smarter than me (not hard to be that) and can figure this out.

Thanks.

Screenshot_20210210-104650_Arlo Screenshot_20210210-104719_Arlo Screenshot_20210210-104912_Arlo

twrecked commented 3 years ago

To quickly address point 2 - I'm seeing updates in HA when I change settings in the Arlo app. This might also explain why your button stopped working, you used to receive them and don't any more. One way to check this is to use your HA Arlo account on the my.arlo.com website and see if toggling the chimes in the Arlo app affects that.

It it does work on the website it probably means I need to update my code.

As for the other pieces, I'll take a look. At first glance it does look like the switches are wrong, I'll take a look at them.

edit: I think the underlying protocol has changed, I'll take a look into it.

twrecked commented 3 years ago

I just pulled #389 and it's in 0.7.0.15.

The underlying code wasn't lining up with Arlo so I've fixed it. The naming of the switches isn't great but I'm not going to change that so I don't break any installs.

But it's working great for me - either setting in HA or the Arlo app. Let me know how it goes.