mariolukas / Bluetti_ESP32_Bridge

Bluetti Power Station ESP32 Bluetooth to MQTT Bridge
GNU General Public License v3.0
88 stars 29 forks source link

No BT connection #10

Closed BS-GIFHUB closed 1 year ago

BS-GIFHUB commented 1 year ago

I own a AC500 and with bluetti-mqtt I got very quick a connection.

Now using the ESP32 I'm not getting an connection to my Bluetti station via BT. device id was checked 10 times and is fine. Connection to the mqtt server is fine but no connection the Bluetti.

The only change I did is to change in config.h

ifndef BLUETTI_TYPE

define BLUETTI_TYPE BLUETTI_AC500

endif

The problem seems to be timing in the BLE scan

I changed in BTooth.cpp following values and then AC500 will be found: //pBLEScan->setInterval(1349); //pBLEScan->setWindow(449); //pBLEScan->setActiveScan(true); //pBLEScan->start(5, false); pBLEScan->setInterval(1349); pBLEScan->setWindow(5000); pBLEScan->setActiveScan(true); pBLEScan->start(40, false);

Now I'm trying to solve the next issue, because it is now found but not connected. it seems to be that the if cause doesn't work of the module BTooth.cpp

/**

Any ideas ?

Thanks Bernhard

BS-GIFHUB commented 1 year ago

Changed in BTooth.cpp

The if condition to

if (advertisedDevice.haveServiceUUID() && advertisedDevice.isAdvertisingService(serviceUUID) ) {

Now I have the connection with the AC 500, but.......

no AC DC ON OFF state

AC DC command works

MartinRGH commented 1 year ago

Hello Bernhard,

I have changed the line to

if (advertisedDevice.haveServiceUUID() && advertisedDevice.isAdvertisingService(serviceUUID) && (strcmp(advertisedDevice.getName().c_str(),settings.bluetti_device_id)==0) ) otherwise the device name is not checked at all and it will not be possible any more to have more than one devices.

Greetings, Martin

mariolukas commented 1 year ago

Merged some of the PR's those should fix connection issues.