helgeerbe / OpenDTU-OnBattery

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

Feature/jk bms publish battery temps #1010

Closed ButterBetzi closed 4 weeks ago

ButterBetzi commented 1 month ago

Also publish the battery temperatures to Home Assistant/make them auto discoverable.

schlimmchen commented 1 month ago

Have you researched and/or tested what happens to the auto-discovered items in HA if the target MQTT topic does not exist? As far as I remember I did not include the temperatures in the auto-discovery as the values are not published if the sensors are not physically connected to the BMS.

swingstate commented 1 month ago

The values for the two temp sensors would be available in MQTT for manually created template sensors.

ButterBetzi commented 1 month ago

actually no. I only added those sensors and built a new "local" version for myself because I need them :D Then I thought that might be interesting for other people/the project as well. The only thing that I tested was:

schlimmchen commented 4 weeks ago

The JK BMS app knows whether or not the temperature probes are connected. OpenDTU-OnBattery simply shows 44°C for both sensors in the live view. The app also knows tenth of degrees, while OpenDTU-OnBattery seems to only know whole degrees. So maybe the format is different when using the Bluetooth connection.

I looked in the raw data again, and my JK BMS is fairly new. There is no indication of whether or not the probes are attached or not. The value is just "44" (decimal) and the "battery sensor amount" is also just 2 in any case. So there seems to be nothing we can do.

Given that, my memory is incorrect: The battery temperatures are always read and always published to MQTT, so the topics are always there. So there is no reason not to merge this.

You will have to allow me to clean the history up before merging. I'll do this now an merge the changes then.