orbital-systems / react-native-esp-idf-provisioning

ESP IDF provisioning and custom data library for react-native
MIT License
24 stars 5 forks source link

Device stuck after provision wifi data #53

Closed vic-pic closed 5 months ago

vic-pic commented 6 months ago

Hi, I run the example application and when I provision the wifi data I get {"status": "success"} response but nothing happens: the device doesn't try to connect to wifi and is no more visible in the devices screen. To reappear and make it connectable via ble, I have to disconnect it from the power supply.

Where am I wrong?

Thanks, Vincenzo

mateogianolio commented 6 months ago

Hi there! Do you use Android or iOS? Do you have access to the device logs? You should not get {"status": "success"} unless it actually succeeded with provisioning.

vic-pic commented 6 months ago

Hi Mateo, I'm using Android and follow the device logs of the app when I'm trying to connect to wifi:

2024-03-05 16:21:22.404 30322-31467 Espressif::BLETransport com.espidfprovisioningexample        D  onCharacteristicWrite, status : 0
2024-03-05 16:21:22.404 30322-31467 Espressif::BLETransport com.espidfprovisioningexample        D  UUID : 021aff52-0382-4aea-bff4-6b3f1c5adfb4
2024-03-05 16:21:22.493 30322-31467 Espressif::BLETransport com.espidfprovisioningexample        D  onCharacteristicRead, status 0 UUID : 021aff52-0382-4aea-bff4-6b3f1c5adfb4
2024-03-05 16:21:22.587 30322-31467 Espressif::BLETransport com.espidfprovisioningexample        D  onCharacteristicWrite, status : 0
2024-03-05 16:21:22.589 30322-31467 Espressif::BLETransport com.espidfprovisioningexample        D  UUID : 021aff52-0382-4aea-bff4-6b3f1c5adfb4
2024-03-05 16:21:22.674 30322-31467 Espressif::BLETransport com.espidfprovisioningexample        D  onCharacteristicRead, status 0 UUID : 021aff52-0382-4aea-bff4-6b3f1c5adfb4
2024-03-05 16:21:25.148 30322-31467 Espressif::BLETransport com.espidfprovisioningexample        D  onCharacteristicWrite, status : 0
2024-03-05 16:21:25.148 30322-31467 Espressif::BLETransport com.espidfprovisioningexample        D  UUID : 021aff52-0382-4aea-bff4-6b3f1c5adfb4
2024-03-05 16:21:25.556 30322-31467 Espressif::BLETransport com.espidfprovisioningexample        D  onCharacteristicRead, status 0 UUID : 021aff52-0382-4aea-bff4-6b3f1c5adfb4
2024-03-05 16:21:30.637 30322-31467 Espressif::BLETransport com.espidfprovisioningexample        D  onCharacteristicWrite, status : 0
2024-03-05 16:21:30.637 30322-31467 Espressif::BLETransport com.espidfprovisioningexample        D  UUID : 021aff52-0382-4aea-bff4-6b3f1c5adfb4
2024-03-05 16:21:30.819 30322-31467 Espressif::BLETransport com.espidfprovisioningexample        D  onCharacteristicRead, status 0 UUID : 021aff52-0382-4aea-bff4-6b3f1c5adfb4
2024-03-05 16:21:30.831 30322-31733 ESP:ESPDevice           com.espidfprovisioningexample        D  disableOnlyWifiNetwork()
2024-03-05 16:21:30.833 30322-31733 ESP:ESPDevice           com.espidfprovisioningexample        E  Connectivity Manager is already unregistered
2024-03-05 16:21:31.784 30322-31467 BluetoothGatt           com.espidfprovisioningexample        D  onClientConnectionState() - status=19 clientIf=8 device=48:31:B7:34:2B:3E
2024-03-05 16:21:31.785 30322-31467 Espressif::BLETransport com.espidfprovisioningexample        D  onConnectionStateChange, New state : 0, Status : 19
2024-03-05 16:21:31.785 30322-31467 Espressif::BLETransport com.espidfprovisioningexample        E  Disconnected from GATT server.
2024-03-05 16:21:31.785 30322-31467 EventBus                com.espidfprovisioningexample        D  No subscribers registered for event class com.espressif.provisioning.DeviceConnectionEvent
2024-03-05 16:21:31.786 30322-31467 EventBus                com.espidfprovisioningexample        D  No subscribers registered for event class org.greenrobot.eventbus.NoSubscriberEvent
2024-03-05 16:21:45.869 30322-30322 Compatibil...geReporter com.espidfprovisioningexample        D  Compat change id reported: 150939131; UID 10621; state: ENABLED
vic-pic commented 6 months ago

Hi @mateogianolio , is there any other operation that I have to do to make the device connect to the WiFi?

Thanks, Vincenzo

mateogianolio commented 6 months ago

As far as I can tell, this line:

2024-03-05 16:21:31.784 30322-31467 BluetoothGatt           com.espidfprovisioningexample        D  onClientConnectionState() - status=19 clientIf=8 device=48:31:B7:34:2B:3E

means that the device disconnected itself from the app on purpose with GATT_CONN_TERMINATE_PEER_USER. So it managed to connect to the wifi successfully.

vic-pic commented 6 months ago

Hi @mateogianolio, as the device does not connect to Wi-Fi after sending the configuration, is it necessary to perform any other operations to make the device connect to the Wi-Fi?

Thanks, Vincenzo

mateogianolio commented 5 months ago

Hey, sorry for the slow answer. As far as I can tell from your description the library behaves correctly. I suspect your device is at fault here. You would need to go through the device logs (not the app logs) and see why it reports that it's connected but does not connect to internet.