<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Bluetooth identity creating in extended advertising</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/126491/bluetooth-identity-creating-in-extended-advertising</link><description>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(&amp;amp;param, NULL, &amp;amp;adv); 
 
 It seems</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 23 Jan 2026 17:23:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/126491/bluetooth-identity-creating-in-extended-advertising" /><item><title>RE: Bluetooth identity creating in extended advertising</title><link>https://devzone.nordicsemi.com/thread/559483?ContentTypeID=1</link><pubDate>Fri, 23 Jan 2026 17:23:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:772b67e1-7d2c-4da1-80ad-8fa8f6dc1685</guid><dc:creator>Ivo H</dc:creator><description>&lt;p&gt;Thank you very much for help, but unfortunately, your code with&amp;nbsp;&lt;/p&gt;
&lt;h2 class="memtitle"&gt;BT_LE_EXT_ADV_CODED_NCONN_IDENTITY&lt;/h2&gt;
&lt;p&gt;does not cause the device to be visible in Home Assistant, it is visible in bluetoothctl, but it does not pop up even once in Home Assistant.&lt;/p&gt;
&lt;p&gt;I read it is related to extended_advertising, in legacy,&amp;nbsp;&lt;/p&gt;
&lt;h2 class="memtitle"&gt;IDENTITY&amp;nbsp;&lt;/h2&gt;
&lt;p&gt;works fine, but in extended, it is different.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth identity creating in extended advertising</title><link>https://devzone.nordicsemi.com/thread/559469?ContentTypeID=1</link><pubDate>Fri, 23 Jan 2026 13:22:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1afcc8ed-c3e7-4dfa-bc49-ad5764530fb3</guid><dc:creator>Ivo H</dc:creator><description>&lt;p&gt;Thank you,if&amp;nbsp; you mean the code you sent in your first reply I guess that is just abbriviationfor this&amp;nbsp; BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_EXT_ADV |&lt;br /&gt; BT_LE_ADV_OPT_USE_IDENTITY |&lt;br /&gt; BT_LE_ADV_OPT_CODED,&lt;br /&gt; BT_GAP_ADV_SLOW_INT_MIN, \&lt;br /&gt; BT_GAP_ADV_SLOW_INT_MAX, NULL);&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Right?&lt;/p&gt;
&lt;p&gt;This I used in my first post and it did not show up in Home Assistant with extended advertising,but anyway&amp;nbsp; will verify it once more with your NCONN_IDENTITY and double check.&lt;/p&gt;
&lt;p&gt;Anyway,this uses identity,isn&amp;#39;t there a way how to omit IDENTITY and make the RPA address fixed?So instead of this:&lt;/p&gt;
&lt;h2 class="memtitle"&gt;BT_LE_EXT_ADV_CODED_NCONN_IDENTITY&lt;/h2&gt;
&lt;p&gt;,we will use this&amp;nbsp;&lt;/p&gt;
&lt;h2 class="memtitle"&gt;BT_LE_EXT_ADV_CODED_NCONN&lt;/h2&gt;
&lt;p&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth identity creating in extended advertising</title><link>https://devzone.nordicsemi.com/thread/559463?ContentTypeID=1</link><pubDate>Fri, 23 Jan 2026 13:00:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ddd57c45-8a59-48a7-9566-d00854261c64</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;The reason why it doesn&amp;#39;t work with extended advertising might also be that there is something missing somewhere. It works slightly differently with extended advertising after all. But then it doesn&amp;#39;t immediately make sense to me how you got&amp;nbsp;BT_LE_ADV_OPT_ANONYMOUS working.&lt;/p&gt;
[quote user="Ivo H"]I read that anytime I boot my bluetooth device I see a certain MAC address in usb printk info output at the initialization bt_enable()[/quote]
&lt;p&gt;I am not sure if I understood this entire part, but the next part about randomization for privacy is correct. But if you do not need that, that is fine.&lt;/p&gt;
&lt;p&gt;You can have a look at the code I sent below, which seems to me atleast to use the same address each time. You can also change it when needed.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth identity creating in extended advertising</title><link>https://devzone.nordicsemi.com/thread/559415?ContentTypeID=1</link><pubDate>Thu, 22 Jan 2026 21:04:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3db27a9e-008f-4a04-a67b-dee48f3fa340</guid><dc:creator>Ivo H</dc:creator><description>&lt;p&gt;Actually I can use&amp;nbsp;BT_LE_ADV_OPT_ANONYMOUS, this works, but then I ran into issues whenever I want to add multiple sensors, they clash as they all are assigned 00:00:00:00:00:00. So I guess the MAC address must be unique as well as fixed, otherwise Home Assistant will not work properly, but I do not know how to achieve this&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth identity creating in extended advertising</title><link>https://devzone.nordicsemi.com/thread/559336?ContentTypeID=1</link><pubDate>Thu, 22 Jan 2026 10:17:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c7316ae-f615-467b-8e5b-4dbf51a696e2</guid><dc:creator>Ivo H</dc:creator><description>&lt;p&gt;Thank you sir.I will go through the adresses you recommend.&lt;/p&gt;
&lt;p&gt;The situation is like this.I managed to run my device over PHY CODED to Home Assistant.&lt;/p&gt;
&lt;p&gt;I am using extended advertising with PHY coded.&lt;/p&gt;
&lt;p&gt;The problem is,anytime I reset the bluetooth device,it pops up in Home Assistant as a completely new device with unique adress which is not practical as I need to add the device again anytime this happens.&lt;/p&gt;
&lt;p&gt;I experienced the same problem in legacy advertising (the original sample bthome template in Zephyr tree) and this&amp;nbsp;BT_LE_ADV_OPT_USE_IDENTITY fixed the issue.&lt;/p&gt;
&lt;p&gt;But with extended advertising with&amp;nbsp;BT_LE_ADV_OPT_USE_IDENTITY the device does not show up in Home Assistant at all,but bluetoothctl in Linux command line sees the device with LECODEDTX/RX enabled, the only way I can make it visible in Home Assistant is to omit&amp;nbsp;BT_LE_ADV_OPT_USE_IDENTITY, but with the problem of unique MAC adress.&lt;/p&gt;
&lt;p&gt;I read that anytime I boot my bluetooth device I see a certain MAC address in usb printk info output at the initialization bt_enable() which is stable across reboots and this address is inside identity number 0 when I get the addressfromidentity number 0 and printit,with&amp;nbsp;BT_LE_ADV_OPT_USE_IDENTITY Zephyr stack forces bluetooth to use this identity 0 to be visible as. address.&lt;/p&gt;
&lt;p&gt;BUT without&amp;nbsp;BT_LE_ADV_OPT_USE_IDENTITY I read it generates some kind of virtual RPA adress which is derived via some IRK + random number and creates completely unique address which is updated every 15 minutes due to security,so I wanted to bypass RPA with&amp;nbsp;BT_LE_ADV_OPT_USE_IDENTITY,but that does not work.&lt;/p&gt;
&lt;p&gt;I also saw a solution where seetings_load() which should&amp;nbsp; generate a fixed RPA address which will be generated once then stored to flash and wil be used anytime the device is rebooted,but that also did not work.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am definitely not against RPA especially when you recommend it,but how to force the MAC address to be stable with RPA and also make it visible in Home Assistant?&lt;/p&gt;
&lt;p&gt;Maybe I understand it completely wrong,I am not that skilled in bluetooth.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth identity creating in extended advertising</title><link>https://devzone.nordicsemi.com/thread/559298?ContentTypeID=1</link><pubDate>Wed, 21 Jan 2026 16:12:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42fee316-7e1b-4e5f-9e3c-b3b1d95f7bf0</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Thanks for the patience here.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What sort of address do you need? I see that both the default sample and you here use&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/zephyr-apis-latest/page/group_bt_gap.html#gafbf81dab68b0e484d4742471c722fc28"&gt;&lt;span&gt;BT_LE_ADV_OPT_USE_IDENTITY,&amp;nbsp;&lt;/span&gt;&lt;/a&gt;which is ofcouse not something I&amp;#39;d recommend, but if you are not making a product here or just doing some testing I guess this is fine. &lt;a href="https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-2-bluetooth-le-advertising/topic/bluetooth-address/#ld-tab-content-14628"&gt;You can read more about address types here.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can also either give these files a go, or send me the ones you use.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*
 * Copyright (c) 2023 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include &amp;lt;zephyr/bluetooth/bluetooth.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/uuid.h&amp;gt;

#define SERVICE_DATA_LEN        9
#define SERVICE_UUID            0xfcd2      /* BTHome service UUID */
#define IDX_TEMPL               4           /* Index of lo byte of temp in service data*/
#define IDX_TEMPH               5           /* Index of hi byte of temp in service data*/

static struct bt_le_ext_adv *ext_adv;


static uint8_t service_data[SERVICE_DATA_LEN] = {
	BT_UUID_16_ENCODE(SERVICE_UUID),
	0x40,
	0x02,	/* Temperature */
	0xc4,	/* Low byte */
	0x00,   /* High byte */
	0x03,	/* Humidity */
	0xbf,	/* 50.55%  low byte*/
	0x13,   /* 50.55%  high byte*/
};

static struct bt_data ad[] = {
	BT_DATA_BYTES(BT_DATA_FLAGS, BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR),
	BT_DATA(BT_DATA_NAME_COMPLETE, CONFIG_BT_DEVICE_NAME, sizeof(CONFIG_BT_DEVICE_NAME) - 1),
	BT_DATA(BT_DATA_SVC_DATA16, service_data, ARRAY_SIZE(service_data))
};

static void bt_ready(int err)
{
	bt_addr_le_t addr;
	size_t count = 1;
	char addr_str[BT_ADDR_LE_STR_LEN];

	if (err) {
		printk(&amp;quot;Bluetooth init failed (err %d)\n&amp;quot;, err);
		return;
	}

	printk(&amp;quot;Bluetooth initialized\n&amp;quot;);

	/* Get and print the Bluetooth address */
	bt_id_get(&amp;amp;addr, &amp;amp;count);
	bt_addr_le_to_str(&amp;amp;addr, addr_str, sizeof(addr_str));
	printk(&amp;quot;Bluetooth MAC address: %s\n&amp;quot;, addr_str);

	/* Create extended advertising set with coded PHY */
	err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CODED_NCONN_IDENTITY, NULL, &amp;amp;ext_adv);
	if (err) {
		printk(&amp;quot;Failed to create advertising set (err %d)\n&amp;quot;, err);
		return;
	}

	/* Set advertising data */
	err = bt_le_ext_adv_set_data(ext_adv, ad, ARRAY_SIZE(ad), NULL, 0);
	if (err) {
		printk(&amp;quot;Failed to set advertising data (err %d)\n&amp;quot;, err);
		return;
	}

	/* Start extended advertising */
	err = bt_le_ext_adv_start(ext_adv, BT_LE_EXT_ADV_START_DEFAULT);
	if (err) {
		printk(&amp;quot;Advertising failed to start (err %d)\n&amp;quot;, err);
		return;
	}
}

int main(void)
{
	int err;
	int temp = 0;

	printk(&amp;quot;Starting BTHome sensor template with coded PHY\n&amp;quot;);

	/* Initialize the Bluetooth Subsystem */
	err = bt_enable(bt_ready);
	if (err) {
		printk(&amp;quot;Bluetooth init failed (err %d)\n&amp;quot;, err);
		return 0;
	}

	for (;;) {
		/* Simulate temperature from 0C to 25C */
		service_data[IDX_TEMPH] = (temp * 100) &amp;gt;&amp;gt; 8;
		service_data[IDX_TEMPL] = (temp * 100) &amp;amp; 0xff;
		if (temp++ == 25) {
			temp = 0;
		}
		err = bt_le_ext_adv_set_data(ext_adv, ad, ARRAY_SIZE(ad), NULL, 0);
		if (err) {
			printk(&amp;quot;Failed to update advertising data (err %d)\n&amp;quot;, err);
		}
		k_sleep(K_MSEC(BT_GAP_ADV_SLOW_INT_MIN));
	}
	return 0;
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#
# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
#
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME=&amp;quot;BTHome template&amp;quot;
CONFIG_BT_EXT_ADV=y
CONFIG_BT_CTLR_PHY_CODED=y
CONFIG_BT_PHY_UPDATE=y
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth identity creating in extended advertising</title><link>https://devzone.nordicsemi.com/thread/558609?ContentTypeID=1</link><pubDate>Tue, 13 Jan 2026 14:28:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ca5486e-4263-4a03-84af-0b98a27e9098</guid><dc:creator>Ivo H</dc:creator><description>&lt;p&gt;When using BT_LE_ADV_OPT_USE_IDENTITY in params:&amp;nbsp;struct bt_le_adv_param param =&lt;br /&gt; BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_EXT_ADV |&lt;br /&gt; BT_LE_ADV_OPT_USE_IDENTITY |&lt;br /&gt; BT_LE_ADV_OPT_CODED,&lt;br /&gt; BT_GAP_ADV_SLOW_INT_MIN, \&lt;br /&gt; BT_GAP_ADV_SLOW_INT_MAX, NULL);&lt;/p&gt;
&lt;p&gt;It does not pop up in Home Assistant at all, no device is visible, without that, it at least is detected in Home Assistant, but with unique MAC address every time the device is restarted&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth identity creating in extended advertising</title><link>https://devzone.nordicsemi.com/thread/558606?ContentTypeID=1</link><pubDate>Tue, 13 Jan 2026 14:27:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7dc927ae-324a-44c2-a2b2-ede20cef2a8a</guid><dc:creator>Ivo H</dc:creator><description>&lt;p&gt;Exactly, before switching to extended advertising, it worked perfectly.&lt;/p&gt;
&lt;p&gt;In this post:&lt;/p&gt;
&lt;p&gt;&lt;a id="i2" href="https://devzone.nordicsemi.com/f/nordic-q-a/100063/setting-bluetooth-mac-address/427087"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/100063/setting-bluetooth-mac-address/427087&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;the guy is using&amp;nbsp;&amp;nbsp;BT_LE_ADV_OPT_USE_IDENTITY in BT_LE_ADV_PARAM which does not work for me, but he is probably using legacy advertising, not extended.&lt;/p&gt;
&lt;p&gt;No I am trying to set up permanent MAC address, because I somehow think it is related to the the usb printout of bluetooth stack initilization when logging enabled:&lt;/p&gt;
&lt;p&gt;[00:00:02.140,045] &amp;lt;err&amp;gt; bt_id: Only random static identity address supported&lt;br /&gt;[00:00:02.144,348] &amp;lt;inf&amp;gt; bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)&lt;br /&gt;[00:00:02.144,378] &amp;lt;inf&amp;gt; bt_hci_core: HW Variant: nRF52x (0x0002)&lt;br /&gt;[00:00:02.144,409] &amp;lt;inf&amp;gt; bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 4.1 Build 0&lt;br /&gt;[00:00:02.144,866] &amp;lt;inf&amp;gt; bt_hci_core: Identity: F5:59:E4:A3:3B:84 (random)&lt;br /&gt;[00:00:02.144,897] &amp;lt;inf&amp;gt; bt_hci_core: HCI: version 5.4 (0x0d) revision 0x0000, manufacturer 0x05f1&lt;br /&gt;[00:00:02.144,927] &amp;lt;inf&amp;gt; bt_hci_core: LMP: version 5.4 (0x0d) subver 0xffff&lt;/p&gt;
&lt;p&gt;I was trying to achieve this with either this:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;id = bt_id_create(&amp;amp;static_addr, NULL);&lt;/p&gt;
&lt;p&gt;struct bt_le_adv_param param =&lt;br /&gt; BT_LE_ADV_PARAM_INIT(&lt;br /&gt; BT_LE_ADV_OPT_EXT_ADV |&lt;br /&gt; BT_LE_ADV_OPT_CODED,&lt;/p&gt;
&lt;p&gt;BT_GAP_ADV_FAST_INT_MIN_2,&lt;br /&gt; BT_GAP_ADV_FAST_INT_MAX_2,&lt;br /&gt; NULL);&lt;/p&gt;
&lt;p&gt;param.id = id;&lt;/p&gt;
&lt;p&gt;err = bt_le_ext_adv_create(&amp;amp;param, NULL, &amp;amp;adv);&lt;/p&gt;
&lt;p&gt;But the result is:&lt;/p&gt;
&lt;p&gt;Failed to create advertiser set (err -22)&lt;/p&gt;
&lt;p&gt;or this:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li class="ps-2"&gt;
&lt;p&gt;&lt;span class="font-ligatures-none whitespace-pre-wrap"&gt;&lt;code&gt;bt_ctlr_set_public_addr()&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span class="font-ligatures-none whitespace-pre-wrap"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth identity creating in extended advertising</title><link>https://devzone.nordicsemi.com/thread/558596?ContentTypeID=1</link><pubDate>Tue, 13 Jan 2026 13:59:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7986afb5-06cb-423f-8315-aedb36e7e4f1</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;First of all I have to say that the &lt;span&gt;BTHome template sample is not made by Nordic per se, and I am not familiar with it myself. However I do not see why any of this shouldn&amp;#39;t work. In this previous case you see a situation that &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/107066/new-random-static-bluetooth-address-after-every-boot-with-matter/462684"&gt;reminds me a bit of yours&lt;/a&gt;, though I am not sure if&amp;nbsp;a &amp;quot;BTHome&amp;nbsp;spec&amp;quot; mandates a certain type of address, or if it can use an IRK key.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="margin:0;padding:0;"&gt;Might be misunderstanding you somewhere here, but it sounds like you want a random static address tied to an id, and&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/bluetooth/peripheral_with_multiple_identities/README.html#overview" rel="noopener noreferrer" target="_blank"&gt;this sample&lt;/a&gt;&amp;nbsp;should show how to do that. &lt;a href="https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-2-bluetooth-le-advertising/"&gt;The DevAcademy can also be a great resource here.&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
[quote user=""]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[/quote]
&lt;p&gt;So this was not the case earlier, before switching to extended advertising?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>