grzegorz914 / homebridge-melcloud-control

Homebridge plugin for Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation, publish as dynamic external platform accessory.
MIT License
49 stars 2 forks source link

MELCloud check device state error, AxiosError: Request failed with status code 429 #68

Closed imTHAI closed 4 months ago

imTHAI commented 5 months ago

Hello,

First, thank you a lot for your plugin. I discovered it yesterday and installed it, and all my aircon's were in Apple Home at a glance.

But today I see that my homebridge logs are full of errors like those ones:

[2/5/2024, 6:42:23 PM] [melcloudcontrol] Air Conditioner Bureau check device state error, AxiosError: Request failed with status code 429, check again in 65s.
[2/5/2024, 6:42:23 PM] [melcloudcontrol] Air Conditioner Salle de jeu check device state error, AxiosError: Request failed with status code 429, check again in 65s.
[2/5/2024, 6:42:23 PM] [melcloudcontrol] Air Conditioner Chambre Anakin check device state error, AxiosError: Request failed with status code 429, check again in 65s.
[2/5/2024, 6:42:23 PM] [melcloudcontrol] Air Conditioner Chambre parents check device state error, AxiosError: Request failed with status code 429, check again in 65s.

And all my aircon were "not answering" in Apple Home. So l logged into https://app.melcloud.com and it says:

We have detected excessive traffic from your account, your access to the service has been limited for a few hours.

So I think the plugin does too many requests or too often. Is it a way to limit it ? Did I miss something ?

For now I've disabled it and will enable it again tomorrow.

grzegorz914 commented 5 months ago

Yes, the error is to many requests to MELCloud server, I can add possibility to set manually the polling time for state update. In my environment I don't se e this error yet.

grzegorz914 commented 5 months ago

added in 0.15.0

imTHAI commented 5 months ago

That was fast 🤩 Thank you

mpopof commented 5 months ago

Hello,

First, thank you a lot for your plugin. I discovered it yesterday and installed it, and all my aircon's were in Apple Home at a glance.

But today I see that my homebridge logs are full of errors like those ones:

[2/5/2024, 6:42:23 PM] [melcloudcontrol] Air Conditioner Bureau check device state error, AxiosError: Request failed with status code 429, check again in 65s.
[2/5/2024, 6:42:23 PM] [melcloudcontrol] Air Conditioner Salle de jeu check device state error, AxiosError: Request failed with status code 429, check again in 65s.
[2/5/2024, 6:42:23 PM] [melcloudcontrol] Air Conditioner Chambre Anakin check device state error, AxiosError: Request failed with status code 429, check again in 65s.
[2/5/2024, 6:42:23 PM] [melcloudcontrol] Air Conditioner Chambre parents check device state error, AxiosError: Request failed with status code 429, check again in 65s.

And all my aircon were "not answering" in Apple Home. So l logged into https://app.melcloud.com and it says:

We have detected excessive traffic from your account, your access to the service has been limited for a few hours.

So I think the plugin does too many requests or too often. Is it a way to limit it ? Did I miss something ?

For now I've disabled it and will enable it again tomorrow.

Something happened and Im seeing the same errors as the imTHAI, I havent make any changes to the plugin since I have it installed a few mounts ago. Anything I should do to fix that?

grzegorz914 commented 5 months ago

I have the same error now, looks like MELCLoud server added during latest update some polling request restrictions per minute/hour/day, for now I recommend to stop the plugin and set refresh interval time to 120 sec or more. Wait few hours and enable plugin again. We don’t have any official info what restriction was added but will check it.

richardalow commented 5 months ago

Thanks for fixing so quickly! I'm waiting too - I hope they don't break the amazing automation you can build with this!

grzegorz914 commented 5 months ago

Today the account is unlocked and start working correct. I have set device polling time to 90s and account to 150s, will look what happens.

richardalow commented 5 months ago

I'm hitting 429 errors again already. It seems it's checking more often than it should e.g.

[06/02/2024, 04:53:34] Air Conditioner Guest Suite check device state error, AxiosError: Request failed with status code 429, check again in 180s. [06/02/2024, 04:53:35] Air Conditioner Guest Suite check device state error, AxiosError: Request failed with status code 429, check again in 180s. [06/02/2024, 04:53:48] Air Conditioner Guest Suite check device state error, AxiosError: Request failed with status code 429, check again in 180s.

richardalow commented 5 months ago

I've also set both polling times to 300s but it is checking account every 90s:

Account [redacted], check devices list error, AxiosError: Request failed with status code 429, check again in 90s.

grzegorz914 commented 5 months ago

@richardalow fixed in 0.15.2

Please disable the plugin for few hours then enable it again, after few hours the account will be unlocked.

richardalow commented 4 months ago

Thanks. I created a guest account so I can switch between them until we figure this out.

It seems that when you change the state it kicks off another set of polling. For Master bedroom, I turned it off at 08:30 and have the polling set to 300s. You can see polling every 5 minutes from startup and 5 minutes from when I turned it off:


[06/02/2024, 08:33:34] [melcloudcontrol] Air Conditioner, Master bedroom , debug: State: {
[06/02/2024, 08:35:02] [melcloudcontrol] Air Conditioner, Master bedroom , debug: Info: {
[06/02/2024, 08:35:03] [melcloudcontrol] Air Conditioner, Master bedroom , debug: State: {
[06/02/2024, 08:38:34] [melcloudcontrol] Air Conditioner, Master bedroom , debug: Info: {
[06/02/2024, 08:38:35] [melcloudcontrol] Air Conditioner, Master bedroom , debug: State: {
[06/02/2024, 08:40:03] [melcloudcontrol] Air Conditioner, Master bedroom , debug: Info: {
[06/02/2024, 08:40:04] [melcloudcontrol] Air Conditioner, Master bedroom , debug: State: {
[06/02/2024, 08:43:36] [melcloudcontrol] Air Conditioner, Master bedroom , debug: Info: {
[06/02/2024, 08:43:37] [melcloudcontrol] Air Conditioner, Master bedroom , debug: State: {
[06/02/2024, 08:45:04] [melcloudcontrol] Air Conditioner, Master bedroom , debug: Info: {
[06/02/2024, 08:45:05] [melcloudcontrol] Air Conditioner, Master bedroom , debug: State: {
[06/02/2024, 08:48:37] [melcloudcontrol] Air Conditioner, Master bedroom , debug: Info: {
[06/02/2024, 08:48:38] [melcloudcontrol] Air Conditioner, Master bedroom , debug: State: {```

This will be eating into whatever budget Mitsubishi have set.
iceman60 commented 4 months ago

Same for me yesterday, blocked account.

Today the account is unlocked and start working correct. I have set device polling time to 90s and account to 150s, will look what happens.

Does this polling rates resolved the issue ?

Waiting for unlocking right now...

Again thank you a lot for your awesome plugin !

richardalow commented 4 months ago

My feeling is we'll need to minimise all calls - so only poll rarely (maybe we need to set it much higher, like 1 hour) and only when necessary (so fixing my comment above). You'd lose recency of the temperatures but, at least on my units, they are pretty far from the actual temperature so not very useful. You'd also take longer to realise someone had manually configured a unit with the remote.

grzegorz914 commented 4 months ago

For me it's start working today normally, may be this was accidental issue on server side. Will look.

mpopof commented 4 months ago

Today the account is unlocked and start working correct. I have set device polling time to 90s and account to 150s, will look what happens.

For me it's start working today normally, may be this was accidental issue on server side. Will look.

So the above polling time is working fine for you and you have not experienced another lock?

grzegorz914 commented 4 months ago

@mpopof this setting are working correct for me today, we don't know what a restrictions are set on server side, so need to test it little longer.

grzegorz914 commented 4 months ago

Can anyone with already locket access to MELCloud post the data form _Account file, the file is in /homebridge/melcloud folder. Before post it please remove your credentials data.

fcar12 commented 4 months ago

I can login in the app but I can't do any action (the app logsoff and throws the error). In the homebridge logs I get the error for the plugin. Here is the contents of the file requested @grzegorz914.

{ "ContextKey": "0000", "Client": 000000, "Terms": 1284, "AL": 1, "ML": 0, "CMI": true, "IsStaff": false, "CUTF": false, "CAA": false, "ReceiveCountryNotifications": false, "ReceiveAllNotifications": false, "CACA": false, "CAGA": false, "MaximumDevices": 10, "ShowDiagnostics": false, "Language": 0, "Country": 180, "RealClient": 0, "Name": "John Doe", "UseFahrenheit": false, "Duration": 525600, "Expiry": "2025-02-05T11:51:09.07", "CMSC": false, "PartnerApplicationVersion": null, "EmailSettingsReminderShown": true, "EmailUnitErrors": 0, "EmailCommsErrors": 0, "ChartSeriesHidden": 0, "DeletePending": false, "Throttle": true, "IsImpersonated": false, "LanguageCode": "en", "CountryName": "Portugal", "CurrencySymbol": "€", "SupportEmailAddress": null, "DateSeperator": "/", "TimeSeperator": ":", "AtwLogoFile": "ecodan_logo.png", "DECCReport": false, "CSVReport1min": false, "HidePresetPanel": false, "EmailSettingsReminderRequired": false, "TermsText": null, "MapView": false, "MapZoom": 21, "MapLongitude": 0.0, "MapLatitude": 0.0, "Throttled": false }

Note: this was before 0.15 Update: same result with 0.15

grzegorz914 commented 4 months ago

@fcar12

thanks, you need wait as here: https://github.com/grzegorz914/homebridge-melcloud-control/issues/68#issuecomment-1928941091 described

grzegorz914 commented 4 months ago

@all I have enabled plugin today am 6:00 and my polling time is set to 90s for device and 150s for account. Now 7 hours working without any error. I will report again today later.

fcar12 commented 4 months ago

@fcar12

thanks, you need wait as here: #68 (comment) described

Already turned off earlier today (just went into the container to get the logs), now just waiting... Thanks for the quick support! :)

richardalow commented 4 months ago

It didn't work for me on 180s polling, but I think it depends on the number of units - I have 9. It has been good for almost 5h on 300s polling.

ForkoB commented 4 months ago

"accountRefreshInterval": 120 works fine for me with version 0.15.3

grzegorz914 commented 4 months ago

It didn't work for me on 180s polling, but I think it depends on the number of units - I have 9. It has been good for almost 5h on 300s polling.

You need first wait to be account unlocked then start the plugin again.

richardalow commented 4 months ago

I did, but I got blocked again after 2 hours.

mpopof commented 4 months ago

Im currently set at 120s for device and 150s for account, but giving the above comments I will drop them to 90 device and 120 account if you guys dont get locked out again. I was runnint 0.15.2 until 15mins ago no issues so far with 120/150.

grzegorz914 commented 4 months ago

account refresh time has no matter because account was never locked, locked was only device state check

iceman60 commented 4 months ago

This settings are not working for me, I have only one unit connected in my home but still locked by the server after couple of hours.

grzegorz914 commented 4 months ago

After 10 hours still working correct.

peibol81 commented 4 months ago

With 0.15.3 the problem persist for me. I downgraded to 0.14.5, wait a few hours and worked again

grzegorz914 commented 4 months ago

With 0.15.3 the problem persist for me. I downgraded to 0.14.5, wait a few hours and worked again

Its working because your account was unlocked, You can update to the latest version and set polling time for device to 120 seconds.

mafonso commented 4 months ago

Just linking a discussion about a similar problem with another 3rd party integration. Mitsubishi has allegedly made a decision to crack down on 3rd party integrations, only allowing users to use their (crappy) app.

They way they did it was to severely rate limit requests on a per account basis.

https://github.com/home-assistant/core/pull/109750

grzegorz914 commented 4 months ago

I have just extend possibility to set polling time to 15 min, available right now in 0.15.4

grzegorz914 commented 4 months ago

12 hours test 90/150, 7 devices still working OK.

imTHAI commented 4 months ago

Hello, This morning I had set to 120 seconds and I had no problems all day but I notice tonight that I have the message again in the logs. I’ll pass it at 150 seconds and I’ll see tomorrow. By the way, there are typos or it’s me who is a little lost. In the Air Conditioner tab it is put "Here set the background state refresh time in (sec) for Heat Pump." In the Heat Pump tab it is about ATW device, and in the system tab it's for Air Conditioner. So I may not have configured the right place.

grzegorz914 commented 4 months ago

@imTHAI no worries, it's just typo in UI, will be fixed in the next update

iceman60 commented 4 months ago

If I was Mitsu and wanted to block unofficial API I will be checking the frequency of API call per user. An automation is requesting the server at fixed time. Do you think they do this? Because on my side the 120/150 refresh is not working.

fcar12 commented 4 months ago

Maybe that, some headers check or other methods. https://github.com/home-assistant/core/issues/109728#issuecomment-1930510202

mpopof commented 4 months ago

Everything was working fine, until 10 mins ago when I started to get the lockout error. Just stopped the plugin and will increase the polling time back to 120, I have decreased it to 90 earlier today. My account has not been blocked yet.

edit: my living room AC is blocked now so Ill wait before i start the plugin again

peibol81 commented 4 months ago

For me, 150 works fine. I'm using 0.15.3.

I'm new user here and I would say thank you for all of you. I'm a blind person and I have sone difficulties, but I'm learning fron all of you. And sorry for my english. Greeting fron Spain!

mpopof commented 4 months ago

It had happened again, like 30 mins ago the AC in the living room started throwing errors that i just noticed now, and of course the interface for that AC is blocked hopefully not for long. I have increased the polling time from 120 to 150 and will keep monitoring it. It is super weird how it just works for a while and then all of a sudden starts to throw errors. Anybody else is observing this kind of behaviour?

grzegorz914 commented 4 months ago

After 33 hours all working without any error 120/150. Maybe is different based on MELCloud region.

iceman60 commented 4 months ago

Same for me even at ata=265/account=150 I'm blocked by the system.


{
    "accounts": [
        {
            "language": "7",
            "accountRefreshInterval": 150,
            "ataDisplayMode": 0,
            "ataTemperatureSensor": true,
            "ataPresets": true,
            "ataButtons": [
                {
                    "namePrefix": false
                }
            ],
            "ataRefreshInterval": 265,
            "atwDisplayMode": 0,
            "atwTemperatureSensor": false,
            "atwPresets": false,
            "atwButtons": [
                {
                    "namePrefix": false
                }
            ],
            "atwRefreshInterval": 70,
            "ervDisplayMode": 0,
            "ervTemperatureSensor": false,
            "ervPresets": false,
            "ervButtons": [
                {
                    "namePrefix": false
                }
            ],
            "ervRefreshInterval": 75,
            "disableLogInfo": false,
            "disableLogDeviceInfo": false,
            "enableDebugMode": false,
            "enableRestFul": false,
            "restFulDebug": false,
            "enableMqtt": false,
            "mqttDebug": false,
            "mqttAuth": false
        }
    ],
    "platform": "melcloudcontrol"
}
grzegorz914 commented 4 months ago

@iceman60

please restart plugin and post the data form _Account file, the file is in /homebridge/melcloud folder. Before post it please remove your credentials data.

iceman60 commented 4 months ago

@grzegorz914


  "ContextKey": "0-0000000000000-0",
  "Client": 000000,
  "Terms": 1286,
  "AL": 1,
  "ML": 0,
  "CMI": true,
  "IsStaff": false,
  "CUTF": false,
  "CAA": false,
  "ReceiveCountryNotifications": false,
  "ReceiveAllNotifications": false,
  "CACA": false,
  "CAGA": false,
  "MaximumDevices": 10,
  "ShowDiagnostics": false,
  "Language": 7,
  "Country": 78,
  "RealClient": 0,
  "Name": "Mickey Mouse",
  "UseFahrenheit": false,
  "Duration": 525600,
  "Expiry": "2025-02-06T14:36:54.52",
  "CMSC": false,
  "PartnerApplicationVersion": null,
  "EmailSettingsReminderShown": true,
  "EmailUnitErrors": 1,
  "EmailCommsErrors": 1,
  "ChartSeriesHidden": 0,
  "DeletePending": false,
  "Throttle": true,
  "IsImpersonated": false,
  "LanguageCode": "fr",
  "CountryName": "France",
  "CurrencySymbol": "€",
  "SupportEmailAddress": "tech.clim@fra.mee.com",
  "DateSeperator": "/",
  "TimeSeperator": ":",
  "AtwLogoFile": "ecodan_logo.png",
  "DECCReport": false,
  "CSVReport1min": false,
  "HidePresetPanel": false,
  "EmailSettingsReminderRequired": false,
  "TermsText": null,
  "MapView": false,
  "MapZoom": 17,
  "MapLongitude": 0,
  "MapLatitude": 0,
  "Throttled": false
}```
mpopof commented 4 months ago

Here is mine in case it will help

"ContextKey": "0-0000000000000-0", "Client": 000000, "Terms": 1284, "AL": 1, "ML": 0, "CMI": true, "IsStaff": false, "CUTF": false, "CAA": false, "ReceiveCountryNotifications": false, "ReceiveAllNotifications": false, "CACA": false, "CAGA": false, "MaximumDevices": 10, "ShowDiagnostics": false, "Language": 0, "Country": 37, "RealClient": 0, "Name": "Jon Doe", "UseFahrenheit": false, "Duration": 525600, "Expiry": "2025-02-06T09:13:41.117", "CMSC": false, "PartnerApplicationVersion": null, "EmailSettingsReminderShown": true, "EmailUnitErrors": 1, "EmailCommsErrors": 1, "ChartSeriesHidden": 0, "DeletePending": false, "Throttle": true, "IsImpersonated": false, "LanguageCode": "en", "CountryName": "Bulgaria", "CurrencySymbol": "??", "SupportEmailAddress": "sofia@climacom.com", "DateSeperator": "/", "TimeSeperator": ":", "AtwLogoFile": "ecodan_logo.png", "DECCReport": false, "CSVReport1min": false, "HidePresetPanel": false, "EmailSettingsReminderRequired": false "TermsText": null, "MapView": false, "MapZoom": 20, "MapLongitude": 0, "MapLatitude": 0, "Throttled": false

grzegorz914 commented 4 months ago

Very strange, only check device state is locked, the account not. What have you in log after restart plugin?

iceman60 commented 4 months ago

[2/7/2024, 2:36:54 PM] Registering platform 'homebridge-melcloud-control.melcloudcontrol'
[2/7/2024, 2:36:54 PM] [homebridge-melcloud-control] Loaded homebridge-melcloud-control v0.15.4 child bridge successfully
[2/7/2024, 2:36:54 PM] Loaded 0 cached accessories from cachedAccessories.0E10BC57EAB3.
[2/7/2024, 2:36:54 PM] Homebridge v1.7.0 (HAP v0.11.1) (homebridge-melcloud-control) is running on port 34070.
[2/7/2024, 2:36:55 PM] [homebridge-melcloud-control] ---- Air Conditioner: Salon ----
[2/7/2024, 2:36:55 PM] [homebridge-melcloud-control] Account: 
[2/7/2024, 2:36:55 PM] [homebridge-melcloud-control] Serial:
[2/7/2024, 2:36:55 PM] [homebridge-melcloud-control] Firmware: 37000
[2/7/2024, 2:36:55 PM] [homebridge-melcloud-control] Manufacturer: Mitsubishi
[2/7/2024, 2:36:55 PM] [homebridge-melcloud-control] ----------------------------------
[2/7/2024, 2:36:56 PM] [homebridge-melcloud-control] Air Conditioner Salon check device state error, AxiosError: Request failed with status code 429, check again in 265s.
[2/7/2024, 2:41:22 PM] [homebridge-melcloud-control] Air Conditioner Salon check device state error, AxiosError: Request failed with status code 429, check again in 265s.
[2/7/2024, 2:45:48 PM] [homebridge-melcloud-control] Air Conditioner Salon check device state error, AxiosError: Request failed with status code 429, check again in 265s.
[2/7/2024, 2:50:14 PM] [homebridge-melcloud-control] Air Conditioner Salon check device state error, AxiosError: Request failed with status code 429, check again in 265s.```
grzegorz914 commented 4 months ago

can you try 0.15.5-beta.0 and let me know

iceman60 commented 4 months ago

Lets do this : [2/7/2024, 2:59:46 PM] [homebridge-melcloud-control] Air Conditioner Salon check device state error, TypeError: Cannot read properties of undefined (reading 'EffectiveFlags'), check again in 265s.