<?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>How to send buffer from light switch to light bulb?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/74036/how-to-send-buffer-from-light-switch-to-light-bulb</link><description>Hello, 
 I am using nRF52833, nRF Connect SDK v1.5.0. 
 I followed this link Zigbee: Light switch — nRF Connect SDK 1.5.0 documentation (nordicsemi.com) and successfully tested the Zigbee light switch example. 
 Now I want to send the buffer from the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 29 Apr 2021 07:37:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/74036/how-to-send-buffer-from-light-switch-to-light-bulb" /><item><title>RE: How to send buffer from light switch to light bulb?</title><link>https://devzone.nordicsemi.com/thread/307374?ContentTypeID=1</link><pubDate>Thu, 29 Apr 2021 07:37:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9ca1838-a0a5-4e9a-9839-346a50f141eb</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi Pranav,&lt;/p&gt;
&lt;p&gt;I apologize for the delayed response.&lt;/p&gt;
&lt;p&gt;Please be aware that the ON/OFF command is a command without a payload. I am not sure how using this to create your own command with a buffer payload works.&lt;/p&gt;
&lt;p&gt;You will have to parse the command in some way. You can try using&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_tz_v4.1.0/group__zcl__def__resp.html"&gt;Default response command sending and parsing&lt;/a&gt;. Incoming default response can be parsed using the following:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;zb_zcl_default_resp_payload_t* payload = ZB_ZCL_READ_DEFAULT_RESP(zcl_cmd_buf);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You can also look in the ZCL API for other ways to parse commands, as how to parse them depend on the type of command, i.e. report attribute command parsing is its own thing.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to send buffer from light switch to light bulb?</title><link>https://devzone.nordicsemi.com/thread/306298?ContentTypeID=1</link><pubDate>Thu, 22 Apr 2021 11:14:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b656543-24d9-4a92-a181-e3af17e86ca3</guid><dc:creator>Pranav3</dc:creator><description>&lt;p&gt;Hello Marte,&lt;/p&gt;
&lt;p&gt;Thank you for your reply.&lt;/p&gt;
&lt;p&gt;While referring to this link&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/46603/zigbee-sdk-zb_get_out_buf_delayed2-call-failed/185758#185758"&gt;ZIGBEE SDK ZB_GET_OUT_BUF_DELAYED2 call failed - Nordic Q&amp;amp;A - Nordic DevZone - Nordic DevZone (nordicsemi.com)&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I write same&amp;nbsp;function like &amp;quot;light_switch_send_on_off&amp;quot;&amp;nbsp;for sending my payload i.e array&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;static void User_light_switch_send_on_off(zb_bufid_t bufid,zb_uint16_t cmd_id)
{
        int size;
        zb_uint8_t buf[] = {0,1,2,3,4,5,6,7};
        size = sizeof(buf);

        
	    ZB_ZCL_ON_OFF_SEND_USER_REQ(bufid,
			       bulb_ctx.short_addr,
			       ZB_APS_ADDR_MODE_16_ENDP_PRESENT,
			       bulb_ctx.endpoint,
			       LIGHT_SWITCH_ENDPOINT,
			       ZB_AF_HA_PROFILE_ID,
			       ZB_ZCL_DISABLE_DEFAULT_RESPONSE,
                   cmd_id,
			       buf,
                   size,
			       NULL);

}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define ZB_ZCL_ON_OFF_SEND_USER_REQ(                                               \
  buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, dis_default_resp,command_id, zcl_codec_ptr,size,cb)\
{                                                                                               \
  zb_uint8_t* ptr = ZB_ZCL_START_PACKET_REQ(buffer)                                             \
  ZB_ZCL_CONSTRUCT_SPECIFIC_COMMAND_REQ_FRAME_CONTROL(ptr, dis_default_resp)                    \
  ZB_ZCL_CONSTRUCT_COMMAND_HEADER_REQ(ptr, ZB_ZCL_GET_SEQ_NUM(), command_id); \
  for (zb_uint8_t i = 0; i &amp;lt; size; i++)                                        \
  {                                                                             \
  ZB_ZCL_PACKET_PUT_DATA8(ptr, (zcl_codec_ptr[i]));                              \
  }                                                                               \
  ZB_ZCL_FINISH_PACKET(buffer, ptr)                                               \
  ZB_ZCL_SEND_COMMAND_SHORT(buffer, addr, dst_addr_mode, dst_ep, ep, prof_id, ZB_ZCL_CLUSTER_ID_ON_OFF, cb); \
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;But while receiving on light_bulb side on &amp;quot;zcl_device_cb&amp;quot; function I am not able to extract my payload i.e array.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Am I doing something wrong?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you please help me to resolve this issue?&lt;/p&gt;
&lt;p&gt;Thank you,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Pranav&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to send buffer from light switch to light bulb?</title><link>https://devzone.nordicsemi.com/thread/305210?ContentTypeID=1</link><pubDate>Fri, 16 Apr 2021 06:51:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c9b5a0b-f588-4948-8e9d-b030d32c4069</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If you want to turn the bulb on/off you should use the on/off cluster as is done in the&amp;nbsp;example. This is done in the function button_handler() in main.c of the light switch sample, where it sends an on/off cluster command to the light bulb if&amp;nbsp;either the on button or the off button&amp;nbsp;are pressed. It allocates the output buffer and send on/off command with the following:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;zb_err_code&lt;/span&gt;&lt;span&gt;&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;zb_buf_get_out_delayed_ext&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;light_switch_send_on_off&lt;/span&gt;&lt;span&gt;,&amp;nbsp;&lt;/span&gt;&lt;span&gt;cmd_id&lt;/span&gt;&lt;span&gt;,&amp;nbsp;&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This will not send the command directly, but schedules a callback for execution if the buffer is available, where the callback in this case is the callback function light_switch_send_on_off(), which actually is responsible for sending the on/off command with&amp;nbsp;ZB_ZCL_ON_OFF_SEND_REQ().&lt;/p&gt;
&lt;p&gt;If you want to send commands in Zigbee, you have to use cluster commands, and not just send a message. If there are clusters that already do what you want to do, I would recommend using them instead of creating your own cluster first. You can check out the&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/zboss/3.3.0.6/group___z_b___z_c_l___c_l_u_s_t_e_r_s.html"&gt;ZBOSS documentation&lt;/a&gt;&amp;nbsp;for a list of clusters in the ZBOSS stack, which is the stack used in NCS, and you can also check out the&amp;nbsp;&lt;a href="https://zigbeealliance.org/wp-content/uploads/2019/12/07-5123-06-zigbee-cluster-library-specification.pdf"&gt;Zigbee Cluster Library Specification&lt;/a&gt;. They will give you information about which commands exist in the different clusters and how to use them. The clusters that are already implemented in the light switch and light bulb samples are Basic, Identify, Scenes, Groups, On/Off, and Level Control.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to send buffer from light switch to light bulb?</title><link>https://devzone.nordicsemi.com/thread/305131?ContentTypeID=1</link><pubDate>Thu, 15 Apr 2021 13:57:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03cd7f5a-9138-4465-b168-83b346e97d31</guid><dc:creator>Pranav3</dc:creator><description>&lt;p&gt;Hi Marte,&lt;/p&gt;
&lt;p&gt;I wanted to send a custom message i.e buffer (for ex. array) from light switch to light bulb.&lt;/p&gt;
[quote userid="92402" url="~/f/nordic-q-a/74036/how-to-send-buffer-from-light-switch-to-light-bulb/305121#305121"]What is it you want to achieve by sending this buffer?[/quote]
&lt;p&gt;By sending this custom message I wanted to perform some action i.e bulb on/off, set threshold, log that message etc.&lt;/p&gt;
&lt;p&gt;Do I need to create&amp;nbsp;&lt;span&gt;custom clusters for that?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Pranav.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to send buffer from light switch to light bulb?</title><link>https://devzone.nordicsemi.com/thread/305121?ContentTypeID=1</link><pubDate>Thu, 15 Apr 2021 13:21:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7f893ea-92fa-4e25-8804-385c26482456</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Which buffer do you want to send? Is there a specific cluster command you want to send? The command you send must be something that corresponds with the Zigbee specification, such as a cluster command. What is it you want to achieve by sending this buffer?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>