fl4p / batmon-ha

Add-on for Home Assistant to connect JK, JBD, Daly, ANT, SOK and Supervolt BMS via Bluetooth
MIT License
246 stars 53 forks source link

Publish HA discovery mqtt data before bms sample data #163

Closed scotthernandez closed 7 months ago

scotthernandez commented 7 months ago

Unfortunately my daly bms doesn't quite work with the current code: ''' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/bmslib/models/daly.py", line 144, in _q raise TimeoutError( TimeoutError: timeout awaiting result 95, got 5/6 responses

08:02:48 INFO [sampling] connecting bms DalyBt(18:81:03:03:05:EF,lifepo4-solar-1) 08:02:58 INFO [daly] normal connect failed (<class 'TimeoutError'>), connecting with scanner '''

And because of the timeout in the last sample I suspect it is never able to publish the discovery mqtt topics that HA needs for creating the sensors.

Can you please check to see if it is easy to rearrange things to publish the discovery data before the sample data?

fl4p commented 7 months ago

For how many cells did you configure the BMS?

scotthernandez commented 7 months ago

It is a 15 cell pack - 48v system.

scotthernandez commented 7 months ago

It does publish data for these topics:

If that helps.

fl4p commented 7 months ago

Thanks, I found a bug where the code wrongly computes the number of responses (the BMS sends voltages in tuples of 3) Ill fix this with the next release.

scotthernandez commented 7 months ago

Great, thanks.

Does it make sense to move the discovery mqtt data check before reading/publishing the samples?

fl4p commented 7 months ago

Yeah kind of. The discovery function currently needs samples voltages to publish the number of cells and skip the nan fields. I'll rewrite the code so discovery is sent out even if voltages fetch failed.

scotthernandez commented 7 months ago

Great, thanks.

On Wed, Nov 22, 2023, 9:17 AM Fabian @.***> wrote:

Yeah kind of. The discovery function currently needs samples voltages to publish the number of cells and skip the nan fields. I'll rewrite the code so discovery is sent out even if voltages fetch failed.

— Reply to this email directly, view it on GitHub https://github.com/fl4p/batmon-ha/issues/163#issuecomment-1823181474, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA4AGYTPGENEU4RGYY4OVTYFYXT3AVCNFSM6AAAAAA7WPMNESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRTGE4DCNBXGQ . You are receiving this because you authored the thread.Message ID: @.***>

fl4p commented 7 months ago

fix https://github.com/fl4p/batmon-ha/commit/dfd6e4a6da0662911097284ffec8da9910c53ed2 is in the next release please re-open if needed

scotthernandez commented 7 months ago

Thanks; will do.

On Sun, Nov 26, 2023, 8:31 AM Fabian @.***> wrote:

fix dfd6e4a https://github.com/fl4p/batmon-ha/commit/dfd6e4a6da0662911097284ffec8da9910c53ed2 is in the next release please re-open if needed

— Reply to this email directly, view it on GitHub https://github.com/fl4p/batmon-ha/issues/163#issuecomment-1826828979, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA4AGZIPWYA3SO2NGSRCTTYGNVFXAVCNFSM6AAAAAA7WPMNESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRWHAZDQOJXHE . You are receiving this because you authored the thread.Message ID: @.***>