JN5169, JN-SW-4170 : Overriding on/off and level control clusters

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

JN5169, JN-SW-4170 : Overriding on/off and level control clusters

617 Views
embed74
Contributor I

Hi all,

Was wondering if you could help with an issue I'm seeing during development of a ZigBee light bulb device. This has been based on the JN-AN-1218 project. The problem I'm having is that I want to be able to set the On/Off and Level Control server clusters locally using switches, overriding the values that have been set by the co-ordinator. The method I have used is to update the Dimmable Light instance sLight, for example :

sLight.sOnOffServerCluster.bOnOff = bOnOff;

where bOnOff is the value I am setting locally. I then call ZCLSaveRecord() to store. This appears to work fine when joined to a Philips Hue bridge, but not with a co-ordinator that uses the ZA key such as the JN-AN-1217 base device project. The issue I see is that after adjusting level control to dim the bulb, and then attempting to switch the bulb off locally using the switch, the output goes to off very briefly before switching back on again. If I toggle the bulb state directly from the co-ordinator, the physical switch works OK again until another dimming process is started, then the problem returns.

I can see from the debug output that there is a call to eCLD_OnOffSetState(1,1) from the ZCL.

Looking at the code in the ZCL, it seems the off state is detected by the eCLD_LevelControlUpdate() function in LevelControl.c which detects a transition and switches the bulb back on. I am a bit confused as to why this only happens with this type of co-ordinator and as to what to do about it.

Any advice welcome. Thanks!

0 Kudos
2 Replies

590 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi,

I am not sure if I am following. You are working with the 1218 Dimmable Light example and you are trying to set On/Off and Level Control server clusters locally using switches.
 
For example, the light joins to the coordinator and the value is ON, but you want to change it to OFF. I am not sure if you want to change the status with a switch of by default the router sets as off.
 
Are you working with the JN-AN-1217 Coordinator?
Could you please explain again the issue that you have?
If you have any diagram will be nice.

Regards,

Mario

0 Kudos

580 Views
embed74
Contributor I

Hi Mario,

The ZigBee dimmable light control device I am developing is based on JN-AN-1218 but in my application has a local on/off push button switch which is supposed to override the cluster value that has been set on the network. I am testing interaction with 3 different co-ordinators. The first is the dongle build of JN-AN-1217, the second a commercially released product which also uses the ZA key (although I don't think that's relevant to this issue) and finally a Philips Hue bridge. With the first two, the issue occurs after dimming using the Level Control client cluster. The light dims up or down as expected but then attempting to switch the bulb off locally using the switch on the light bulb control device results in the bulb momentarily switching off then on again within 100ms. With the Philips Hue system, I am able to dim using the Hue app then switch the bulb off locally with the switch no problem, and the bulb stays in the off state.

I did some more investigation and some of what I wrote in the original post is not quite right. What I think is happening is that when the level control cluster is periodically updated by the light bulb application, in eCLD_LevelControlUpdate(),  the parameter bWithOnOff is checked. If this has been set to TRUE at the client side, the following code detects that the application has set bOnOff to FALSE (via a local switch press) and calls  eCLD_OnOffSetState(1,TRUE) which results in the bulb switching on again.

if(psCommon->sTransition.bWithOnOff == TRUE)

{

    if(psCommon->sTransition.iCurrentLevel > (CLD_LEVELCONTROL_MIN_LEVEL * 100))

    {

        if(bOnOff == FALSE)

        {

            #if (defined CLD_ONOFF) && (defined ONOFF_SERVER)

                eCLD_OnOffSetState(u8SourceEndPointId, TRUE);

            #endif

        }

    }

    else

    {

        if(bOnOff == TRUE)

        {

            #if (defined CLD_ONOFF) && (defined ONOFF_SERVER)

                eCLD_OnOffSetState(u8SourceEndPointId, FALSE);

            #endif

        }

    }

}

I assume when using the Philips Hue bridge, bWithOnOff is FALSE so I don’t see the same issue with this use case. The workaround is to simply comment the above code out of LevelControl.c but I don’t think this is the best solution, I don’t really want to modify SDK files inside JN-4170 for one thing. Could you let me know if there’s a better way of dealing with this by making changes to the application code please? Since I won’t have control of what the co-ordinator is doing once we get to release stage, changing the bWithOnOff parameter to FALSE at the client side is not an option.

Thanks for your help.

0 Kudos