Open RaoulSargent opened 4 weeks ago
Do you happen to know the id for your battery? It's the first byte sent when the app sends the request to the BT-1 (e.g. if I were looking at the snip of your log posted, it would be 0x31.
One note: the configuration currently in the repo is for three batteries (0x30, 0x31, and 0x32, denoted in the yaml as 48, 49, and 50 resp. I think I might comment out the sections for 2 of them to avoid confusion, but you can do so (your config is trying to pull data from 3 batteries but you said you only have 1.)
If you can't get the battery ID from nrfConnect (I'm not sure if you can or not) then Cyril's project had a way to scan for all batteries by putting in 255 as the id (IIRC...) I'm not sure if that was specially coded in the Python or the Bluetooth controllers accept that it there is only 1 battery connected to them. Either way, I'd try that first.
Let me know how it goes!
Thank you for your quick response. I'm keen to log all errors/issues/questions as I go, as a newbie to this project, so that we can help those that deploy it next.
Sadly I do not know the battery id. You mention the first byte from the logs (in my snip you pointed at 0x31), however that is the same value as whatever is configured in yaml for battery_id_1.
for example in this snip I set battery_id_1,2,3 as 4, 5, 6
<snip>
[08:22:05][C][api:142]: Using noise encryption: YES
[08:22:10][D][GetBatteryRequest:019]: Request Byte 0: 0x04
[08:22:10][D][GetBatteryRequest:019]: Request Byte 1: 0x03
[08:22:10][D][GetBatteryRequest:019]: Request Byte 2: 0x13
[08:22:10][D][GetBatteryRequest:019]: Request Byte 3: 0xB2
[08:22:10][D][GetBatteryRequest:019]: Request Byte 4: 0x00
[08:22:10][D][GetBatteryRequest:019]: Request Byte 5: 0x06
[08:22:10][D][GetBatteryRequest:019]: Request Byte 6: 0x61
[08:22:10][D][GetBatteryRequest:019]: Request Byte 7: 0x3E
[08:22:10][W][ble_client.automation:141]: Cannot write to BLE characteristic - not connected
[08:22:15][D][GetBatteryRequest:019]: Request Byte 0: 0x05
[08:22:15][D][GetBatteryRequest:019]: Request Byte 1: 0x03
[08:22:15][D][GetBatteryRequest:019]: Request Byte 2: 0x13
[08:22:15][D][GetBatteryRequest:019]: Request Byte 3: 0xB2
[08:22:15][D][GetBatteryRequest:019]: Request Byte 4: 0x00
[08:22:15][D][GetBatteryRequest:019]: Request Byte 5: 0x06
[08:22:15][D][GetBatteryRequest:019]: Request Byte 6: 0x60
[08:22:15][D][GetBatteryRequest:019]: Request Byte 7: 0xEF
[08:22:15][W][ble_client.automation:141]: Cannot write to BLE characteristic - not connected
[08:22:20][D][GetBatteryRequest:019]: Request Byte 0: 0x06
[08:22:20][D][GetBatteryRequest:019]: Request Byte 1: 0x03
[08:22:20][D][GetBatteryRequest:019]: Request Byte 2: 0x13
[08:22:20][D][GetBatteryRequest:019]: Request Byte 3: 0xB2
[08:22:20][D][GetBatteryRequest:019]: Request Byte 4: 0x00
[08:22:20][D][GetBatteryRequest:019]: Request Byte 5: 0x06
[08:22:20][D][GetBatteryRequest:019]: Request Byte 6: 0x60
[08:22:20][D][GetBatteryRequest:019]: Request Byte 7: 0xDC
[08:22:20][W][ble_client.automation:141]: Cannot write to BLE characteristic - not connected
<snip>
I cannot see anything that looks like a battery id in the data from nrfConnect.
For the moment I am still setting 3x batteries in the yaml as if I remove _2 and _3 then the build errors. This is not an immediate problem as until I find the correct battery id it doesn't really matter. So will debug the code after finding the battery id.
I did try a battery_id_1 = 255, but that didn't do anything different.
I was thinking I would cycle through and increment the battery id in the yaml, re-flash, repeat; which is going to take a little while. But your idea of setting up a Pi Zero W and use Cyril's project to scan for the battery_id might be quicker, so I will give that a go and report back here also.
Looking at this, it seems 255 is the right value to use.
If you set battery_id_1 to 255 and comment out all of the references to ${battery_id_2} and ${battery_id_3}, I think it should be set. If that doesn't work, can you send the logs from trying that?
TEST: Testing "0xFF" as a generic battery id: battery_id_1 = 255 battery_id_2 = 7 battery_id_3 = 8
[07:13:40][C][api:142]: Using noise encryption: YES
[07:13:53][D][GetBatteryRequest:019]: Request Byte 0: 0xFF
[07:13:53][D][GetBatteryRequest:019]: Request Byte 1: 0x03
[07:13:53][D][GetBatteryRequest:019]: Request Byte 2: 0x13
[07:13:53][D][GetBatteryRequest:019]: Request Byte 3: 0xB2
[07:13:53][D][GetBatteryRequest:019]: Request Byte 4: 0x00
[07:13:53][D][GetBatteryRequest:019]: Request Byte 5: 0x06
[07:13:53][D][GetBatteryRequest:019]: Request Byte 6: 0x74
[07:13:53][D][GetBatteryRequest:019]: Request Byte 7: 0xB5
[07:13:53][W][ble_client.automation:141]: Cannot write to BLE characteristic - not connected
[07:13:58][D][GetBatteryRequest:019]: Request Byte 0: 0x07
[07:13:58][D][GetBatteryRequest:019]: Request Byte 1: 0x03
[07:13:58][D][GetBatteryRequest:019]: Request Byte 2: 0x13
[07:13:58][D][GetBatteryRequest:019]: Request Byte 3: 0xB2
[07:13:58][D][GetBatteryRequest:019]: Request Byte 4: 0x00
[07:13:58][D][GetBatteryRequest:019]: Request Byte 5: 0x06
[07:13:58][D][GetBatteryRequest:019]: Request Byte 6: 0x61
[07:13:58][D][GetBatteryRequest:019]: Request Byte 7: 0x0D
[07:13:58][W][ble_client.automation:141]: Cannot write to BLE characteristic - not connected
[07:14:03][D][GetBatteryRequest:019]: Request Byte 0: 0x08
[07:14:03][D][GetBatteryRequest:019]: Request Byte 1: 0x03
[07:14:03][D][GetBatteryRequest:019]: Request Byte 2: 0x13
[07:14:03][D][GetBatteryRequest:019]: Request Byte 3: 0xB2
[07:14:03][D][GetBatteryRequest:019]: Request Byte 4: 0x00
[07:14:03][D][GetBatteryRequest:019]: Request Byte 5: 0x06
[07:14:03][D][GetBatteryRequest:019]: Request Byte 6: 0x61
[07:14:03][D][GetBatteryRequest:019]: Request Byte 7: 0xF2
[07:14:03][W][ble_client.automation:141]: Cannot write to BLE characteristic - not connected
TEST: Testing with battery_id_2 and battery_id_3 both commented out:
[For the benefit of other readers] Note: You must comment out both the variable definitions in the 'substitutions:' section, and also in the 'interval:' section further down:
substitutions:
...
battery_id_1: "255"
# battery_id_2: "7"
# battery_id_3: "8"
If you only comment out the 'substitutions:' section you will get errors like this:
INFO ESPHome 2024.7.3
INFO Reading configuration /config/renogy-bt-esphome1.yaml...
WARNING Found 'vector<uint8_t> request = GetBatteryRequest(${battery_id_2});
return request;' (see interval->0->then->2->ble_client.ble_write->value) which looks like a substitution, but 'battery_id_2' was not declared
WARNING Found 'vector<uint8_t> request = GetBatteryRequest(${battery_id_3});
return request; ' (see interval->0->then->4->ble_client.ble_write->value) which looks like a substitution, but 'battery_id_3' was not declared
WARNING Found 'vector<uint8_t> request = GetBatteryRequest(${battery_id_2});
return request;' (see interval->0->then->2->ble_client.ble_write->value) which looks like a substitution, but 'battery_id_2' was not declared
WARNING Found 'vector<uint8_t> request = GetBatteryRequest(${battery_id_3});
return request; ' (see interval->0->then->4->ble_client.ble_write->value) which looks like a substitution, but 'battery_id_3' was not declared
INFO Generating C++ source...
INFO Compiling app...
Processing renogy-bt-esphome1 (board: esp32dev; framework: arduino; platform: platformio/espressif32@5.4.0)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
- toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Dependency Graph
|-- WiFi @ 2.0.0
|-- ESPmDNS @ 2.0.0
|-- Update @ 2.0.0
|-- noise-c @ 0.1.4
Compiling .pioenvs/renogy-bt-esphome1/src/main.cpp.o
/config/renogy-bt-esphome1.yaml: In lambda function:
/config/renogy-bt-esphome1.yaml:162:51: error: '$' was not declared in this scope
vector<uint8_t> request = GetBatteryRequest(${battery_id_2});
^
/config/renogy-bt-esphome1.yaml: In lambda function:
/config/renogy-bt-esphome1.yaml:172:51: error: '$' was not declared in this scope
vector<uint8_t> request = GetBatteryRequest(${battery_id_3});
^
*** [.pioenvs/renogy-bt-esphome1/src/main.cpp.o] Error 1
========================== [FAILED] Took 6.38 seconds ==========================
So also comment out:
interval
...
- delay: 5s
- ble_client.ble_write:
characteristic_uuid: "FFD1"
service_uuid: "FFD0"
id: solarcab_battery_esp32_bc
value: !lambda |-
vector<uint8_t> request = GetBatteryRequest(${battery_id_2});
return request;
- delay: 5s
- ble_client.ble_write:
characteristic_uuid: "FFD1"
service_uuid: "FFD0"
id: solarcab_battery_esp32_bc
value: !lambda |-
vector<uint8_t> request = GetBatteryRequest(${battery_id_3});
return request;
Output from nrfConnect:
[08:57:58.4450] Normal: Scanner On.
[08:57:58.5580] Normal: Device Scanned.
[08:58:02.3240] Normal: Connected.
[08:58:02.5300] Normal: Discovered Device Information, FFD0, FFF0, and F000FFD0-0451-4000-B000-000000000000 Services.
[08:58:02.5390] Normal: Discovered System ID, Model Number String, Serial Number String, Firmware Revision String, Hardware Revision String, Software Revision String, Manufacturer Name String, IEEE 11073-20601 Regulatory Certification Data List, and PnP ID Characteristics for Service Device Information.
[08:58:02.5440] Normal: Discovered FFD1, FFD2, FFD3, FFD4, and FFD5 Characteristics for Service FFD0.
[08:58:02.5450] Normal: Discovered FFF1 Characteristics for Service FFF0.
[08:58:02.5460] Normal: Discovered F000FFD1-0451-4000-B000-000000000000 Characteristics for Service F000FFD0-0451-4000-B000-000000000000.
[08:58:02.5470] Normal: System ID has no Descriptors.
[08:58:02.5470] Normal: Model Number String has no Descriptors.
[08:58:02.5570] Normal: Serial Number String has no Descriptors.
[08:58:02.5580] Normal: Firmware Revision String has no Descriptors.
[08:58:02.5580] Normal: Hardware Revision String has no Descriptors.
[08:58:02.5580] Normal: Software Revision String has no Descriptors.
[08:58:02.5580] Normal: Manufacturer Name String has no Descriptors.
[08:58:02.5580] Normal: IEEE 11073-20601 Regulatory Certification Data List has no Descriptors.
[08:58:02.5580] Normal: PnP ID has no Descriptors.
[08:58:02.5590] Normal: FFD1 has no Descriptors.
[08:58:02.5590] Normal: Discovered Client Characteristic Configuration Descriptors for Characteristic FFD2
[08:58:02.5590] Normal: FFD3 has no Descriptors.
[08:58:02.5600] Normal: FFD4 has no Descriptors.
[08:58:02.5600] Normal: FFD5 has no Descriptors.
[08:58:02.5600] Normal: Discovered Client Characteristic Configuration Descriptors for Characteristic FFF1
[08:58:02.5600] Normal: F000FFD1-0451-4000-B000-000000000000 has no Descriptors.
@RaoulSargent Now that I look at it, I realize that the message (Cannot write to BLE characteristic - not connected) isn't to do with connecting to the batteries, but rather the BT module.
Does the ble_presence sensor show that you are connected? If not, then confirm that your MAC is correct here:
One more question: you mention that you have a Wanderer and a single battery. That isn't connected to the BT-1, correct?
Hi, sorry for my delayed response.
My config is as follows:
100W Panel -> Wanderer
Wanderer -> BT-1
Wanderer -> Single Battery
On an iPhone, the "Renogy DC Home" app is connected to "BT-TH-16178A45" I used nrfConnect on the same iPhone to scan and then connect to "BT-TH-16178A45"
The MAC listed in nrfConnect is displayed as: "<4DAC> 1617 8A45". So I changed ble_mac_address: 4D:AC:16:17:8A:45
Am I confused or doing something wrong?
Making progress...
Using nrfConnect, I connected to the BT-TH-16178A45 and started to "Read" values using the "Down Arrow" against each property. One of the properties is called "Hardware Revision String" with UUID: 2A27 When I pulled this value it gave me "AC4D16178A45", which looked like a MAC address to me. Notice how the first 4 characters, in pairs are reversed... "AC4D" instead of "<4DAC>". I updated the ble_mac_address to read: AC:4D:16:17:8A:45
Refreshed and now I am getting:
[19:39:49][I][esp32_ble_client:227]: [0] [AC:4D:16:17:8A:45] Connected
[19:39:49][W][main:161]: BLE client connected to battery
[19:39:49][D][ble_client.automation:178]: Write type: ESP_GATT_WRITE_TYPE_RSP
[19:39:49][D][ble_client.automation:188]: Found characteristic 0xFFD1 on device AC:4D:16:17:8A:45
[19:39:49][D][esp32_ble_client:188]: [0] [AC:4D:16:17:8A:45] cfg_mtu status 0, mtu 251
[19:39:49][D][esp32_ble_client:110]: [0] [AC:4D:16:17:8A:45] ESP_GATTC_REG_FOR_NOTIFY_EVT
[19:39:49][D][esp32_ble_client:296]: Wrote notify descriptor 1, properties=18
[19:39:49][D][ble_sensor:103]: Register for notify on 0xFFF1 complete
[19:39:49][D][ble_client:058]: All clients established, services released
[19:39:49][W][component:237]: Component esp32_ble took a long time for an operation (65 ms).
[19:39:49][W][component:238]: Components should block for at most 30 ms.
[19:39:49][D][esp32_ble_client:110]: [0] [AC:4D:16:17:8A:45] ESP_GATTC_WRITE_DESCR_EVT
[19:39:59][D][GetBatteryRequest:019]: Request Byte 0: 0x47
[19:39:59][D][GetBatteryRequest:019]: Request Byte 1: 0x03
[19:39:59][D][GetBatteryRequest:019]: Request Byte 2: 0x13
[19:39:59][D][GetBatteryRequest:019]: Request Byte 3: 0xB2
[19:39:59][D][GetBatteryRequest:019]: Request Byte 4: 0x00
[19:39:59][D][GetBatteryRequest:019]: Request Byte 5: 0x06
[19:39:59][D][GetBatteryRequest:019]: Request Byte 6: 0x6F
[19:39:59][D][GetBatteryRequest:019]: Request Byte 7: 0xCD
Now I've got to find the battery ID...
Using nrfConnect I found an "Unknown Characteristic", UUID: FFF1 which had a value "1003 0200 0F04 43". Taking a guess I took the last "43" and treated that as 0x43 (Dec 67) and set 67 as the battery ID.
Note to self/others: Whilst nrfConnect is 'connected' to the BT-1 nothing else can connect, so you must disconnect nrfConnect. Likewise, nrfConnect cannot 'connect' whilst the esp32 is 'connected'.
Now getting"[20:12:23][W][main:161]: BLE client connected to battery" in the logs... :-)
[20:12:22][D][binary_sensor:036]: 'SolarCab BLE Presence': Sending state ON
[20:12:22][D][esp32_ble_client:110]: [0] [AC:4D:16:17:8A:45] Found device
[20:12:22][D][esp32_ble_tracker:669]: Found device AC:4D:16:17:8A:45 RSSI=-84
[20:12:22][D][esp32_ble_tracker:690]: Address Type: PUBLIC
[20:12:22][D][esp32_ble_tracker:692]: Name: 'BT-TH-16178A45 '
[20:12:22][D][esp32_ble_tracker:695]: TX Power: 2
[20:12:22][D][esp32_ble_tracker:219]: Pausing scan to make connection...
[20:12:22][D][esp32_ble_tracker:219]: Pausing scan to make connection...
[20:12:22][I][esp32_ble_client:067]: [0] [AC:4D:16:17:8A:45] 0x00 Attempting BLE connection
[20:12:22][D][esp32_ble_client:110]: [0] [AC:4D:16:17:8A:45] ESP_GATTC_CONNECT_EVT
[20:12:22][D][esp32_ble_client:110]: [0] [AC:4D:16:17:8A:45] ESP_GATTC_OPEN_EVT
[20:12:22][I][ble_sensor:031]: [solarcab_battery_esp32_sensor] Connected successfully!
[20:12:22][D][esp32_ble_tracker:270]: Starting scan...
[20:12:23][D][esp32_ble_client:306]: [0] [AC:4D:16:17:8A:45] Event 46
[20:12:23][D][esp32_ble_client:110]: [0] [AC:4D:16:17:8A:45] ESP_GATTC_SEARCH_CMPL_EVT
[20:12:23][I][esp32_ble_client:227]: [0] [AC:4D:16:17:8A:45] Connected
[20:12:23][W][main:161]: BLE client connected to battery
[20:12:23][D][ble_client.automation:178]: Write type: ESP_GATT_WRITE_TYPE_RSP
[20:12:23][D][ble_client.automation:188]: Found characteristic 0xFFD1 on device AC:4D:16:17:8A:45
[20:12:23][D][esp32_ble_client:188]: [0] [AC:4D:16:17:8A:45] cfg_mtu status 0, mtu 251
[20:12:23][D][esp32_ble_client:110]: [0] [AC:4D:16:17:8A:45] ESP_GATTC_REG_FOR_NOTIFY_EVT
[20:12:23][D][esp32_ble_client:296]: Wrote notify descriptor 1, properties=18
[20:12:23][D][ble_sensor:103]: Register for notify on 0xFFF1 complete
[20:12:23][D][ble_client:058]: All clients established, services released
and "BLE Presence" is "On" in Home Assistant... but still all sensors are currently "Unknown".
After 5 mins the "BLE Presence" went "Off"...
[20:17:04][D][esp32_ble_client:110]: [0] [AC:4D:16:17:8A:45] ESP_GATTC_WRITE_CHAR_EVT
[20:17:14][D][GetBatteryRequest:019]: Request Byte 0: 0x43
[20:17:14][D][GetBatteryRequest:019]: Request Byte 1: 0x03
[20:17:14][D][GetBatteryRequest:019]: Request Byte 2: 0x13
[20:17:14][D][GetBatteryRequest:019]: Request Byte 3: 0xB2
[20:17:14][D][GetBatteryRequest:019]: Request Byte 4: 0x00
[20:17:14][D][GetBatteryRequest:019]: Request Byte 5: 0x06
[20:17:14][D][GetBatteryRequest:019]: Request Byte 6: 0x6E
[20:17:14][D][GetBatteryRequest:019]: Request Byte 7: 0x49
[20:17:14][D][esp32_ble_client:110]: [0] [AC:4D:16:17:8A:45] ESP_GATTC_WRITE_CHAR_EVT
[20:17:22][D][binary_sensor:036]: 'SolarCab BLE Presence': Sending state OFF
[20:17:22][D][esp32_ble_tracker:270]: Starting scan...
[20:17:24][D][GetBatteryRequest:019]: Request Byte 0: 0x43
[20:17:24][D][GetBatteryRequest:019]: Request Byte 1: 0x03
[20:17:24][D][GetBatteryRequest:019]: Request Byte 2: 0x13
[20:17:24][D][GetBatteryRequest:019]: Request Byte 3: 0xB2
[20:17:24][D][GetBatteryRequest:019]: Request Byte 4: 0x00
[20:17:24][D][GetBatteryRequest:019]: Request Byte 5: 0x06
[20:17:24][D][GetBatteryRequest:019]: Request Byte 6: 0x6E
[20:17:24][D][GetBatteryRequest:019]: Request Byte 7: 0x49
[20:17:24][D][esp32_ble_client:110]: [0] [AC:4D:16:17:8A:45] ESP_GATTC_WRITE_CHAR_EVT
...and now it seems to be in a constant loop doing the "ESP_GATTC_WRITE_CHAR_EVT" and nothing else.
sometimes the is a "[20:22:22][D][esp32_ble_tracker:270]: Starting scan..." and then it continues as above.
With that last MAC, what happens if you try 255 (0xFF) as the battery ID?
On Tue, Aug 27, 2024, 16:16 RaoulSargent @.***> wrote:
Using nrfConnect I found an "Unknown Characteristic", UUID: FFF1 which had a value "1003 0200 0F04 43". Taking a guess I took the last "43" and treated that as 0x43 (Dec 67) and set 67 as the battery ID.
Note to self/others: Whilst nrfConnect is 'connected' to the BT-1 nothing else can connect, so you must disconnect nrfConnect. Likewise, nrfConnect cannot 'connect' whilst the esp32 is 'connected'.
Now getting"[20:12:23][W][main:161]: BLE client connected to battery" in the logs... :-)
[20:12:22][D][binary_sensor:036]: 'SolarCab BLE Presence': Sending state ON [20:12:22][D][esp32_ble_client:110]: [0] [AC:4D:16:17:8A:45] Found device [20:12:22][D][esp32_ble_tracker:669]: Found device AC:4D:16:17:8A:45 RSSI=-84 [20:12:22][D][esp32_ble_tracker:690]: Address Type: PUBLIC
[20:12:22][D][esp32_ble_tracker:695]: TX Power: 2 [20:12:22][D][esp32_ble_tracker:219]: Pausing scan to make connection... [20:12:22][D][esp32_ble_tracker:219]: Pausing scan to make connection... [20:12:22][I][esp32_ble_client:067]: [0] [AC:4D:16:17:8A:45] 0x00 Attempting BLE connection [20:12:22][D][esp32_ble_client:110]: [0] [AC:4D:16:17:8A:45] ESP_GATTC_CONNECT_EVT [20:12:22][D][esp32_ble_client:110]: [0] [AC:4D:16:17:8A:45] ESP_GATTC_OPEN_EVT [20:12:22][I][ble_sensor:031]: [solarcab_battery_esp32_sensor] Connected successfully! [20:12:22][D][esp32_ble_tracker:270]: Starting scan... [20:12:23][D][esp32_ble_client:306]: [0] [AC:4D:16:17:8A:45] Event 46 [20:12:23][D][esp32_ble_client:110]: [0] [AC:4D:16:17:8A:45] ESP_GATTC_SEARCH_CMPL_EVT [20:12:23][I][esp32_ble_client:227]: [0] [AC:4D:16:17:8A:45] Connected [20:12:23][W][main:161]: BLE client connected to battery [20:12:23][D][ble_client.automation:178]: Write type: ESP_GATT_WRITE_TYPE_RSP [20:12:23][D][ble_client.automation:188]: Found characteristic 0xFFD1 on device AC:4D:16:17:8A:45 [20:12:23][D][esp32_ble_client:188]: [0] [AC:4D:16:17:8A:45] cfg_mtu status 0, mtu 251 [20:12:23][D][esp32_ble_client:110]: [0] [AC:4D:16:17:8A:45] ESP_GATTC_REG_FOR_NOTIFY_EVT [20:12:23][D][esp32_ble_client:296]: Wrote notify descriptor 1, properties=18 [20:12:23][D][ble_sensor:103]: Register for notify on 0xFFF1 complete [20:12:23][D][ble_client:058]: All clients established, services released
— Reply to this email directly, view it on GitHub https://github.com/mavenius/renogy-bt-esphome/issues/5#issuecomment-2313429918, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABO65BHKKC5QJ26KWBMEW43ZTTNBDAVCNFSM6AAAAABMVVUATOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJTGQZDSOJRHA . You are receiving this because you were mentioned.Message ID: @.***>
You can’t read battery when bt module is connected to wanderer.
@mavenius "255" made no difference. [esp32 nodemcu D11 mini] Looking at the output from the Raspberry PI it looks like the battery id is '16', so I will try that with the esp32.
@cyrils Using Raspberry PI Zero W2 and the corrected MAC it is now working as designed. See https://github.com/cyrils/renogy-bt/issues/78#issuecomment-2315020190
Now using battery_id 16 it is connecting... but I am not sure about the validity of the values it is returning.? This is a single 12v 8Ah battery.
[11:27:36][D][HandleBatteryData:027]: battery Id: 16
[11:27:36][D][HandleBatteryData:033]: function: 3
[11:27:36][D][HandleBatteryData:038]: current: 4
[11:27:36][D][HandleBatteryData:043]: voltage: 36947
[11:27:36][D][HandleBatteryData:048]: presentCapacity: 2103832
[11:27:37][D][HandleBatteryData:067]: Building partial Ids
[11:27:37][D][sensor:094]: 'SolarCab Battery 16 Current': Sending state 0.04000 A with 1 decimals of accuracy
[11:27:37][D][sensor:094]: 'SolarCab Battery 16 Voltage': Sending state 3694.69995 V with 1 decimals of accuracy
[11:27:37][D][sensor:094]: 'SolarCab Battery 16 Present Capacity': Sending state 2103.83203 Ah with 1 decimals of accuracy
[11:27:37][D][sensor:094]: 'SolarCab Battery 16 Total Capacity': Sending state 0.00000 Ah with 1 decimals of accuracy
[11:27:37][D][sensor:094]: 'SolarCab Battery 16 Charge Level': Sending state inf % with 1 decimals of accuracy
[11:27:37][D][sensor:094]: 'solarcab_battery_esp32_sensor': Sending state 0.00000 with 0 decimals of accuracy
Compare the above output to the output from the Raspberry PI:
DEBUG:root:BT-TH-16178A45 => {'function': 'READ', 'model': 'RNG-CTRL-WND', 'device_id': 16, 'battery_percentage': 100, 'battery_voltage': 13.2, 'battery_current': 0.29, 'battery_temperature': 27, 'controller_temperature': 29, 'load_status': 'off', 'load_voltage': 0.0, 'load_current': 0.0, 'load_power': 0, 'pv_voltage': 13.1, 'pv_current': 0.29, 'pv_power': 3, 'max_charging_power_today': 5, 'max_discharging_power_today': 0, 'charging_amp_hours_today': 1, 'discharging_amp_hours_today': 0, 'power_generation_today': 13, 'power_consumption_today': 0, 'power_generation_total': 1345, 'charging_status': 'activated', 'battery_type': 'lithium', '__device': 'BT-TH-16178A45', '__client': 'RoverClient'}
I suggest this issue is now closed as the original problem "Cannot write to BLE characteristic - not connected" has been resolved.
THANK YOU for this project and help getting things working.
I will open a new issue regards the differences in the values being reported.
@mavenius (& @cyrils) Congrats on getting this project going and everything you have done.
Looking for help/clues as to what might be the problem. I guess I've got something wrong.
The iOS Renergy App connects to the BT-1, and I found the BT-1 Mac using nrfConnect app. But all I am seeing in the esphome console window is as shown below.
NodeMCU esp32 esphome Renergy Wanderer Renergy BT-1 Single Battery