ksya / ha-nefiteasy

Nefit Easy connection for Home Assistant
74 stars 31 forks source link

Lots of disconnects #90

Closed sanderlv closed 1 year ago

sanderlv commented 3 years ago

Recently (1-2 weeks?) I have a lot of disconnects: image

image

but via my app all is fine?

What can be the issue?

liquid-motion commented 3 years ago

I'm experiencing exactly the same. The cant-connect issues are completely back since two weeks. NEFIT app directly is always working.

ksya commented 3 years ago

Maybe they are using a new server.. Someone needs to check the app again using Wireshark

RobBie1221 commented 3 years ago

One thing that is different between app and HA is that HA actively polls the endpoints to fetch all data. The app is more passive, if you change between tabs it'll update. Also it gets push updates when someone else changes something. Also we don't know how the app would handle disconnects. It could experience the same thing but not complain about it. Maybe that's the best approach for this integration as well, if a disconnect is experienced simply reconnect and don't log these as error but as debug info. The Shelly integration kind of does the same, when a device is offline it doesn't complain, once it's online again it simply reconnects.

lukepeeters commented 3 years ago

My disconnect issues started when I updated to version 0.2.1. Before I was on 0.1.0 and saw a disconnect maybe once every few days, now there is a disconnect every 10-20 minutes.

RobBie1221 commented 3 years ago

Nothing has changed in the connection area, so I can't explain that. Some entities were added, but should be disabled by default. You could try to disable some unused entities to see if it improves?

liquid-motion commented 3 years ago

I haven't upgraded yet, because I'm on holiday and I don't want the update to mess things up, when I'm not around. Better safe than sorry.

So I think it's safe to say these problems are not related to the new version in my case. The problems started more or less the same time as the new version was released. Coincidence?

RHAD1969 commented 3 years ago

I'm also experiencing the same connection error. Nefit app works fine, HA connect error.

RobBie1221 commented 3 years ago

I'm also experiencing the same connection error. Nefit app works fine, HA connect error.

If you can't connect at all, please make a separate issue. That seems different than what is described here.

Also, info like 'the app is working fine' does not add useful info. Please keep the app open for a longer time and check with network analysis tools like wireshark whether it doesn't also disconnect. The fact that no error or warning is presented doesn't mean anything.

ksya commented 3 years ago

I used to have the Bosch server added to uptime robot and 9 of 10 times the Bosch server just went down when I got a disconnect.

RobBie1221 commented 3 years ago

I would suspect the same thing. I think the app silently reconnects...

That's probably what we should do here as well, reconnect and add some debug logging, but don't log as error.

RobBie1221 commented 3 years ago

We are also keeping the connection alive way longer than the Nefit app does, so comparing behavior of app and integration is like comparing apples and pears.

adr1200c commented 2 years ago

I would be happy to have disconnects. mine is not connecting @ all.

Maybe some more clarification on the 3 credential like on the creation of the integration window. serial # is the serial # of my installation. access code ?? is it my account name? or the passcode for the CV. password. of which is this the password ? the password of my Bosch/nefit account?

also cannot figure out to which domain the connect is ? no where I see in the code any url like www.netfiteasy.com or else configured.

RobBie1221 commented 2 years ago

I would be happy to help, but could you open a new issue?

adr1200c commented 2 years ago

have found the correct settings for serial, passcode/key and password. it is working ok now, sorry for this.

thanks for the quick response.

bsimmo commented 2 years ago

I only get error show up when I use the Phone App, using it blocks anything else (and vice versa), the phone app takes a lot longer to connect waiting for a slot to get access to the servers first. Is there anyway to slow down the polling, I see no need for it to be as constant as it is. Other than energy usage, but that doesn't need to be constant either. Room tamp doesn't change much and boiler on/off maybe the only thing, even temp change done via an app or the console doesn't need a quick update as well you know it's changed.

Basically unless it cannot regularly reconnect then it's not a problem, only then flag it up a 'lost connection'.

Just my thoughts.

RobBie1221 commented 2 years ago

I agree, as mentioned above, disconnect is logged as critical error, but as long as reconnect works it shouldn't do that. I'm working on refactoring the init code, there are some more things that could be done more in line with how HA works nowadays.

There is an open issue to make an option flow, once I get to that we could make the update rate configurable. Now it's 60 seconds by the way, not crazy fast. The more entities you have enabled though, the more data is will fetch.

ksya commented 2 years ago

Note that the Nefit Easy can also be broken. That is how it started with mine. I could also see the disconnects in the router.

RobBie1221 commented 2 years ago

But that's something out of our control right? Is there something else that can be done other than simply reconnect?

ksya commented 2 years ago

Exactly that's the ony thing we can do

RobBie1221 commented 2 years ago

Indeed, my proposal was to do it more silent not to fill HA with errors logs. Could perhaps be added as debug log.

By the way, I think you got some mails from Github workflow right? Sorry for that :) I was trying something, which worked in the end after a few attempts.

RobBie1221 commented 1 year ago

I refactored the connect/disconnect code to handle disconnects more gracefully. Instead of generating a persistent notification, it will now just silently try to disconnect.

I published a pre-release, feel free to test it. If nothing breaks in my own setup the coming weeks, I'll promote it to release.