Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce MELCloud poll frequency to avoid throttling #109750

Merged

Conversation

vilppuvuorinen
Copy link
Contributor

@vilppuvuorinen vilppuvuorinen commented Feb 5, 2024

Last ditch effort to load shed at the expense of user experience to keep the lights on. Let's keep out fingers crossed.

Breaking change

Proposed change

Reduce poll rates to avoid throttling. The user effect takes a hit here, but I don't want to go back to using the TV remote thingy😢

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

Last ditch effort to load shed at the expense of user experience to keep
the lights on. Let's keep out fingers crossed.
Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @vilppuvuorinen 👍

../Frenck

@frenck frenck merged commit 189f3da into home-assistant:dev Feb 5, 2024
19 checks passed
@diederik-maes
Copy link

If reducing polling requests fixes the issue, how do you reduce the polling requests?

@mupfpilou
Copy link

mupfpilou commented Feb 6, 2024

I am impacted by this Mitsubishi change.
Like others, I was even unable to log in into the app for few hours starting 3PM CET
I disabled Melcloud integration and now my app access is working again

I then tried to update the refresh interval, but everything is still unavailable in HA
Though, logs are showing fetching failed only with this URL :

Error requesting melcloud_custom-xxx data: 429, message='This request has been throttled due to an excessive amount of traffic to our service.', url=URL('https://app.melcloud.com/Mitsubishi.Wifi.Client/EnergyCost/Report')

Dont you think it might be worth to rate limit this call separately ?
Like if the energy report could be rate limited more than the "usual" device update ?

@zaniyah
Copy link

zaniyah commented Feb 6, 2024

Might it be worth making the polling intervals user-settable, with the proposed changes as defaults instead? Include a warning in the docs about setting them too high. This is bound to happen again.

Copy link

@zaniyah zaniyah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just increases the interval between queries to the Melcloud app interface, and should not break anything though as noted in the comment it will reduce responsiveness and stats granularity. However, making the times user-configurable would be preferable longer term (until Mitsubishi change something more substantial) as this is a change that is likely to have to happen again.

@joostlek
Copy link
Member

joostlek commented Feb 6, 2024

You can already do that, please checkout the docs for the homeassistant.update_entity service

@zaniyah
Copy link

zaniyah commented Feb 6, 2024

You can already do that, please checkout the docs for the homeassistant.update_entity service

Yes, you can if you are confident enough to delve into the YAML, but a lot of people using this now are not editing things that way. Maybe I should be more specific, but I was trying to keep it short. There is no GUI option to change this nor is it highlighted in anyway in the UI.

@joostlek
Copy link
Member

joostlek commented Feb 6, 2024

That's incorrect. That doesn't work via YAML, that works via an automation. You can disable polling on an integration to then add your own polling rate via the integration.

@zaniyah
Copy link

zaniyah commented Feb 6, 2024

Fine but that's still non-trivial and beyond a lot of people. You only have to look at the comments on the issues related to this to see that. Having a simpler way to configure the polling interval would let a lot of people workaround it without needing detailed instructions or a change to the integration itself.

@joostlek
Copy link
Member

joostlek commented Feb 6, 2024

We're not going to do nor allow that. This approach is already available, documented and applicable to almost every integration. This approach gives the user way more freedom to poll whenever they want.

@frenck
Copy link
Member

frenck commented Feb 6, 2024

We don't allow for configuring polling intervals in the UI.

I won't go into the details on all the reasons why, as that will be an extensive list. But there are very good reasons for that. Yes, we do hear the requests for it; no, it has been decided it will not be allowed.

../Frenck

@diederik-maes
Copy link

Hi Frenck,

Do you propose that we roll back to 11.4 or is a solution in progress?
Personally I have quite some automations using MELCloud. That's why I'm asking. Thanks in the meantime for your incredible reactivity.
Tot hoors.

@joostlek
Copy link
Member

joostlek commented Feb 6, 2024

This is an server side issue

@coolkeve
Copy link

coolkeve commented Feb 6, 2024

I can see that vilppuvuorinen is no longer codeowner ?
It feels very badly this situation.

@frenck
Copy link
Member

frenck commented Feb 6, 2024

@coolkeve Well, that happens and is fine. The upstream repository he has archived in 2020 already. Anybody can contribute code 🤷

But let's not discuss stuff like that on a PR, as those should be focussed on the review of the change. 😄

../Frenck

@github-actions github-actions bot locked and limited conversation to collaborators Feb 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.