<?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>Receiving publication messages from a battery model serve</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87444/receiving-publication-messages-from-a-battery-model-serve</link><description>I asked this question in a different form but not getting any answers on that thread. 
 My goal is to publish battery level messages to a certain address and receive it on all devices that subscribe to that publication 
 I&amp;#39;m beginning to suspect that</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 17 May 2022 03:36:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87444/receiving-publication-messages-from-a-battery-model-serve" /><item><title>RE: Receiving publication messages from a battery model serve</title><link>https://devzone.nordicsemi.com/thread/368131?ContentTypeID=1</link><pubDate>Tue, 17 May 2022 03:36:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2391dcbd-86e5-4cae-a805-cf7b4cd64a09</guid><dc:creator>AndyM</dc:creator><description>&lt;p&gt;Turns out this was an operator error&lt;br /&gt;Here are the commands to make it work&lt;br /&gt;1. provision device&lt;/p&gt;
&lt;pre class="c-mrkdwn__pre"&gt;uart:~$ mesh init
Mesh shell initialized
uart:~$ mesh dst 0x00ab
Destination address set to 0x00ab
uart:~$ mesh app-key-add 0 0 522975C06BCADCBBF4A402DF2F895226
AppKey added, NetKeyIndex 0x0000 AppKeyIndex 0x0000
uart:~$ mesh mod-app-bind 0x00ab 0 0x100c &amp;lt;-- bind with the battery server model
AppKey successfully bound
uart:~$ mesh mod-app-bind 0x00ab 0 0x100d &amp;lt;-- bind with the battery client model
AppKey successfully bound
uart:~$ mesh mod-pub 0x00ab 0x100c 0xC100 0 0 255 10 0 0 &amp;lt;--publish battery messages
Model Publication successfully set
uart:~$ mesh mod-sub-add 0x00ab 0xC100 0x100d &amp;lt;--- subscribe to battery messages
Model subscription was successful&lt;/pre&gt;
&lt;p&gt;In&amp;nbsp;&amp;nbsp;the application&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;struct&lt;/span&gt;&lt;span&gt; bt_mesh_battery_srv _batt_srv = &lt;/span&gt;&lt;span&gt;BT_MESH_BATTERY_SRV_INIT&lt;/span&gt;&lt;span&gt;(batt_get);&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;struct&lt;/span&gt;&lt;span&gt; bt_mesh_battery_cli &amp;nbsp;_batt_client = &lt;/span&gt;&lt;span&gt;BT_MESH_BATTERY_CLI_INIT&lt;/span&gt;&lt;span&gt;(&amp;amp;batt_cli_handler);&lt;br /&gt;batt_get is called at publication intervals to get the battery measurement&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;batt_cli_handler is called when battery server message arrives over the mesh network.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving publication messages from a battery model serve</title><link>https://devzone.nordicsemi.com/thread/365845?ContentTypeID=1</link><pubDate>Mon, 02 May 2022 19:16:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b05f5cd0-b67f-4fc8-831b-82ff37b6e12e</guid><dc:creator>AndyM</dc:creator><description>&lt;p&gt;Thank you, I will try that and let you know&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Receiving publication messages from a battery model serve</title><link>https://devzone.nordicsemi.com/thread/365813?ContentTypeID=1</link><pubDate>Mon, 02 May 2022 14:05:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:628a352b-f2b0-498d-a89b-eeec862fd2be</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Andy,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would suggest to continue on the other case. Terje may have some delay but he will get back to you.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But anyway, I got a quick glance at the implementation of the generic battery server and&amp;nbsp;it&amp;#39;s pretty obvious that when a battery get message is sent, only the sender of the command receive the battery status. Not all the nodes that subscribe to the same address as the publication address of the server.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;What you can do instead is to call&amp;nbsp;bt_mesh_battery_srv_pub() in the server application. This call will publish the battery status to the address in the publication address that the server model configured to.&amp;nbsp;&lt;br /&gt;You can choose to call&amp;nbsp;&lt;span&gt;bt_mesh_battery_srv_pub() from the application when you receive a get&amp;nbsp;request, or you can call it only when the battery level is changed or periodically.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>