jeatheak / Mitsubishi-WF-RAC-Integration

WF-RAC homeassistant integration
MIT License
101 stars 19 forks source link

Airco not responding in Homeassistant #15

Closed jeatheak closed 1 year ago

jeatheak commented 1 year ago

Sometimes the airco is not responding to the api requests anymore and the sensors in homeassistant aren't updating anymore.

A simple restart ussually will fix this problem.

mcheijink commented 1 year ago

I have looked through your code, and I noticed that not all sensors have the throttling functionality. And on my own system, I will be running an experiment to retry a post request when it returns an error code 104. See https://github.com/jeatheak/Mitsubishi-WF-RAC-Integration/commit/528ed45a95284d273f0592ca22a82546bbc197a4 This experiment is hacked together, so there is definitely a better way to react to this error code.

jeatheak commented 1 year ago

Ok nice.

Let me know how it goes. If it is working I will try to implement it in the codebase

theawesomestrob commented 1 year ago

I'm not sure if this will directly fix this issue, but FYI in #20 I implemented a simple mutex + delay to stop home assistant sending requests to an aircon unit too quickly/in parallel, maybe that will help?

theawesomestrob commented 1 year ago

@jeatheak do you use static IPs for your airco device(s), or dynamic?

I realised (while messing about with my DHCP server) that if the airco's IP changes, home assistant (or the integration) doesn't seem to notice, so eventually the device goes unresponsive in HA.

From the code it looks like the zeroconf config flow thing should update the IP (and I had a very brief look into the home assistant core code, where it appears to call some kind of reload function if the data changes), but I guess something's not updating somewhere along the line…

I'm going to dig into it a bit more (I've got one of my aircon units set up with a 10-minute DHCP lease now for testing) but I wondered if maybe this could be the same problem you were seeing with it sometimes not responding?

kababoom commented 1 year ago

@jeatheak I'm still using your initial non HA version with a simple loop, this loop did hang occasionally on the device with weak wifi reception. With some debugging I noticed that the post did not timeout unless you specify a timeout value.

x = post(url, json=myobj, timeout=30)

Note, only looked into the new code briefly so not sure if it's relevant....