cyrils / renogy-bt

Python library to read Renogy compatible BT-1 or BT-2 bluetooth modules using Raspberry Pi.
GNU General Public License v3.0
76 stars 27 forks source link

Feature Request - Send MQTT message on error #70

Open mavenius opened 1 week ago

mavenius commented 1 week ago

I have three batteries daisy-chained together to one BT-2 module. As it stands, I have a cron job that runs the equivalent of example.py for each battery on a regular interval. About half the time, an error occurs when pulling one or more of the sets of data. This isn't a huge deal, as it basically means that my data lags by about 15 minutes or so, but it would be good to know if something is actually broken so I can take a look.

What I'd like is to have an MQTT message published every time a read error occurs (to a different topic from the one where data goes on success.) Thanks!

cyrils commented 1 week ago

Currently this is designed to exit on error. If you want the error logged, you might want to introduce a new callback on_error to the BaseClient and RoverClient, and have it called from BaseClient.py#L127. I can look into it sometime next week.

cyrils commented 1 week ago

Also checkout the bleak port which uses a different bluetooth library and supposed to be more stable.

cyrils commented 1 week ago

Can you checkout https://github.com/cyrils/renogy-bt/pull/72 if it works? It doesn't do any mqtt per se, but in the callback you can do your stuff.

mavenius commented 1 week ago

I'll give it a shot this week; thanks!

On Sat, Jun 29, 2024, 19:10 Cyril Sebastian @.***> wrote:

Can you checkout #72 https://github.com/cyrils/renogy-bt/pull/72 if it works? It doesn't do any mqtt per se, but in the callback you can do your stuff.

— Reply to this email directly, view it on GitHub https://github.com/cyrils/renogy-bt/issues/70#issuecomment-2198369388, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABO65BGD2UMG2MT6B3VRHHLZJ45G7AVCNFSM6AAAAABJ6ISOVCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJYGM3DSMZYHA . You are receiving this because you authored the thread.Message ID: @.***>