core icon indicating copy to clipboard operation
core copied to clipboard

Delay of status detection with BTicino LivingNow (NETATMO Integration)

Open dxcoco2 opened this issue 1 year ago • 16 comments

The problem

HASSIO update the state of the switch after a couple of minutes. it's not instantaneous! This creates problems in automations

What version of Home Assistant Core has the issue?

core-2023.9.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

Netatmo

Link to integration documentation on our website

No response

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

dxcoco2 avatar Sep 12 '23 20:09 dxcoco2

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

Code owner commands

Code owners of netatmo 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 netatmo Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


netatmo documentation netatmo source (message by IssueLinks)

home-assistant[bot] avatar Sep 12 '23 21:09 home-assistant[bot]

This is a known limitation. We are working with Netatmo to improve this.

cgtobi avatar Oct 08 '23 10:10 cgtobi

ah ok...I look forward to the update Thanks!

dxcoco2 avatar Oct 09 '23 17:10 dxcoco2

It is very frustrating. I think it must be their system as Google Home has the same problem. Any ETA?

Many thanks Dan

sndrod avatar Oct 13 '23 23:10 sndrod

Please understand that I can't and wont give ETAs.

cgtobi avatar Oct 14 '23 06:10 cgtobi

I have the same problem. it looks like the updates are pushed with some scheduled job instead of synchronously

zaratn avatar Dec 22 '23 12:12 zaratn

As long as Netatmo does not provide webhook events for those devices we are limited by the polling limits of the API. Not much we can do about. You can watch the webhook events sent by Netatmo and send them my way so I can handle them in the integration. But since I don't have such devices nor access to some I can do much.

cgtobi avatar Dec 22 '23 12:12 cgtobi

I see, netatmo doesn't expose the status/temperature change events in their API. Anything I can do to support? I am a software engineer and I could contribute but I guess you can't do anything your side unless netatmo doesn't add the events to the API

zaratn avatar Dec 22 '23 13:12 zaratn

You can monitor the incoming webhook events in HA to see whether Netatmo sends something useful. Usually their documentation is behind.

cgtobi avatar Dec 22 '23 14:12 cgtobi

By looking at the documentation and the logs, I guess the problem might be pointed in this error message: Webhook not registered - https and port 443 is required to register the webhook. It's probably mandatory to access HA via SSL and 443 port, otherwise there's some conflict with the sacurity policies. I'm currently accessing with http and via 8123 port.

zaratn avatar Dec 24 '23 12:12 zaratn

That sounds likely. I wouldn't recommend exposing HA (or anything else) without SSL to the WAN anyway.

cgtobi avatar Dec 24 '23 13:12 cgtobi

What I don't understand is: who said it's mandatory to publicly expose the HA to the interenet in order to use Netatmo Cloud integration? Installing the integration in a local instance is allowed anyway. Or did I get it wrong?

zaratn avatar Dec 24 '23 13:12 zaratn

For those interested in this topic: solved by increasign the frequence of the update. Create a new automation like the following YAML. Be careful to set the name of your Netatmo Home entity accordingly. and... merry xmas!

alias: Netatmo reload every 1min description: "" trigger: - platform: time_pattern minutes: "*" hours: "*" condition: [] action: - service: homeassistant.reload_config_entry target: entity_id: select.zara_home data: {} mode: single

zaratn avatar Dec 24 '23 15:12 zaratn

It is not. But webhooks make it mandatory. They are not required but improve responsiveness in some cases.

cgtobi avatar Dec 24 '23 19:12 cgtobi

For those interested in this topic: solved by increasign the frequence of the update.

Create a new automation like the following YAML. Be careful to set the name of your Netatmo Home entity accordingly.

and... merry xmas!

alias: Netatmo reload every 1min

description: ""

trigger:

- platform: time_pattern

minutes: "*"

hours: "*"

condition: []

action:

- service: homeassistant.reload_config_entry

target:

entity_id: select.zara_home

data: {}

mode: single

I strongly advise against doing this. This violates the Netatmo api polling rate limits.

cgtobi avatar Dec 24 '23 19:12 cgtobi

For those interested in this topic: solved by increasign the frequence of the update. Create a new automation like the following YAML. Be careful to set the name of your Netatmo Home entity accordingly. and... merry xmas! alias: Netatmo reload every 1min description: "" trigger: - platform: time_pattern minutes: "*" hours: "*" condition: [] action: - service: homeassistant.reload_config_entry target: entity_id: select.zara_home data: {} mode: single

I strongly advise against doing this. This violates the Netatmo api polling rate limits.

I referred to a comment I found in the community, saying the polling limit has recently been increased to 500reqs/hr. Indeed the workaround provided above is running since 2 days with no errors. Link to the comment: https://community.home-assistant.io/t/netatmo-poll-refresh-time-is-currently-10-minutes-ideally-should-be-5-minutes/44524/18

zaratn avatar Dec 26 '23 17:12 zaratn

Yes, I am aware of that but forcefully restarting the integration sounds like a pretty uncommon solution though. I am experimenting to make use of that depending on the signup method.

cgtobi avatar Dec 29 '23 11:12 cgtobi

Hi - Just checking if this is actually fixed and #106742 is deployed, as it still takes c. 3mins for HA to see a change made on a physical switch or the netatmo app. Is there something I need to do to get this increased frequency of polling? I just renovated a house around Legrand, so I hope this can be made more reliable! Many thanks.

sndrod avatar Feb 10 '24 11:02 sndrod

Yes, this is released. But to take full advantage you have to use a netatmo dev account. Further improvements on responsiveness can only be achieved when Legrand/Netatmo provide either local access or webhook events for those devices.

cgtobi avatar Feb 10 '24 16:02 cgtobi

Thank you. I have now done all that. Got Nabu Casa. Got my developer account. Set up credentials. Netatmo appears linked and finds devices. However it appears to poll once per minute on the minute and gets a result 4s later - so you can end up waiting for up to 60seconds. Is this normal, or can it be made more frequent? I also found this in debug logging on one of the minutes it did a poll and found a change: 2024-02-11 21:09:00.937 DEBUG (MainThread) [homeassistant.components.netatmo.data_handler] Calls per hour: 74

image Many thanks

sndrod avatar Feb 11 '24 10:02 sndrod

Yes, this is to be expected. We currently don't poll more frequently than once per minute.

cgtobi avatar Feb 11 '24 10:02 cgtobi

Perfect, thank you for confirming and thank you for doing the fix.

sndrod avatar Feb 11 '24 10:02 sndrod