suaveolent / ha-hoymiles-wifi

Home Assistant custom component for Hoymiles DTUs and the HMS-XXXXW-2T microinverters
MIT License
96 stars 5 forks source link

Since 0.1.3 it frequently loses connection to DTU #14

Closed julianxv closed 3 months ago

julianxv commented 4 months ago

Since the 0.1.3 Update it looses frequently after a few hours the connection the DTU. I can only force a reconnect by restarting the whole Home Assistant System.

I just started debug logging and will update this issue when i got the first logs.

Home Assistant core 2024.2.2 on a rapsberry Pi 3B. Connected to a HMS800W-2T

suaveolent commented 4 months ago

Thanks for reporting.

This is most liekely related to #11 and #12.

A temporary fix is already pushed to main branch. I will release a new version today or tomorrow.

julianxv commented 4 months ago

Thanks for the quick reply and fix.

thitcher commented 4 months ago

Same problem here. But I don't get the inverter back with a restart of HA.

Holger2024 commented 4 months ago

For me it even kicked the inverter from the wireless network and I had to reset via hotspot of the inverter. Then it worked for a day with a disconnect every couple hours. Since this morning it is back to disconnect every couple minutes (even though I manually added the wait time from the last change in HA).

I have a feeling that the inverter is somehow overloaded - e.g. the ping time randomly varies between 5ms to 150ms every ping.

suaveolent commented 4 months ago

Newest version local looks good. I will push a new release this evening.

suaveolent commented 4 months ago

v0.1.4 just released, please reopen issue if problem still persists

Holger2024 commented 4 months ago

It worked fine for 1.5 days, but at 8 am this morning the disconnects started again.

image

Is it possible that you assume a complete reboot within 24hours, because I'm constantly operating the inverter from batteries?

suaveolent commented 4 months ago

That is very curious. Maybe it is a bug in the inverter firmware?

Yes, my inverter reboots at night, since I do not have any batteries. I implemented a "Restart" button, can you check if the restart fixes your problem?

thitcher commented 4 months ago

Same here, worked fine yesterday, today it won´t connect correct.

grafik

thitcher commented 4 months ago

That is very curious. Maybe it is a bug in the inverter firmware?

Yes, my inverter reboots at night, since I do not have any batteries. I implemented a "Restart" button, can you check if the restart fixes your problem?

Tested the restart button, no sucess. It came back for a couple of seconds and then disconnected again

grafik

EDIT: My colleague uses the same constellation, he has no problems! He uses the sw version V00.01.11, my inverter shows V00.01.05

EDIT: I see the same behaviour iat the webportal , so I think it is a Bug in the ....05 SW version. Will try to update to .....11

suaveolent commented 4 months ago

Great, please let me know if this fixes your problem.

The update process can be quite cumbersome, if you are having problems going via the official ways, you can try to update via the hoymiles-wifi CLI tool:

https://github.com/suaveolent/hoymiles-wifi

thitcher commented 4 months ago

Great, please let me know if this fixes your problem.

The update process can be quite cumbersome, if you are having problems going via the official ways, you can try to update via the hoymiles-wifi CLI tool:

https://github.com/suaveolent/hoymiles-wifi

Unfortunately, I´m not so good in this things, I think the update can´t be done via HA? So I have to wait till I´m back@home

suaveolent commented 4 months ago

I'm working on integrating the update mechanim, but unfortunately this is not yet supported in HA. You can try updating via the Hoymiles Cloud, though: https://global.hoymiles.com/platform/login

thitcher commented 4 months ago

I'm working on integrating the update mechanim, but unfortunately this is not yet supported in HA. You can try updating via the Hoymiles Cloud, though: https://global.hoymiles.com/platform/login

Thats what I try, but the Inverter shows Offline, so I can´t do an update. Somentimes it is online, when I have luck and hit that minute, I try to update it. Otherwise I have to do it this afternoon vie Smartphone and direct connection.

suaveolent commented 4 months ago

Yes, that seems like a good idea. Alternatively you can try temporarily disabling the HA integration to see if the inverter bounces back and then try the update again via Hoymiles cloud.

thitcher commented 4 months ago

I had luck! Update to XX.XX.11 was successful. Now, it seems to be stable: In the meantime I searched the web and found this article: []https://mikrowechselrichter.eu/blogs/neuigkeiten/hoymiles-hms-800w-2t-verbindungsprobleme-wlan-server-s-miles-cloud

Maybe the Problem is this:

Was ist die Ursache des Problems?

Hoymiles hat bei der Entwicklung der Firmware - entgegen jedem normalen Vorgehen in der Softwareentwicklung - feste IP-Adressen für DNS-Server hinterlegt.

Was heisst das?

Der Mikrowechselrichter versucht, über das Internet auf die Cloud zuzugreifen. Diese ist unter der Domain dataeu.hoymiles.com erreichbar.

Um die Adresse dataeu.hoymiles.com in eine "maschinenlesbare" IP-Adresse zu übersetzen, braucht es einen sog. DNS-Dienst. Normalerweise übernimmt diese Funktion der eigene Internetanbieter automatisch für jeden Internetanschluss.

Hoymiles hat statt dessen aber die Verwendung eines eigenen DNS-Dienstes direkt in die Geräte einprogrammiert. Die beiden dafür fest hinterlegten IP-Adressen der DNS-Server (165.165.165.165 und 28.31.9.0) erfüllen aber ihre Aufgabe nicht und sind nicht erreichbar.

Deswegen kann der Mikrowechselrichter der Domain dataeu.hoymiles.com keine IP-Adresse zuordnen und somit den eigenen Cloud-Server nicht erreichen.

What is the cause of the problem?

When developing the firmware - contrary to any normal procedure in software development - Hoymiles stored fixed IP addresses for DNS servers.

What does that mean?

The microinverter tries to access the cloud via the Internet. This can be reached under the domain dataeu.hoymiles.com.

In order to translate the address dataeu.hoymiles.com into a “machine-readable” IP address, a so-called DNS service is required. Normally, your own internet provider automatically takes over this function for every internet connection.

Instead, Hoymiles has programmed the use of its own DNS service directly into the devices. However, the two IP addresses of the DNS servers stored for this purpose (165.165.165.165 and 28.31.9.0) do not fulfill their task and cannot be reached.

Therefore, the microinverter cannot assign an IP address to the domain dataeu.hoymiles.com and therefore cannot reach its own cloud server.

suaveolent commented 4 months ago

Great!

Yes, the newest update seems to fix connection related issues. Let's see if it already fixes your problem in the long run. Otherwise we'll need to evaluate if the custom component is indeed the root cause for it.

thitcher commented 4 months ago

The values are rock solid since 7:30AM (start of producing energy). Seems to work perfect now! Thanks for the code and great support.

julianxv commented 4 months ago

Sadly it's showing the same issue again with 0.1.4. It worked for the last days but today its disconnecting again.

Can I provide you some Information for Bugtracking?

suaveolent commented 4 months ago

You

Sadly it's showing the same issue again with 0.1.4. It worked for the last days but today its disconnecting again.

Can I provide you some Information for Bugtracking?

Are you running your inverter from a battery too or does it disconnect in the night? Also are you using the latest SW/FW update?

Should be:

{
    "dtu_hw_version": "H00.01.00",
    "dtu_sw_version": "V00.01.11",
    "inverter_hw_version": "H00.04.00",
    "inverter_sw_version": "V01.00.08"
}

For logging you can enable in your configuration.yaml:

logger:
  logs:
    custom_components.hoymiles_wifi: debug
    hoymiles_wifi: debug

If you navigate to "Settings" -"System" - "Logs" - "LOAD FULL LOGS" you should see some more information about the inverter responses.

julianxv commented 4 months ago

It disconnects at night.

The versions are matching.

I activated debug logging and will post a log tomorrow.

suaveolent commented 4 months ago

It disconnects at night.

The versions are matching.

I activated debug logging and will post a log tomorrow.

Great! Don’t forget to restart your Home Assistant instance after changing the configuration.

julianxv commented 4 months ago

Now it's running stable for the last two days.

suaveolent commented 4 months ago

Got my first long disconnect today (30 min). And seeing at least one short (30 sec) disconnect a day. I'm starting to wonder, if this is because of the inverter sequence counter overflowing (or some internal bug in the DTU).

I'll try to statically set the counter to 1 and see if that improves anything.

suaveolent commented 4 months ago

After setting the sequence counter to 1 I did not have a single disconnect today. I will keep monitoring this and if successful push a fix.

suaveolent commented 3 months ago

My connection has been rock solid over the past weeks. I'm beginning to wonder, if this issue was related to the Hoymiles Cloud and not the custom component.

@julianxv @thitcher are you still seeing disconnects?

julianxv commented 3 months ago

For me it's the same. No connection losses in the past weeks.

suaveolent commented 3 months ago

Im closing the issue for now.