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
76 stars 27 forks source link

Test Inverter compatibility #41

Open cyrils opened 8 months ago

cyrils commented 8 months ago

Test compatibility with Renogy inverter models:

The InverterClient is experimental and may be incomplete/ incompatible with some models.

braathwaate commented 6 months ago

This is running the Lycan 5000 using the InverterClient. Is this the output that you want to see?

python3 example.py INFO:root:Init InverterClient: BT-TH-F26D8F08 => F0:F8:F2:6D:8F:08 INFO:root:Adapter status - Powered: True INFO:root:Starting discovery... INFO:root:Devices found: 1 INFO:root:Found matching device BT-TH-F26D8F08 => [f0:f8:f2:6d:8f:08] INFO:root:[F0:F8:F2:6D:8F:08] Connected INFO:root:[F0:F8:F2:6D:8F:08] 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 4000 => [32, 3, 15, 160, 0, 8, 65, 139] INFO:root:characteristic_enable_notifications_succeeded INFO:root:characteristic_write_value_succeeded INFO:root:on_data_received: response for read operation INFO:root:parse_inverter_stats 20031004d7000004b000141771021c01090000bfc1 DEBUG:root:create_request_payload 4311 => [32, 3, 16, 215, 0, 8, 246, 69] INFO:root:characteristic_write_value_succeeded INFO:root:on_data_received: response for read operation INFO:root:parse_inverter_model 20031052495634383335435348315300000000162c DEBUG:root:create_request_payload 4329 => [32, 3, 16, 233, 0, 5, 86, 76] INFO:root:characteristic_write_value_succeeded INFO:root:on_data_received: response for read operation INFO:root:parse_solar_charging 20030a03ab000300200002002030b0 DEBUG:root:create_request_payload 4410 => [32, 3, 17, 58, 0, 2, 231, 139] INFO:root:characteristic_write_value_succeeded INFO:root:on_data_received: response for read operation INFO:root:parse_inverter_load 200304001700007b35 INFO:root:on_read_operation_complete DEBUG:root:BT-TH-F26D8F08 => {'function': 'READ', 'uei_voltage': 1239, 'uei_current': 0, 'voltage': 1200, 'load_current': 20, 'frequency': 6001, 'temperature': 540, 'model': 'RIV4835CSH1S\x00\x00', 'solar_voltage': 939, 'solar_current': 3, 'solar_power': 32, 'solar_charging_state': 2, 'solar_charging_power': 32, 'load_power': 23, 'charging_current': 0, 'device': 'BT-TH-F26D8F08', 'client': 'InverterClient'} INFO:root:Exit: Disconnecting device: BT-TH-F26D8F08 [F0:F8:F2:6D:8F:08]

cyrils commented 6 months ago

Thanks! Are these values correct? May be there is a scaling issue so solar_voltage=93.9, load_current=0.2A etc?

braathwaate commented 6 months ago

This is the actual output. I've fixed some of the scaling issues in the LycanClient in my fork. And battery_current is wacky and I do not understand it. Here is the output from LycanClient: DEBUG:root:BT-TH-F26D8F08 => {'function': 'READ', 'uei_voltage': 123.6, 'uei_current': 0, 'voltage': 120.0, 'load_current': 20, 'frequency': 59.94, 'battery_temperature': 82.4, 'controller_temperature': 35.6, 'model': 'RIV4835CSH1S\x00\x00', 'solar_voltage': 926, 'solar_current': 78, 'solar_power': 729, 'solar_charging_state': 2, 'solar_charging_power': 729, 'load_power': 23, 'charging_current': 0, 'battery_percentage': 79, 'battery_voltage': 54.0, 'battery_current': 654.01, 'pv_voltage': 92.4, 'pv_current': 8.0, 'pv_power': 745, 'battery_type': 'custom', 'device': 'BT-TH-F26D8F08', 'client': 'LycanClient'} INFO:root:Exit: Disconnecting device: BT-TH-F26D8F08 [F0:F8:F2:6D:8F:08]

cyrils commented 6 months ago

I've merged a basic support to master, but still not fully tested as I don't have a device.

braathwaate commented 6 months ago

Here is the output:

INFO:root:Init InverterClient: BT-TH-F26D8F08 => F0:F8:F2:6D:8F:08 INFO:root:Adapter status - Powered: True INFO:root:Starting discovery... INFO:root:Devices found: 1 INFO:root:Found matching device BT-TH-F26D8F08 => [f0:f8:f2:6d:8f:08] INFO:root:[F0:F8:F2:6D:8F:08] Connected INFO:root:[F0:F8:F2:6D:8F:08] 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 4000 => [32, 3, 15, 160, 0, 8, 65, 139] INFO:root:characteristic_enable_notifications_succeeded INFO:root:characteristic_write_value_succeeded INFO:root:characteristic_value_updated 21 INFO:root:on_data_received: response for read operation 21 INFO:root:parse_inverter_stats 20031004d3000004af000a177201f5010900003052 DEBUG:root:create_request_payload 4311 => [32, 3, 16, 215, 0, 8, 246, 69] INFO:root:characteristic_write_value_succeeded INFO:root:characteristic_value_updated 21 INFO:root:on_data_received: response for read operation 21 INFO:root:parse_inverter_model 20031052495634383335435348315300000000162c DEBUG:root:create_request_payload 4329 => [32, 3, 16, 233, 0, 5, 86, 76] INFO:root:characteristic_write_value_succeeded INFO:root:characteristic_value_updated 15 INFO:root:on_data_received: response for read operation 15 INFO:root:parse_solar_charging 20030a03670022012c0001012ce4f2 DEBUG:root:create_request_payload 4410 => [32, 3, 17, 58, 0, 2, 231, 139] INFO:root:characteristic_write_value_succeeded INFO:root:characteristic_value_updated 9 INFO:root:on_data_received: response for read operation 9 INFO:root:parse_inverter_load 200304000c00000b32 DEBUG:root:create_request_payload 57348 => [32, 3, 224, 4, 0, 1, 244, 186] INFO:root:characteristic_write_value_succeeded INFO:root:characteristic_value_updated 7 INFO:root:on_data_received: response for read operation 7 INFO:root:on_read_operation_complete DEBUG:root:BT-TH-F26D8F08 => {'function': 'READ', 'uei_voltage': 123.5, 'uei_current': 0.0, 'voltage': 119.9, 'load_current': 10, 'frequency': 60.02, 'temperature': 50.1, 'model': 'RIV4835CSH1S', 'solar_voltage': 87.1, 'solar_current': 3.4, 'solar_power': 300, 'solar_charging_state': 'activated', 'solar_charging_power': 300, 'load_power': 12, 'charging_current': 0.0, 'battery_type': 'custom', 'device': 'BT-TH-F26D8F08', 'client': 'InverterClient'} INFO:root:Exit: Disconnecting device: BT-TH-F26D8F08 [F0:F8:F2:6D:8F:08]