apetrycki / daikinskyport

API for accessing a DaikinOne+ Thermostat
60 stars 27 forks source link

Polling Interval Issue #38

Closed spike92856 closed 9 months ago

spike92856 commented 2 years ago

I've been using this for several months now, and just recently Daikin had blocked my API due to excessive API calls. I see that it's set to poll every 10 seconds. Is there a way to adjust this frequency in Home Assistant (every 30 seconds is probably more appropriate)? I don't know enough about GitHub to make code changes myself. It does look like Daikin Cloud will be getting more aggressive in checking API hits, so probably a change that will benefit everyone.

apetrycki commented 2 years ago

I haven't had this problem. How did they inform you? Are you still using the DaikinOne app as well? The Open API info says to poll no less than 3 minutes which is pretty ridiculous. I'm wondering if having the app and HA running is what caused it. Or maybe you make a lot of changes that cause it to update immediately. What did you have to do to get the API to work again? I'll set it to 30 secs for now.

spike92856 commented 2 years ago

Yeah I use the DaikinOne app occasionally (that's how I first noticed that my system was disconnected from Daikin cloud.

I opened a support ticket with Daikin and they are the ones who confirmed my IP was blocked due to excessive traffic. They were also able to restore my access pretty quickly once I contacted them.

I agree that 3 minutes is ridiculous. I did try asking if they've changed anything on their end (more monitoring, lower thresholds) but they wouldn't say. Perhaps this was a one-time incident, but I hadn't touched my system for about a week before I was blocked, and HA had been running without intervention for at least a week before too.

Is there any way to change the polling interval within HA? or by editing a file? (i'm running HA in a docker container). I'm willing to try smaller increments to the polling time to watch for being locked out again if that's possible (and if you want to hold off making this a bigger change until there's confirmation).

apetrycki commented 2 years ago

Line 26 of __init__.py should do the trick: MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=30)

I've been using this integration for like 2 years without issue, so I'm just trying to figure out what happened to make sure it doesn't happen to others. I was thinking maybe there was some automation or the proximity tracking on the app or something.

Since the API says 3mins, I should probably do at least 30secs anyway.

FabianFrank commented 2 years ago

Does Home Assistant not give you any indication if data is being read by a user or an automation? Every 3 minutes should be enough for background use with on demand refreshes when a user or an automation reads the data. I'd limit these to every 10s as well since that's what the Daikin mobile app seems to be doing.

spike92856 commented 2 years ago

Personally one of the biggest things I like about this integration is the history charts. Being able to see the charts of the temperature, fan, heating and cooling activity is very nice. Limiting the polling to 3 minutes would really take away most of that value.

I really wish Daikin had a way to view these charts, but until then this solution has been working great for the most part.

apetrycki commented 2 years ago

There's also the issue if someone changes the thermostat locally, it could be up to 3mins before that registers in home assistant. They could solve all this with not using a crappy cloud service for local polling. That would be the best option.

FabianFrank commented 2 years ago

Totally get that, hence the faster polling when you detect user interaction. For the charts I don't have a really good answer honestly. Agreed that ideally they provide a better API but the other choice they have is to try and lock us out if too many people end up causing issues, ie there is value in playing nice.

sfskipperjim commented 2 years ago

I want to comment here. As noted yesterday, what led me to HA and this port was a changeover of my systems from Ecobee control to Daikin One. The dealer demo'd access from a website that provided basically all the data Ecobee provided with an easy way to export to excel. Turns out this site is currently only for contractors (you pay once for the service and it allows the dealers the ability to remotely monitor your system to detect issues prior to a service call) and is not available to me (even though I effectively paid for it).

I suspect there is either another address the dealer website used or a different set of queries. The graphs demo'd would show either very detailed 24 hr view or less detailed 7 day view. Separate graphs for different information (temperatures on 1 graph, humidity on a separate graph, heating/cooling demand on another, and finally I saw CFM airflow on another)