This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Trying to send from a switch to a coordinator

This is probably a very easy question to answer and I apologise for not fining the solution myself but I have been trolling through the documentation for several hours now with no light in sight.

All the examples provided for Zigbee devices are set up to communicate directly from one device to another, eg. switch to light bulb. However, in the real world of home automation this is not the way it appears to work. Home automation networks have a coordinator that not only establishes the network and handles security but also manages all the interactions between devices. Switches do not talk to light bulbs directly but simply send their commands tot he coordinator or hub which is then responsible for deciding what to do in response to the command.

My problem is that there does not appear to be any documentation, at least not that I have found so far, that explains how to address the command correctly to send it to the coordinator. The coordinator is always address 0 but what about the endpoint? In my situation, using a SmartThings hub, the endpoint does not seem to matter as long as the address is set to 0. Is this correct? Is this the best practice or am I missing something here?

Parents
  • Hello,

    I am not sure if I understand your question correctly, but I'll give it a go.

    Not all messages go through the coordinator, but the coordinator is the first node in the network, the node that created the network, and the current coordinator will always have address 0.

    The ZigBee network is dynamic, so when the network is operative, the nodes will, based on the distance and signal strength of the messages between the nodes, and store this in the routing table. Hence, you can't decide which path a specific message should go. You can only control the destination address. So if the distance between two nodes has a shorter and/or more reliable path than the path through the coordinator, then this route will always be used between these nodes.

    Now, if you want to send a message to node 0, you can do this by addressing it to node 0. What sort of message do you intend to send? Does the coordinator have any endpoints that you want to use?

    Best regards,

    Edvin

  • Whilst a seasoned user of home automation I am new to development of devices. I am familiar with two hubs from a user standpoint. Mixtile and SmartThings. In both of these environments the hub supports multiple protocols, primarily Zigbee and ZWave. For Zigbee it performs the coordinator role setting up the network and commissioning new devices but it also acts as a central controller for all messages. When a door sensor detects a door opening it sends a message out but it is not directly bound to any other device in the network. Only the hub receives the message and processes it where it makes the decision about what to do with the information. For instance, if it is late at night it might turn on a light or if it has been told to home owner is on holiday it might send a text message or sound an alarm to scare off an intruder. You could not have that level of sophistication by simply binding devices to each other.

    My problem is, looking at the example code for the light switch demo, the switch is bound to the light bulb and does not send any message when it is activated if it did not find a suitable bulb with which to bind. If I start it up on my current system it joins the network and simply binds to the first bulb it can find. If I tell it not to bind then it does not send the message at all.

    I do not know what the hub looks  from a device standpoint but I can just tell the code to send the message to address 0 with an arbitrary endpoint and I see some activity in the hub log. It seems unlikely that the hub would advertise end points for every possible device type so in my mind I am thinking that there must be another approach that I am missing.

    In addition, if I allow the switch to bind to a light build the hub never sees the message, at least in its log, presumably because it is not addressed to it, which is not how it appears to work when using commercially available devices. It would seem that even if binding takes place there should be some message sent to the hub so it knows what is going on.

    Maybe I am over thinking this but as I said in my original question the topology defining a central controller does not seem to have been discussed even though that appears to be the default in the case of home automation.

    I did find mention of a binding mechanism where there is some form of central dispatch relieving the source of the burden of maintaining the binding information so perhaps this is the mechanism I am looking for but I could not find anything in the Nordic documentation of the ZBOSS stack implementation that referred to this and tells how to initiate and use that sort of binding.

    As always, thanks for your excellent and super responsive help. 

  • Hello,

    I had to discuss this with one of our engineers who has worked more closely with the ZigBee stack.

    Zigbee Coordinators are free to act as any zigbee client, but there is no part of Zigbee saying that devices must report everything to the hub. If they get notifications, it means that the hub has implemented client clusters for all the devices which it wants to support. So the hubs must see that when a new device joins the network, and it sees that it is a device that it wants to keep track of, it must subscribe to the attribute changes using ZCL reporting.

    The logic of turning on lights and so on based on a doorlock must also be implemented in the hub. If you have a ZigBee sniffer, then this would probably be more clear. Unfortunately we don't have any devices capable of that at this point in time, but there are other devices on the marked that is made for this.

    Best regards,

    Edvin

  • Having now got a sniffer working it seems that all the devices in my network, with the exception of the Nordic light bulb demo, send attribute reports to the coordinator whenever an attribute value is changed.

    I looked at the attribute reporting functions in the API and there is one called zb_zcl_start_attr_reporting. I tried to call this passing the endpoint number, ON_OFF_Cluster_ID, SCL_Cluster_Server_Role and ZCL_Attr_On_Off_On_Off_ID. The call failed with the RET_DOES_NOT_EXIST result.

    There do not appear to be any examples using this function and the documentation does now explain when it should be used or what it is really doing let alone what should actually be passed to it. Is this the correct approach and if so what could I be doing wrong?



  • Hello,

    Are you trying to implement this on the light_bulb example? If so, have you declared the ON_OFF_Cluster? Or are you really using the dimmable light cluster?

    RET_DOES_NOT_EXIST usually refers to the cluster not being present, or initialized. Is it possible to send the project?

    Best regards,

    Edvin

Reply Children
No Data
Related