wifi_prov_mgr example does not work with esp_prov.py.

ankayca
Posts: 18
Joined: Wed Aug 26, 2020 4:58 pm

wifi_prov_mgr example does not work with esp_prov.py.

Postby ankayca » Fri Jun 28, 2024 2:54 pm

Hey ,

I tried to provision esp32 device using esp_prov.py.

First of all, I built and flashed the esp_prov example.

after that, I connected to PROV_C34EE8 in linux via Bluetooth.

Code: Select all

➜ bluetoothctl
[bluetooth]# power on
[bluetooth]# scan on
[bluetooth]# connect D8:13:2A:C3:4E:EA
Attempting to connect to D8:13:2A:C3:4E:EA
[CHG] Device D8:13:2A:C3:4E:EA Connected: yes
Connection successful
[CHG] Device D8:13:2A:C3:4E:EA ServicesResolved: yes
then try to run the below code to provision esp32.

Code: Select all

❯ python esp_prov.py --transport ble --ssid Mi_9T --passphrase aaaaaaaa --service_name PROV_C34EE8 --sec_ver 2 --sec2_username wifiprov --sec2_pwd abcd1234  
BLE client is running in console mode
	This could be due to your platform not being supported or dependencies not being met
	Please ensure all pre-requisites are met to run the full fledged client
BLECLI >> Please connect to BLE device `PROV_C34EE8` manually using your tool of choice
BLECLI >> Was the device connected successfully? [y/n] y
BLECLI >> List available attributes of the connected device
BLECLI >> Is the service UUID '021a9004-0382-4aea-bff4-6b3f1c5adfb4' listed among available attributes? [y/n] y
BLECLI >> Is the characteristic UUID '021a9000-0382-4aea-bff4-6b3f1c5adfb4' listed among available attributes? [y/n] y
BLECLI >> Is the characteristic UUID '021a9000-0382-4aea-bff4-6b3f1c5adfb4' listed among available attributes? [y/n] y
BLECLI >> Is the characteristic UUID '021a9000-0382-4aea-bff4-6b3f1c5adfb4' listed among available attributes? [y/n] y

==== Starting Session ====
BLECLI >> Write following data to characteristic with UUID '021a9000-0382-4aea-bff4-6b3f1c5adfb4' :
	>> 1002629103a2018d030a087769666970726f76128003de70effe668dcb856886398eb7e79e9ef019f1c621fdd05ddb774e489260cd87b194f9d78367fecf2b4a11816d908d84c203dcebc53920f555e395bff8cda1487bc74063617deed5ea3b58bea2b180187dafb5bfe579ec465c37ca2e956bdb44613fa2ecb9d4e8953fc5f769588e8f703b4161017df835e4eafb1c087ad72edc8f2aa1019030ff66c255aef9385491fbc18a1325cc8952e05ed099536a7c8fe8c49d2cdbbf9fd5692ec1df0c5b7e48e43a61b7a999be482112df736d7b6d263bce6c346758256364854cec7ebee48d38fcda9a89c70cd382d1b8d6be4a2ea47a0296f4d1bae561d49d35f7885fccf4d8d808d08928a4ad752bf697edead20e601c5303b92ebd851abd875a51c3e4fb8abf0ac84c2262c412b3d8edd721a8f306dc23a9db85404f4f7919dcc123899eb667cf483e35be6001715e933d7fe4d7bc30af146ad5f0ad99940e41b2789dd927a8f6f8c82eaee2066327e53623312783791270ebe7aee0dbee66625ea578e6fefd9bc2ced64e6d65232fa650a5c029e8
BLECLI >> Enter data read from characteristic (in hex) :
	<<   

it didn't worked so I checked service UUID and characteristic UUID`s with following command in bluetoothctrl console.

Code: Select all

[PROV_C34EE8]# menu gatt
Menu gatt:
Available commands:
-------------------
list-attributes [dev/local]                       List attributes
select-attribute <attribute/UUID>                 Select attribute
attribute-info [attribute/UUID]                   Select attribute
read [offset]                                     Read attribute value
write <data=xx xx ...> [offset] [type]            Write attribute value
acquire-write                                     Acquire Write file descriptor
release-write                                     Release Write file descriptor
acquire-notify                                    Acquire Notify file descriptor
release-notify                                    Release Notify file descriptor
notify <on/off>                                   Notify attribute value
clone [dev/attribute/UUID]                        Clone a device or attribute
register-application [UUID ...]                   Register profile to connect
unregister-application                            Unregister profile
register-service <UUID> [handle]                  Register application service.
unregister-service <UUID/object>                  Unregister application service
register-includes <UUID> [handle]                 Register as Included service in.
unregister-includes <Service-UUID><Inc-UUID>      Unregister Included service.
register-characteristic <UUID> <Flags=read,write,notify...> [handle] Register application characteristic
unregister-characteristic <UUID/object>           Unregister application characteristic
register-descriptor <UUID> <Flags=read,write...> [handle] Register application descriptor
unregister-descriptor <UUID/object>               Unregister application descriptor
back                                              Return to main menu
version                                           Display version
quit                                              Quit program
exit                                              Quit program
help                                              Display help about this program
export                                            Print environment variables
[CHG] Device 6B:EC:B5:FA:2A:CF RSSI: -91
[PROV_C34EE8]# list-attributes D8:13:2A:C3:4E:EA
Primary Service (Handle 0x0000)
	/org/bluez/hci0/dev_D8_13_2A_C3_4E_EA/service0001
	021a9004-0382-4aea-bff4-6b3f1c5adfb4
	Vendor specific
Characteristic (Handle 0x0000)
	/org/bluez/hci0/dev_D8_13_2A_C3_4E_EA/service0001/char0002
	021aff4f-0382-4aea-bff4-6b3f1c5adfb4
	Vendor specific
Descriptor (Handle 0x0000)
	/org/bluez/hci0/dev_D8_13_2A_C3_4E_EA/service0001/char0002/desc0004
	00002901-0000-1000-8000-00805f9b34fb
	Characteristic User Description
Characteristic (Handle 0x0000)
	/org/bluez/hci0/dev_D8_13_2A_C3_4E_EA/service0001/char0005
	021aff50-0382-4aea-bff4-6b3f1c5adfb4
	Vendor specific
Descriptor (Handle 0x0000)
	/org/bluez/hci0/dev_D8_13_2A_C3_4E_EA/service0001/char0005/desc0007
	00002901-0000-1000-8000-00805f9b34fb
	Characteristic User Description
Characteristic (Handle 0x0000)
	/org/bluez/hci0/dev_D8_13_2A_C3_4E_EA/service0001/char0008
	021aff51-0382-4aea-bff4-6b3f1c5adfb4
	Vendor specific
Descriptor (Handle 0x0000)
	/org/bluez/hci0/dev_D8_13_2A_C3_4E_EA/service0001/char0008/desc000a
	00002901-0000-1000-8000-00805f9b34fb
	Characteristic User Description
Characteristic (Handle 0x0000)
	/org/bluez/hci0/dev_D8_13_2A_C3_4E_EA/service0001/char000b
	021aff52-0382-4aea-bff4-6b3f1c5adfb4
	Vendor specific
Descriptor (Handle 0x0000)
	/org/bluez/hci0/dev_D8_13_2A_C3_4E_EA/service0001/char000b/desc000d
	00002901-0000-1000-8000-00805f9b34fb
	Characteristic User Description
Characteristic (Handle 0x0000)
	/org/bluez/hci0/dev_D8_13_2A_C3_4E_EA/service0001/char000e
	021aff53-0382-4aea-bff4-6b3f1c5adfb4
	Vendor specific
Descriptor (Handle 0x0000)
	/org/bluez/hci0/dev_D8_13_2A_C3_4E_EA/service0001/char000e/desc0010
	00002901-0000-1000-8000-00805f9b34fb
	Characteristic User Description
Characteristic (Handle 0x0000)
	/org/bluez/hci0/dev_D8_13_2A_C3_4E_EA/service0001/char0011
	021aff54-0382-4aea-bff4-6b3f1c5adfb4
	Vendor specific
Descriptor (Handle 0x0000)
	/org/bluez/hci0/dev_D8_13_2A_C3_4E_EA/service0001/char0011/desc0013
	00002901-0000-1000-8000-00805f9b34fb
	Characteristic User Description
[PROV_C34EE8]# 
As you can see, service UUID is correct but the characteristics UUID that esp_prov.py asked for is not available.
My IDF version v5.2.2

Can anybody explain what's wrong?

Any help is appreciated.
Regards.
Last edited by ankayca on Mon Jul 01, 2024 11:29 am, edited 1 time in total.

ankayca
Posts: 18
Joined: Wed Aug 26, 2020 4:58 pm

Re: Using esp_prov.py with esp_prov example not working.

Postby ankayca » Mon Jul 01, 2024 11:16 am

UP !!!!

ankayca
Posts: 18
Joined: Wed Aug 26, 2020 4:58 pm

Re: wifi_prov_mgr example does not work with esp_prov.py.

Postby ankayca » Mon Jul 01, 2024 1:22 pm

Updated pytest requirements from /esp/tools/requirements.pytest.txt
```
get_idf
...
...
pip install -r requirements.pytest.txt
```
then successfully I can run esp_prov.py

Who is online

Users browsing this forum: Baidu [Spider] and 209 guests