This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Update status of SampleLight

Other Parts Discussed in Thread: CC2530, CC2531

Hello,

"How do I make it so the Smartthings app will immediate pick up the status of the device when I manually toggle the device form the on to off." 

I've been trying to work with the example SampleLight program and everytime I manually toggle the CC2530 EndDevice from on to off, the Smartthings hub/Coordinator isn't able to pick up the EndDevice's current status. I had tried the below code, but the Smartthings app only updates the status of the device when I press the refresh button, instead of automatically updating the status. I've asked the Smartthings community, but I haven't gotten any answers from there. My post there is: community.smartthings.com/.../22. I believe there is more to fixing the IAR code than there is with the Smartthings code. 

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Example of my problem here: 

1) I manually turned the switch off and the Smartthings app still says it's on.

2) I either press the refresh button to get the device status of off or I press the app's off button to match the device's current status.

3) The I repeat the setup over and over again which is a lot of hassle.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Code that I tried:

static void zclSampleLight_OnOffCB( uint8 cmd )
{
afIncomingMSGPacket_t *pPtr = zcl_getRawAFMsg();

zclSampleLight_DstAddr.addr.shortAddr = pPtr->srcAddr.addr.shortAddr;

zclReportCmd_t rptcmd;

// Turn on the light
if ( cmd == COMMAND_ON )
{
zclSampleLight_OnOff = LIGHT_ON;
}
// Turn off the light
else if ( cmd == COMMAND_OFF )
{
zclSampleLight_OnOff = LIGHT_OFF;
}
// Toggle the light
else if ( cmd == COMMAND_TOGGLE )
{
if ( zclSampleLight_OnOff == LIGHT_OFF )
{
zclSampleLight_OnOff = LIGHT_ON;
}
else
{
zclSampleLight_OnOff = LIGHT_OFF;
}
}

////////////update

rptcmd.numAttr = 1;
rptcmd.attrList[0].attrID = ATTRID_ON_OFF;
rptcmd.attrList[0].dataType = ZCL_DATATYPE_BOOLEAN;
rptcmd.attrList[0].attrData = (uint8*)&zclSampleLight_OnOff;
zcl_SendReportCmd(SAMPLELIGHT_ENDPOINT, 0, ZCL_CLUSTER_ID_GEN_ON_OFF, &rptcmd, ZCL_FRAME_CLIENT_SERVER_DIR, false, 0 );

#if ZCL_LEVEL_CTRL
zclSampleLight_DefaultMove( );
#endif

// update the display
zclSampleLight_LcdDisplayUpdate( );
}