helgeerbe / OpenDTU-OnBattery

Software for ESP32 to talk to Hoymiles Inverters and Victrons MPPT battery chargers (Ve.Direct)
GNU General Public License v2.0
266 stars 59 forks source link

Pylontech not included in HomeAssistant MQTT Autodiscovery #633

Closed meisterlampe closed 5 months ago

meisterlampe commented 5 months ago

What happened?

My Pylontech-Battery is not discovered automatically within Home-Assistant. I checked with MQTT-Explorer and can see the current battery-values published to the topic solar/battery. But the Home-Assistant-Autodiscovery-Information expected in the topic homeassistant/sensor/dtu_battery_0001 is missing.

To Reproduce Bug

The bug appears on a fresh openDTU-onBattery-System with MQTT and Pylontech-Battery configured

Expected Behavior

If Home Assistant MQTT Auto Discovery is enabled. A topic homeassistant/sensor/dtu_battery_0001 should be created, that contains the information needed by Home Assistant.

Install Method

Self-Compiled

What git-hash/version of OpenDTU?

2024.01.26

Relevant log/trace output

No response

Anything else?

I'm not that into C++, but I checked the class MqttHandlePylontechHass and for me it seems, that it is never called anywhere. So I just added it to the main.cpp and Auto-Discovery startet working again. ( https://github.com/helgeerbe/OpenDTU-OnBattery/compare/development...meisterlampe:OpenDTU-OnBattery:addMqttHandlePylontechHassToMain ).

The name of the class MqttHandlePylontechHass indicates, that simply adding it to main.cpp is not intended. I guess it is not compatible with the other interface options or is this class used for all interfaces?

madmartin commented 5 months ago

I propose a "git bisect" to find the commit that broke that feature.

NikGro commented 5 months ago

I can confirm the issue as well as the fix proposed by @meisterlampe

schlimmchen commented 5 months ago

That is the correct way of fixing it and I stumbled upon this independently and did the same fix in #640.

meisterlampe commented 5 months ago

I tested the new version 2024.02.09 and can confirm, that the bug is fixed. Thanks a lot! 👍

github-actions[bot] commented 3 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns.