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

Implementing bleak #73

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Implementing bleak #73

wants to merge 2 commits into from

Conversation

FrancineMatos
Copy link

Updated the files with bleak

@cyrils
Copy link
Owner

cyrils commented Jul 12, 2024

Hello @FrancineMatos thanks for the PR. Did you find it any more stable than the original version in your testing?

@FrancineMatos
Copy link
Author

FrancineMatos commented Jul 12, 2024

Hello @FrancineMatos thanks for the PR. Did you find it any more stable than the original version in your testing?

To be honest i never faced some connection problems after its connect only when tring to connect, my Raspberry Pi 4 is about 1 meter from the BT-1 Bluetooth probability its helps a lot.

I mean at start, when i restart the Py it's take a while to connect, i solved that creating a service to start the script example.py, so when the connection fails the script just restart and keep trying to connect.

But one time it's connected it's keep alive for a long time. Maybe it's disconnect some time but like i told the service do the trink and just restart the script, so i not even notice the disconnection and i have some automations that relay on pv power readings and everything goes well.

One thing that i can say is that every time that i faced a disconnection it's faster restart the bluetooth service from the Py to reconnect faster, it's looks like that even the python can't connect properly the bluetooth connection with the BT-1 keeps anchored, so when you restart the bluetooth the BT-1 appears to properly disconnect and accept new connections more easily, considering it only accepts one connection at a time.

I have a battery monitor for my BMS on the same system and it also uses bluethoot for this, sometimes I face the same problem with it, so when I identify that one of the two readings has dropped, I just restart raspbery py's bluethoot and the the trick with the service takes care of the reconnection.

On /etc/systemd/system/renogy-bt.service

[Unit]
Description=renogy-bt
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
Restart=always
RestartSec=5s
User=francine
WorkingDirectory=/home/francine/renogy-bt
ExecStart=/home/francine/renogy-bt/executa.sh

[Install]
WantedBy=multi-user.target`

in /home/francine/renogy-bt/executa.sh

#!/bin/bash

python3 ./example.py

journalctl -u renogy-bt.service -e -f
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants