-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Data updates slower than in the Victron app device list #43
Comments
I too have exact same issue with a SmartSolar I'm seeing updates at about 10s too. I'm not sure how to resolve it here as I ended up writing my own script using bluepy instead of bleak so can answer the question:
No. The advertising data is frequent, I can detect it at a rate of 1s without having to ask for faster data. I do have to interrupt the scanner and start it again once I get the data to avoid waiting for the scanner timeout to restart. Maybe something similar needs to be done here. I'd much prefer to use this app as its much cleaner than my hacked together script! |
I found the source of the problem here: https://github.com/keshavdv/victron-ble/blob/main/victron_ble/scanner.py#L34 By removing the use of the _seen_data buffer I'm now getting updates every second or so, and they're not duplicated values either. The problem with this code is that it's only looking for duplicated keys and is ignoring the fact that the values may have changed. |
Ah, sorry, it's not quite as simple as that. I had to do that AND call stop() then start() inside the callback, similar to what bobemoe described above. I forgot I'd put those two lines of code in there. |
Hi Rob, |
What I should have done was fork the repo, apply my changes, rebuild the package and install it. What I actually did was edit the Python package in-situ. I'm a bad person. On my Pi, in /usr/local/lib/python3.9/dist-packages/victron_ble, in
And then in my script, which uses the library, in class Scanner(BaseScanner), in the callback, which in my case unpacks the data and then rebroadcasts it to an MQTT server, I added stop() and start():
Sorry that's a bit hand-wavey – I hope it helps. |
Yes, that definitely help, thanks for your quick reply! Now I am down to an interval of about one second. 😃 |
Hi,
More a question than an issue – in the first screen of the Victron Android app ("Device list"), the overview values that are displayed without connecting to a device seem to update a lot quicker than this library receives updates. It's maybe once a second in the app, whereas the victron-ble library seems to receive updated values a lot slower, and it seems to vary by device – I have an Orion Smart, SmartSolar and SmartShunt – it's about every 10s for the Orion Smart and the SmartSolar, and many 10s of seconds for the SmartShunt. Is that to be expected? Does the app do something to increase the broadcast update rate even before connecting to a specific device?
Thanks,
Rob.
The text was updated successfully, but these errors were encountered: