Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request - Send MQTT message on error #70

Closed
mavenius opened this issue Jun 26, 2024 · 5 comments
Closed

Feature Request - Send MQTT message on error #70

mavenius opened this issue Jun 26, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@mavenius
Copy link
Contributor

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
Copy link
Owner

cyrils commented Jun 28, 2024

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 cyrils added the enhancement New feature or request label Jun 28, 2024
@cyrils
Copy link
Owner

cyrils commented Jun 28, 2024

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

@cyrils
Copy link
Owner

cyrils commented Jun 29, 2024

Can you checkout #72 if it works? It doesn't do any mqtt per se, but in the callback you can do your stuff.

@mavenius
Copy link
Contributor Author

mavenius commented Jun 30, 2024 via email

@mavenius
Copy link
Contributor Author

Looks great! I went the rest of the way with it in #74 (into #72.) Thanks!

@cyrils cyrils closed this as completed Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants