ksya / ha-nefiteasy

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

Connection drops - a lot #318

Open sanderlv opened 1 month ago

sanderlv commented 1 month ago

Is it just me, or does the connection drop a lot (becomes unavailable).

A while ago, the solution was to set an automation to reload the integration.

Recently, I discovered that "there was something solved" and the automation was not recommended anymore.

I rebuilt it to only see (get a notification) when it's unavailable.

And it's a lot (!)

Today, starting at 0.00 it became unavailable for about 10 times...

Screenshot_20240503_084001_Home Assistant.jpg

![Uploading Screenshot_20240503_083954_Home Assistant.jpg …]()

com/ksya/ha-nefiteasy/assets/16528916/d257667e-b3c0-441a-9511-4821ab945878)

Is it just me? If it Nefit?

I need to know because a lot of my automations depend on this one (as a trigger).

Thanks in advance!!!

RobBie1221 commented 1 month ago

It could be your WiFi connection. The Nefit server is also infamous for its instability. It was also not designed for this use. The app creates a connection and as soon as you browse away from the app the connection is dropped. This integration tries to keep a connection alive 24/7, which was never the intended use of the server.

The integration tries to make the best out of it, reconnecting until it is working again.

sanderlv commented 1 month ago

Hm... is it so that when my nefit easy itself disconnects it also is disconnected in HA?

I do see some dis- and reconnects on wifi yes... I have multiple APs. It seems that 2 of them on channel "1" and on on "6" get random connection requests form the nefit easy (same SSID). And nefit easy is the only client (of many) doing this...

Is that familiar?

RobBie1221 commented 1 month ago

No not really. I don’t have a Nefit easy anymore. I had one and also had UniFi AP’s which provide very stable WiFi. I did have some disconnects but in the order of one or two per week. Not that much.

sanderlv commented 1 month ago

Hm... where did you go to (instead of nefit easy)?

RobBie1221 commented 1 month ago

I moved to a new house. It has a complete installation from Itho (Heatpump, Autotemp, Spider).

bsimmo commented 1 month ago

Same here, it never used to be like this. But currently terrible for it. Not WiFi as that's not changed and everything else would be the same.

dhover commented 4 weeks ago

I've the same experience with my Nefit Easy thermostat. The connection to the cloud drops often. Almost every day. The cause is the cloud server which looks not suited well.

jeroen-vd-nl commented 2 weeks ago

I also experienced this, and turned on debug info. It seems like (only) when reconnecting, data is received before the plugin expects this. As a result, the connection is not considered active. This does not happen when the plugin (re)loads the device and its entities in the way it doesn’t reconnect.

As a developer I tried to figure out the issue, but it wasn’t that easy (also because I am better in other languages). Because of that, as well as the finding that a reload works fine, I created a workaround: when Nefit is unavailable more than 3 minutes: reload nefit. To doublecheck I added a message to show the automation ran. It ran twice this week, got no more issues of a not connected Nefit when I wanted to use it.

The automation: (Find your own device ID of course, and use that in the action)

alias: Nefit reload bij unavailable
description: Workaround om Nefit beschikbaar te houden
trigger:
  - platform: state
    entity_id: climate.nefit
    to:
      - unknown
      - unavailable
    for:
      minutes: 3
action:
  - service: homeassistant.reload_config_entry
    target:
      device_id: b907ac7ba856b8e55db9afb7fc494526
    data: {}
  - service: notify.persistent_notification
    metadata: {}
    data:
      message: Nefit herstart
mode: single