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
89 stars 36 forks source link

Support for Renogy PRO 12V 200AH Smart Batteries #80

Open Sparhawk76 opened 1 day ago

Sparhawk76 commented 1 day ago

I wanted to report that with some minor changes to BaseClient.py I was able to get the new Pro series batteries from Renogy working.

Added: ALIAS_PREFIX2 = 'RNGRBP'

and changed the line if dev.alias() != None and dev.alias().startswith(ALIAS_PREFIX): to: if dev.alias() != None and ( dev.alias().startswith(ALIAS_PREFIX) or dev.alias().startswith(ALIAS_PREFIX2) ):

There might be a better way to do this, I'm quite rusty with my python skills, but it works.

Console output running the example script to do a scan:

INFO:root:Init RoverClient: BT-TH-B00FXXXX => 80:6f:b0:0f:xx:xx INFO:root:Adapter status - Powered: True INFO:root:Starting discovery... INFO:root:Devices found: 16 INFO:root:Devices found: 17 INFO:root:Devices found: 17 INFO:root:Devices found: 17 INFO:root:Devices found: 18 ERROR:root:Device not found: BT-TH-B00FXXXX => 80:6f:b0:0f:xx:xx, please check the details provided. DEBUG:root:Possible device found! ======> RNGRBP1217000794 > [4c:e1:74:54:ca:dc] DEBUG:root:Possible device found! ======> BT-TH-66EBCDDB > [60:98:66:eb:cd:db] DEBUG:root:Possible device found! ======> BT-TH-EABD5E03 > [e0:7d:ea:bd:5e:03] DEBUG:root:Possible device found! ======> BT-TH-66FA269B > [60:98:66:fa:26:9b] DEBUG:root:Possible device found! ======> BT-TH-66FE6274 > [60:98:66:fe:62:74] DEBUG:root:Possible device found! ======> BT-TH-66FB7BDC > [60:98:66:fb:7b:dc] DEBUG:root:Possible device found! ======> BT-TH-481C0B29 > [f8:55:48:1c:0b:29] DEBUG:root:Possible device found! ======> BT-TH-9B2F1DE7 > [fc:a8:9b:2f:1d:e7] DEBUG:root:Possible device found! ======> BT-TH-FD85AAC8 > [6c:b2:fd:85:aa:c8] DEBUG:root:Possible device found! ======> RNGRBP1217000792 > [4c:e1:74:4a:7d:36] DEBUG:root:Possible device found! ======> RNGRBP1224000039 > [4c:e1:74:54:ca:78]

Colsole output from configured battery pasted below:

INFO:root:Init BatteryClient: RNGRBP1217000794 => 4c:e1:74:54:ca:dc INFO:root:Adapter status - Powered: True INFO:root:Starting discovery... INFO:root:Devices found: 14 INFO:root:Found matching device RNGRBP1217000794 => [4c:e1:74:54:ca:dc] INFO:root:[4c:e1:74:54:ca:dc] Connected INFO:root:[4c:e1:74:54:ca:dc] Resolved services INFO:root:subscribed to notification 0000fff1-0000-1000-8000-00805f9b34fb INFO:root:found write characteristic 0000ffd1-0000-1000-8000-00805f9b34fb INFO:root:subscribed to notification 0000fff1-0000-1000-8000-00805f9b34fb INFO:root:found write characteristic 0000ffd1-0000-1000-8000-00805f9b34fb INFO:root:resolved services DEBUG:root:create_request_payload 5000 => [255, 3, 19, 136, 0, 17, 20, 182] INFO:root:characteristic_enable_notifications_failed INFO:root:characteristic_enable_notifications_succeeded INFO:root:characteristic_write_value_failed INFO:root:on_data_received: response for read operation DEBUG:root:create_request_payload 5017 => [255, 3, 19, 153, 0, 17, 68, 179] INFO:root:characteristic_write_value_failed INFO:root:on_data_received: response for read operation DEBUG:root:create_request_payload 5042 => [255, 3, 19, 178, 0, 6, 116, 181] INFO:root:characteristic_write_value_failed INFO:root:on_data_received: response for read operation DEBUG:root:create_request_payload 5122 => [255, 3, 20, 2, 0, 8, 245, 226] INFO:root:characteristic_write_value_failed INFO:root:on_data_received: response for read operation DEBUG:root:create_request_payload 5223 => [255, 3, 20, 103, 0, 1, 37, 251] INFO:root:characteristic_write_value_failed INFO:root:on_data_received: response for read operation INFO:root:on_read_operation_complete DEBUG:root:RNGRBP1217000794 => {'function': 'READ', 'cell_count': 4, 'cell_voltage_0': 3.3, 'cell_voltage_1': 3.3, 'cell_voltage_2': 3.3, 'cell_voltage_3': 3.3, 'sensor_count': 3, 'temperature_0': 71.96, 'temperature_1': 71.78, 'temperature_2': 72.14, 'current': -0.3, 'voltage': 13.3, 'remaining_charge': 190.37, 'capacity': 217.07, 'model': 'RBT12200LFP-BT', 'device_id': 48, 'device': 'RNGRBP1217000794', 'client': 'BatteryClient'} INFO:root:mqtt logging DEBUG:root:create_request_payload 5000 => [255, 3, 19, 136, 0, 17, 20, 182] INFO:root:characteristic_write_value_failed INFO:root:on_data_received: response for read operation DEBUG:root:create_request_payload 5017 => [255, 3, 19, 153, 0, 17, 68, 179] INFO:root:characteristic_write_value_failed INFO:root:on_data_received: response for read operation DEBUG:root:create_request_payload 5042 => [255, 3, 19, 178, 0, 6, 116, 181] INFO:root:characteristic_write_value_failed INFO:root:on_data_received: response for read operation DEBUG:root:create_request_payload 5122 => [255, 3, 20, 2, 0, 8, 245, 226] INFO:root:characteristic_write_value_failed INFO:root:on_data_received: response for read operation DEBUG:root:create_request_payload 5223 => [255, 3, 20, 103, 0, 1, 37, 251] INFO:root:characteristic_write_value_failed INFO:root:on_data_received: response for read operation INFO:root:on_read_operation_complete DEBUG:root:RNGRBP1217000794 => {'function': 'READ', 'cell_count': 4, 'cell_voltage_0': 3.3, 'cell_voltage_1': 3.3, 'cell_voltage_2': 3.3, 'cell_voltage_3': 3.3, 'sensor_count': 3, 'temperature_0': 71.96, 'temperature_1': 71.78, 'temperature_2': 72.14, 'current': -0.31, 'voltage': 13.3, 'remaining_charge': 190.37, 'capacity': 217.07, 'model': 'RBT12200LFP-BT', 'device_id': 48, 'device': 'RNGRBP1217000794', 'client': 'BatteryClient'} INFO:root:mqtt logging

Sparhawk76 commented 1 day ago

One other change I didn't notice at first, but can compensate for in my node-red config is that current needs to be multiplied by 10 to get the correct output current.

cyrils commented 1 day ago

Thats great to hear. But I don't think you need the above alias changes if the mac address is correct. Can you check with the correct mac (I assume 4c:e1:74:54:ca:dc) if it works?

The other batteries works too? What are their model numbers?