Create a DIY Zigbee Switch (S2C / S2C PRO)

Hi All,
My idea is to create a own zigbee switch/dimmer and pair it with gateway.

  1. I used digi xstick and configured it.
  2. Got a Digi S2C zigbee module and changed parameters like PAN ID, Channels etc so that it is pairable
  3. The gateway detected it as a thing (unknown device type)

This is where I am now. Now i want this thing to be detected as a onOff switch / dimmable switch and then control the corresponding relay / triac based dimmer.

Any hints on how to make this thing as a switch? Anyone tried with S2C modules and a custom switch? Any pointers are welcome.

I am in parallel trying the custom firmware on meshbee which is kind of clone of Hue. But i prefer the previous approach.

Thanks for the help,
Vijay

I have played with the XBee Zigbee Mesh Kit and configured S2C modules as a controller, router and end device with the XCTU software. I never got as far as figuring out how to get them to use clusters from the Zigbee Home Automation profile though, which is what the gateway’s Zigbee adapter is looking for.

I asked Digi about this and they sent me a link to configure the S2C for the Home Automation profile https://forms.na1.netsuite.com/app/site/hosting/scriptlet.nl?script=457&deploy=2&compid=818164&h=5928a16f2b6f9582b799&article=zigbee-home-automation

That’s as far as I got though, I couldn’t figure out what to do next. @dhylands may have some ideas?

Thanks for the info. I have seen the link and I did configure by XBees with these parameters. The gateway (xstick) is able to detect the S2C as a thing (unknown thing) as of now (with these configurations).

But the inclusion process is about announcing the device and then sending the endpoints information back to controller. See the post below, a pretty old post but it explains how devices are included in the network.
https://www.falco.co.nz/electronic-projects/xbee-to-smartthings

There, finally the controller needs some additional information to detect it as a on/off switch. I don’t know how that happens in the mozilla gateway here.

Also what I don’t understand is, as part of end-point-announce process the HA profile has some parameter to say this device is on/off switch. But still in the link above this device is detected as unknown type. If the endpoint type is onoff why do you need additional device driver? I fail to understand this.
Regards,
Vijay

The zigbee adapter uses a classifier to determine the type of device that it found. The code can be found here:

In particular, for an on-off switch, it looks for an endpoint with cluster number 6, which is called the “General On/Off” cluster.

It was super useful. I was able to add my Zigbee S2C as a on/off switch. Thank you very much for the hint.

Now after adding it to UI, i get an error message
“getValue for property on for: zb-xxxxxxxx-thing returning undefined”

Looks like the thing has no property for on/off. Any hint on resolving this error?

Thanks for the help,
Best Regards, Vijay

The fact that it haw “-thing” at the end means that it was able to see your device, but the classifier still didn’t detect the right clusters. If the right clusters are detected then it would have shown up as “-onOffSwitch”

If you start the gateway using the command:

npm start -- -d

Then you can use the get-devices.sh script from https://github.com/mozilla-iot/curl-examples (you’ll need to using login.sh first). This will print some output which includes the clusters that were recognized. With my Centralite smart plug, the cluster portion of the output looks like this:

    "activeEndpoints": {
        "1": {
            "deviceId": "0100",
            "deviceVersion": 0,
            "inputClusters": [
                "0000 - genBasic",
                "0003 - genIdentify",
                "0004 - genGroups",
                "0005 - genScenes",
                "0006 - genOnOff",
                "0b04 - haElectricalMeasurement",
                "0b05 - haDiagnostic"
            ],
            "outputClusters": [
                "0019 - genOta"
            ],
            "populated": false,
            "profileId": "0104"
        }
    },

The fact that it shows “0006 - genOnOff” indicates that its an onOffSwitch and the “0b04 - haElectricalMeasurement” makes it a smartPlug.

The profileId would also need to correct “0104” (260 decimal) is the ZHA or home automation profile

Hi,
I ordered few Zigbee HA 1.2 devices, that why a bit late reply.

Even after upgrading to latest 0.5 version, all these devices were identified as things. Some how its not able to classify them correctly. There were smart plug, Door Sensor, Motion Sensor (multiple, light, humidity …) and CO2 sensor.

All of them seemlessly worked in openhab and even identified the profile correctly.

If you need more information i can share it also device details. Devices were imported from alibaba and they are zigbee HA 1.2 devices.

Regards, Vijay

hi Vijay,

I am trying to build own iot gateway, right now I have digi Xbee S2C modular, it connect into Arduino shield then connected to Raspberry pi 3. you case it same as me or using the usb adaptor for the Xbee S2C?

thanks
CW

You should be able to use the S2C if you load it with the coordinator firmware.

Hi @dhylands,

Sorry for posting in this old topic but I was trying to find out if an XBee S2C module can be used in place of the XStick and found this thread.

When you say load (the S2C) with the coordinator firmware, is it the same as changing the settings on XCTU? Other than the few settings mentioned by @benfrancis above, are there other settings that need to be specified (eg baud rate)? Thank you for your time!

My understanding is that there are multiple firmwares available and you need to flash the correct firmware. It’s more than just XCTU settings.

Hi Dave, thanks for that. There aren’t different firmware versions for the Xbee S2C modules. Just as an update - I couldn’t use the Xbee S2C as a dongle. Maybe it needs it’s own driver as mentioned here (Kinds of Zigbee Dongles)

edit: update to the above; I got the Xbee S2c to work as a dongle. It was a problem with my Xbee explorer (https://www.sparkfun.com/products/11812). This one has a serial device of 0403:6015. I got it to work with an older Xbee explorer (https://www.sparkfun.com/products/retired/8687) which has a serial device of 0403:6001 - and what the zigbee adapter code is looking for.

When you connect S2C to XCTU, you can also update firmware. There you will see some options. See the documentation
https://www.digi.com/resources/documentation/digidocs/90001458-13/default.htm#task/t_ts_how-to_update_firmware.htm

My intention initially was to have a cheap switch using Zigbee but then i realized that it is very complex to get it work using XBee modules. Only devices with HA profile or that can be programmed to HA profile can be paired.

Regards, Vijay

I found a blog post by someone about setting up the S2C as a coordinator. Having the different firmwares for different modes (what I was remembering) was probalby for an older xbee device.


I haven’t personally tried this, so I don’t know if it actually works or not.

Once the dongle has been configured as a coordinator, then the gateway needs to be able to recognize it. Currently it scans for particular USB VIDs/PIDs.

There is a checkbox in the zigbee configuration to allow arbitrary FTDI devices to be checked. To work with a different serial adapter will require a small code change.