home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.63k stars 30.4k forks source link

Nuki integrations drains battery #98306

Closed martindybal closed 9 months ago

martindybal commented 1 year ago

The problem

After I enabled Home Assistant integration with Nuki bridge, the lock started to discharge significantly faster than before.

What version of Home Assistant Core has the issue?

2023.8.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Nuki

Link to integration documentation on our website

https://www.home-assistant.io/integrations/nuki/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @pschmitt, @pvizeli, @pree, mind taking a look at this issue as it has been labeled with an integration (nuki) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `nuki` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign nuki` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


nuki documentation nuki source (message by IssueLinks)

engel75 commented 1 year ago

My battery was at 58% seven days ago (when I added the Nuki integration) and is now at 34%.

martindybal commented 1 year ago

I have a Nuki power pack, it has drained 9% in the last week.

cmatte commented 1 year ago

+1 I also have a battery pack and it drained 50% in two weeks, at the point that I almost got locked out!

pree commented 11 months ago

That's interesting, did you experience this also with previous versions? Do the callbacks work correctly for you (instant update in Home Assistant)?

martindybal commented 11 months ago

@pree I have to disable HA integration. Should I try something?

yan14 commented 10 months ago

Same here. I texted nuki about my battery drain problem and they said, that it's because of the home assistant integration.

pree commented 10 months ago

That's weird, could you confirm if the webhook is working for you? The Integration was developed with the recommendations from Nuki, this seems to be some bug with their Bridge, as we're already minimizing the calls we make to the Bridge HTTP API. Which version of the Lock are you using? I'm using the official HA Integration on my Lock + Opener and the batteries last way over a year.

If the bridge is sending callbacks HomeAssistant doesn't poll it for a while, maybe we could even increase this amount.

Do you have multiple Locks, or a Lock and an Opener?

yan14 commented 10 months ago

I have, two locks and one opener. The opener is wired. The locks are a V1 and V3 (not a pro). The V1 is working with normal batteries, the V3 has an official battery pack. It seems that the V1 has no battery issues, the V3 has.

pree commented 10 months ago

Thanks for the info! Which Bridge Version are you using?

yan14 commented 10 months ago

I think you mean the Firmware: 1.26.0

pree commented 10 months ago

Hardware revision would also be good, did you get a new bridge with the V3?

yan14 commented 10 months ago

Nope, it's the old one. As far as I know, the first digit of the Firmware Version is the Hardware revision.

martindybal commented 10 months ago

@pree can you provide more information about the webhook? It is mentioned in the documentation lightly, but there is no procedure on how to set up webhook. Also, the device class is local polling instead of local push. Of course, that would be the obvious reason for the rapid discharge.

https://www.home-assistant.io/integrations/nuki/

For faster updates, the callback function of the Nuki bridge can be used. This requires your Home Assistant to be reachable via HTTP by the Nuki bridge, as HTTPS is not supported by the Nuki bridge.

pree commented 10 months ago

The webhook has been in Home Assistant since version 2023.04.1. It's set up automatically using Home Assistant's webhook feature. The easiest to test this is to see if events from the lock are instant in Home Assistant (opening the door for example).

The integration goes back to polling when it doesn't receive an event from the Bridge after some while. The library below is programmed to reduce battery drain by not directly polling the lock but letting the Bridge answer from cached data.

Haven't gotten a lot of battery drain issue reports, so it might be related to a specific version of the lock or lock - bridge combo. Are you also using a V3 Lock?

martindybal commented 10 months ago

Oh, ok. So why is class local polling? In my case update takes 15seconds and 20seconds for the second try. How fast is polling by default?

On Mon 11. 12. 2023 at 20:25 Pascal Reeb @.***> wrote:

The webhook has been in Home Assistant since version 2023.04.1. It's set up automatically using Home Assistant's webhook feature. The easiest to test this is to see if events from the lock are instant in Home Assistant (opening the door for example).

The integration goes back to polling when it doesn't receive an event from the Bridge after some while. The library below is programmed to reduce battery drain by not directly polling the lock but letting the Bridge answer from cached data.

Haven't gotten a lot of battery drain issue reports, so it might be related to a specific version of the lock or lock - bridge combo. Are you also using a V3 Lock?

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/98306#issuecomment-1850737662, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2KHQ3YN6MSY26JTQOCYZDYI5MY7AVCNFSM6AAAAAA3N7JSMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQG4ZTONRWGI . You are receiving this because you authored the thread.Message ID: @.***>

pree commented 10 months ago

That probably got forgotten, I think we should change this. Polling is configured to check every 30s.

martindybal commented 10 months ago

@pree I make a check. There was two endpoints on Nuki bridge http://NukiIP:8080/callback/list?token=TOKEN to Home assitant. I removed both of them and add Nuki to home assistant again. I'll let you know in few weeks. http://NukiIP:8080/callback/remove?token=TOKEN&id=WebhookId

image
martindybal commented 9 months ago

So there is an update. Currently it drain around 2% of battery per week. So it's looks fixed.

I'll close, then. If anyone has a similar problem, the commands above should fix the problem. @pree Thank you and please update the documentation.

image