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

Bleak port #66

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

Bleak port #66

wants to merge 6 commits into from

Conversation

cyrils
Copy link
Owner

@cyrils cyrils commented Apr 3, 2024

This experimental bleak port adds support on Win/Mac/Linux/RPI-4 platforms. Bleak is a platform agnostic BLE client.

  • Supports Windows 10, version 16299 (Fall Creators Update) or greater
  • Supports Linux distributions with BlueZ >= 5.43
  • OS X/macOS support via Core Bluetooth API, from at least OS X version 10.11

TODO

  • Update documentation
  • Test RoverClient / RoverHistoryClient
  • Test BatteryClient
  • Test InverterClient
  • Test MacOS
  • Test Linux
  • Test Windows

@mavenius
Copy link
Contributor

mavenius commented Jul 5, 2024

FYI I tested this on Linux with a BT-2 connected to three batteries (daisy-chained) and was able to pull values.

I also tested on Linux with a BT-2 connected to a 60A Rover, and was able to pull values.

@mavenius
Copy link
Contributor

mavenius commented Jul 11, 2024

Tested (successfully) BatteryClient and RoverClient on Windows 10.

@cyrils
Copy link
Owner Author

cyrils commented Jul 12, 2024

Did you see any stability improvements in long term compared to main version?

@mavenius
Copy link
Contributor

Did you see any stability improvements in long term compared to main version?

I haven't done any long term testing; just a few minutes on each platform. I can do so (for one at a time, at least) through next week though.

That said, it seemed solid so far. On main, I get errors probably 3/10 or more times I try to read. Now that I have error tracking, I can get more precise data on that (including with the bleak branch.)

@rollyceballos
Copy link

I used a Raspberry PI 3 Model B and only this bleak port works to find and connect to the BT-1 + SRNE ML4860. It's just odd though that in #55 it worked well with the ML2440.

I only get this in RNG_CTRL, and even RNG_CTRL_HIST doesn't get anything.

~/renogy-bt $ python3 ./example.py config.ini 
INFO:root:Init RoverClient: BT-TH-487ACA33 => 20:91:48:7A:CA:33
INFO:root:Starting discovery...
INFO:root:Devices found: 37
INFO:root:Found matching device BT-TH-487ACA33 => 20:91:48:7A:CA:33
INFO:root:Client connection: True
INFO:root:subscribed to notification 0000fff1-0000-1000-8000-00805f9b34fb
INFO:root:found write characteristic 0000ffd1-0000-1000-8000-00805f9b34fb
INFO:root:writing to 0000ffd1-0000-1000-8000-00805f9b34fb [255, 3, 0, 12, 0, 8, 145, 209]
INFO:root:characteristic_write_value succeeded
INFO:root:notification_callback
INFO:root:on_data_received: response for read operation
INFO:root:notification_callback
WARNING:root:on_data_received: unknown operation=0
INFO:root:writing to 0000ffd1-0000-1000-8000-00805f9b34fb [255, 3, 0, 26, 0, 1, 176, 19]
INFO:root:characteristic_write_value succeeded
INFO:root:notification_callback
INFO:root:on_data_received: response for read operation
INFO:root:writing to 0000ffd1-0000-1000-8000-00805f9b34fb [255, 3, 1, 0, 0, 34, 209, 241]
INFO:root:characteristic_write_value succeeded
INFO:root:notification_callback
INFO:root:on_data_received: response for read operation
INFO:root:notification_callback
WARNING:root:on_data_received: unknown operation=1
INFO:root:notification_callback
WARNING:root:on_data_received: unknown operation=27
INFO:root:notification_callback
WARNING:root:on_data_received: unknown operation=44
INFO:root:writing to 0000ffd1-0000-1000-8000-00805f9b34fb [255, 3, 224, 4, 0, 1, 231, 213]
INFO:root:characteristic_write_value succeeded
INFO:root:notification_callback
INFO:root:on_data_received: response for read operation
INFO:root:on_read_operation_complete
INFO:root:BT-TH-487ACA33 => {'device_id': 1, 'function': 'READ', 'battery_type': 'lithium', '__device': 'BT-TH-487ACA33', '__client': 'RoverClient'}
INFO:root:mqtt logging
INFO:root:Exit: Disconnecting device: BT-TH-487ACA33 20:91:48:7A:CA:33

Has this got to do with the device_id?

@cyrils
Copy link
Owner Author

cyrils commented Sep 30, 2024

BT-1 supports only one device at a time, so device_id shouldn't matter.

@rollyceballos
Copy link

It looks like I'm using a rather older version of the BT-1 for the SRNE. Mine looks like https://www.aliexpress.com/item/1005004587282405.html but it works with the Renogy app. I've seen the newer BT-1 but not sure if that matters?

@cyrils
Copy link
Owner Author

cyrils commented Oct 6, 2024

Tried with device id 1?

@rollyceballos
Copy link

Yes, I tried device_id = 1 and you're right didn't really change anything. I bought the newer BT-1 and will arrive this week I'll see if that changes anything.

@rollyceballos
Copy link

Got the new BT-1 and indeed this one reports the needed values. The older BT-1 may not be using the same protocol.

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.

3 participants