hoylabs / OpenDTU-OnBattery

Software for ESP32 to talk to Hoymiles/TSUN/Solenso Inverters, VE.Direct devices, battery management systems, and related peripherals
GNU General Public License v2.0
301 stars 63 forks source link

Feature: support JSON payload in MQTT battery provider #1127

Closed schlimmchen closed 2 months ago

schlimmchen commented 2 months ago

this changeset adds support for parsing the MQTT battery provider's SoC and voltage topics' payloads as JSON to extract a numeric value at a configurable path.

closes #897.

schlimmchen commented 2 months ago

@apss-fuchs @Dani1802 @danny1605 @r06-m @teste123456987 @TvT73 Care to test this? Be aware of #1025. If you are on an ESP32 with 4MB of flash and need OTA, you are out of luck, as this firmware requires an ESP32-S3 (old or new partition scheme) or an ESP32 with a new partition scheme. Please have a look at the firmware build as part of this PR's action.

vaterlangen commented 2 months ago

@schlimmchen Thanks for that update! Just tried it out and was able to gather the battery level of my Solarflow battery directly from the Hub's JSON topics. For the battery voltage, I think we will additionally need some kind of scaling, as 49,5V is reported as 4950 (so some kind of divider or unit setting, as for the smartmeter)

Update: Already implemented this on top of your branch - please refer #1143

TvT73 commented 2 months ago

@apss-fuchs @Dani1802 @danny1605 @r06-m @teste123456987 @TvT73 Care to test this? Be aware of #1025. If you are on an ESP32 with 4MB of flash and need OTA, you are out of luck, as this firmware requires an ESP32-S3 (old or new partition scheme) or an ESP32 with a new partition scheme. Please have a look at the firmware build as part of this PR's action.

@schlimmchen I can´t test yet cause of still using an 4mb ESP Version and my knowledge is not good enough for compiling it by myself. At the moment my priority is to get rid of the anoying misscalculation of dailies power production, when using an Hoymiles inverter together with an Zendure Hub.

But I will follow it here to see what is possible in the future. It´s great to see whats possible. Good work !

spcqike commented 2 months ago

At the moment my priority is to get rid of the anoying misscalculation of dailies power production, when using an Hoymiles inverter together with an Zendure Hub.

even so its offtopic, whats your problem? and, why are you using "daily yield" in the first place?

IMO its way easier to use "total yield" all along and let your monitoring software calculate, what you want to see. daily yield? value_now - value_midnight. weekly yield? value_now - value_monday_00.00. no need for crazy calculation, adding up of values, hassle around with resetting "daily" values etc.

if that's your case and as the problem with resetting daily values comes quite often: @schlimmchen, do you think it would be possible (or even a good idea in general?) to change the "daily yield" value? afaik right now its a response from the inverter itself, which will reset to 0, if the inverter looses DC power. there are quite a few options that try to correct these resets. wouldn't it be easier to also use totalyield DTU internal and just calculate totalyield_now - totalyield_midnight?

github-actions[bot] commented 1 month ago

This pull request 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.