Dear all,
I wanted to modify BTHome template sample for Home Assistant software in order to run enable it to advertise on PHY Coded, there I guess I need to enable extended advertiising via:
err = bt_le_ext_adv_create(¶m, NULL, &adv);
It seems I was able to enable extended advertising and Home Assistant sees the devices, but anytime I power up the dongle it pops up is Home Assistant as a device with unique MAC address, so everytime I have to add a new device which is not practical, I need the device to appear in Home assistant as a device which was already added, so I guess the MAC address is the key to et rid of this obstacle.
Following the skilled person, tried to base my solution on this, but it seems not to be based on extended advertising, therefore BT_LE_ADV_OPT_USE_IDENTITY, which is also used in BTHome templeate, works perfectly fine:
devzone.nordicsemi.com/.../427087
I was trying to my issue with this with id = bt_id_create(&static_addr, NULL); before bt_enable(NULL), but whenever I try to set up id parameter to struct bt_le_adv_param param, param.id = id, the application alwas fails here: err = bt_le_ext_adv_create(¶m, NULL, &adv); with error -22. When I use BT_LE_ADV_OPT_USE_IDENTITY in params this way: struct bt_le_adv_param param =
BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_EXT_ADV |
BT_LE_ADV_OPT_USE_IDENTITY |
BT_LE_ADV_OPT_CODED,
BT_GAP_ADV_SLOW_INT_MIN, \
BT_GAP_ADV_SLOW_INT_MAX, NULL); It is not detected in Home Assistant at all. So I got stuck, probably missing a piece of information. The BTHome template works perfectly fine, but I wanted to enhance with bluetooth 5 extended advertising capability.
My prj.conf:
CONFIG_BT=y
#CONFIG_LOG=y
#CONFIG_BT_SMP=y
#CONFIG_BT_PERIPHERAL=y
#CONFIG_BT_PERIPHERAL=n
#CONFIG_BT_DIS=y
#CONFIG_BT_DIS_PNP=n
#CONFIG_BT_BAS=y
CONFIG_BT_DEVICE_NAME="BTHome template"
#CONFIG_BT_DEVICE_APPEARANCE=768
CONFIG_BT_CTLR_PHY_CODED=y
CONFIG_BT_CTLR_ADV_EXT=y
CONFIG_BT_EXT_ADV=y
#CONFIG_CBPRINTF_FP_SUPPORT=y
#!!new
CONFIG_BT_BROADCASTER=y
CONFIG_BT_PRIVACY=n
#CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
CONFIG_BT_SETTINGS=y