Renogy Smart Shunt 300 Bluetooth
Closed this issue · 16 comments
My Renogy Rover 60A works like a champ! I thought I would try to use the same code for the Renogy Shunt 300 with Bluetooth, but that didn't work so well :-( It doesn't like the request payload.
DEBUG:root:create_request_payload 5000 => [33, 3, 19, 136, 0, 17, 6, 8]
I used the RNG_BATT in hopes they were close, but I guess not. I tried many device_IDs but couldn't get it to read.
Output Data:
INFO:root:Init BatteryClient: RTMShunt300xxxxxxxx => xx:xx:xx:xx:xx:xx
INFO:root:Adapter status - Powered: True
INFO:root:Starting discovery...
INFO:root:Devices found: 55
INFO:root:Found matching device RTMShunt3005xxxxxxxx => [(xx:xx:xx:xx:xx:xx)]
INFO:root:[xx:xx:xx:xx:xx:xx] Connected
INFO:root:[xx:xx:xx:xx:xx:xx] Resolved services
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 => [33, 3, 19, 136, 0, 17, 6, 8]
INFO:root:characteristic_enable_notifications_failed
INFO:root:characteristic_write_value_succeeded
ERROR:root:on_read_timeout => please check your device_id!
INFO:root:Exit: Disconnecting device: RTMShunt300xxxxxxxx [(xx:xx:xx:xx:xx:xx)]
Is there a way to get past this easily and pull/read the data from this device? Seems you already built the rest out. Maybe just the right data feeds and added parser. Happy to assist!
Is there a wireshark ish app for Bluetooth on RPie4? I am happy to assist if you are open to the idea.
Looks like Shunt works differently, characteristic_enable_notifications_failed is not a good sign. Is this the same response you get everytime?
Only way you can figure out the register values is by doing bluetooth snooping. You have to enable Bluetooth HCI snoop in android phone while using dc home app and open the file using wireshark (read).
I have created the snoop file with iOS and XCode. Would you be open to looking at it to see what might need to be done to add the shunt to your program? If so, how should I send it. It has too much private info to add to the thread.
I briefly looked into it. Unfortunately the data sent back from Shunt looks very different from rest of the devices. There are some patterns but it will be really difficult to figure out the whole story without an actual device.
Can you let me know what do you see when using this branch shunt?
Use device type RNG_SHUNT
The first output was this:
INFO:root:Init SmartShuntClient: RTMShunt30053001400 => [xx:xx:xx:xx:xx:xx]
INFO:root:Adapter status - Powered: True
INFO:root:Starting discovery...
INFO:root:Devices found: 21
INFO:root:Found matching device RTMShunt30053001400 => [xx:xx:xx:xx:xx:xx]
INFO:root:[xx:xx:xx:xx:xx:xx] Connected
INFO:root:[xx:xx:xx:xx:xx:xx] Resolved services
ERROR:dbus.connection:Exception in handler for D-Bus signal:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/dbus/connection.py", line 218, in maybe_handle_message
self._handler(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/gatt/gatt_linux.py", line 398, in properties_changed
self.services_resolved()
File "/home/pi/renogy-bt-main/renogybt/BLE.py", line 73, in services_resolved
self.resolved_callback()
File "/home/pi/renogy-bt-main/renogybt/BaseClient.py", line 58, in __on_resolved
self.poll_data() if self.config['data'].getboolean('enable_polling') == True else self.read_section()
File "/home/pi/renogy-bt-main/renogybt/BaseClient.py", line 105, in read_section
request = self.create_generic_read_request(self.device_id, 3, self.sections[index]['register'], self.sections[index]['words'])
TypeError: create_generic_read_request() takes 1 positional argument but 5 were given
INFO:root:characteristic_enable_notifications_failed
After the first output I kept getting this:
INFO:root:Init SmartShuntClient: RTMShunt30053001400 => [xx:xx:xx:xx:xx:xx]
INFO:root:Adapter status - Powered: True
INFO:root:Starting discovery...
INFO:root:Devices found: 21
INFO:root:Found matching device RTMShunt30053001400 => [xx:xx:xx:xx:xx:xx]
INFO:root:[xx:xx:xx:xx:xx:xx] Connected
INFO:root:[xx:xx:xx:xx:xx:xx] Resolved services
ERROR:root:Exception occured: create_generic_read_request() takes 1 positional argument but 5 were given
I hope this helps.
Updated, please check again.
Doo you always get this error characteristic_enable_notifications_failed
?
The test above I didn't get the characteristic_enable_notifications_failed. I don't think it made it that far.
Updated test I get this:
INFO:root:Init SmartShuntClient: RTMShunt30053001400 => [xx:xx:xx:xx:xx:xx]
INFO:root:Adapter status - Powered: True
INFO:root:Starting discovery...
INFO:root:Devices found: 15
INFO:root:Found matching device RTMShunt30053001400 => [xx:xx:xx:xx:xx:xx]
INFO:root:[xx:xx:xx:xx:xx:xx] Connected
INFO:root:[xx:xx:xx:xx:xx:xx] Resolved services
INFO:root:subscribed to notification 0000fff1-0000-1000-8000-00805f9b34fb
INFO:root:found write characteristic 0000ffd1-0000-1000-8000-00805f9b34fb
INFO:root:resolved services
INFO:root:characteristic_enable_notifications_failed
INFO:root:characteristic_write_value_succeeded
ERROR:root:on_read_timeout => please check your device_id!
INFO:root:Exit: Disconnecting device: RTMShunt30053001400 [xx:xx:xx:xx:xx:xx]
That means the shunt has totally different ble characteristics. You might have to use a ble scanner app to figure out which one is write characteristic and which one is notification and update in BaseClient
Here is the output for both the controller and the shunt. The shunt doesn't use the subscribed to notification like the controller.
Device (new): xx.xx.xx.xx.xx.xx (public), -36 dBm
Flags: <06>
Incomplete 16b Services: <0000ffd0-0000-1000-8000-00805f9b34fb>
Manufacturer: <6cb2fd859e6a>
Tx Power: <00>
Complete Local Name: 'BT-TH-FD859E6A '
Device (new): xx.xx.xx.xx.xx.xx (public), -30 dBm
Flags: <06>
Manufacturer: <4ce1744c9298001e0001>
Appearance: <0000>
Tx Power: <00>
Complete Local Name: 'RTMShunt30053001400'
I tried running sensortag --all xx.xx.xx.xx.xx.xx and I got this back:
raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp)
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral xx.xx.xx.xx.xx.xx, addr type: public
sudo gatttool -b xx:xx:xx:xx:xx:xx -I
[xx:xx:xx:xx:xx:xx][LE]> connect
Attempting to connect to xx.xx.xx.xx.xx.xx
Error: connect: Connection refused (111)
I sent pic of the BLE scanner to the email address above. Lots of good data :-)
Closing it as unsupported.
Just ran into this same problem with my new setup..i had hope that you were hot on the trail, and JUST 2 days ago, this closed :(
I'm COMPLETELY new to this BLE interrogation/interpretation, but i need (want??) to get at this data for Grafana or other (better!) logging. Maybe this info helps?
I was able to use LightBlue BLE scanner on the Mac and this seems to be the notification stream
Name: RTMShunt30017000621
Device UUID: 696A6318-82C6-B188-E78C-071F1182CE5A
Service UUID: 0x0000C011-0000-1000-8000-00805F9B34FB
Descriptor: 0x2902
Content example stream notification:
10:16:06.342 - Characteristic (0000C411-0000-1000-8000-00805F9B34FB) notified: <42570119 01001630 a0240806 a1230836 a202137f a4ffddf1 a60033e5 a6100000 a70003c5 a7100000 a80bc6b0 a9000001 aa04e800 f8010000 ad01010e ad0200c9 ad0300c9 ad048000 b1210000 b1230000 b1240000 b3210000 b3230000 b3240000 b5210000 b5230000 b5240000 db04>
10:16:06.463 - Characteristic (0000C411-0000-1000-8000-00805F9B34FB) notified: <42570119 01001630 a0240806 a1230836 a202137f a4ffddf1 a60033e5 a6100000 a70003c5 a7100000 a80bc6b0 a9000001 aa04e800 f8010000 ad01010e ad0200c9 ad0300c9 ad048000 b1210000 b1230000 b1240000 b3210000 b3230000 b3240000 b5210000 b5230000 b5240000 db04>
10:16:06.581 - Characteristic (0000C411-0000-1000-8000-00805F9B34FB) notified: <42570119 01001630 a0240806 a1230836 a202137f a4ffddf1 a60033e5 a6100000 a70003c5 a7100000 a80bc6b0 a9000001 aa04e800 f8010000 ad01010e ad0200c9 ad0300c9 ad048000 b1210000 b1230000 b1240000 b3210000 b3230000 b3240000 b5210000 b5230000 b5240000 db04> ```
The smart shunt follows a different protocol, its hard to decode without an actual device.