HomeHome AutomationAdding unsupported devices to Zigbee2MQTT

Adding unsupported devices to Zigbee2MQTT

What if you have a Zigbee device which is not listed on supported devices?

The pairing process for the IKEA and Xiaomi devices went well. It was also easy with the Zemismart Zigbee RGB Downlight (review soon), but I was not able to read the state or control the device as the Zemismart Zigbee RGB Downlight was not on the list of the supported devices. I thought I would cover the procedure in case you get stuck on how to add new devices to Zigbee2MQTT.

Pairing new devices to Zigbee2MQTT

The pairing depends on the manufacturer’s instructions, so please refer to that to learn how to enter the correct pairing state via reset. While pairing IKEA and Aqara remotes lights and sensors is described well in the guide already, you don’t get many clues for other devices. Make sure your configuration.yaml file has permit_join: true.

#open configuration file
sudo nano /opt/zigbee2mqtt/data/configuration.yaml

 #Stopping zigbee2mqtt
 sudo systemctl stop zigbee2mqtt

 #Starting zigbee2mqtt
 sudo systemctl start zigbee2mqtt
 
 #View the log of zigbee2mqtt
 sudo journalctl -u zigbee2mqtt.service -f 

Just hold the device close in the pairing mode until you see the following lines:

zigbee2mqtt:warn 6/7/2019, 12:26:07 PM Message without device!
 zigbee2mqtt:info 6/7/2019, 12:26:16 PM New device 'undefined' with address 0x00124b001c889570 connected!
 zigbee2mqtt:info 6/7/2019, 12:26:16 PM MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"device_connected","message":"0x00124b001c889570","meta":{}}'
 zigbee2mqtt:warn 6/7/2019, 12:26:16 PM Device with modelID 'undefined' is not supported.
 zigbee2mqtt:warn 6/7/2019, 12:26:16 PM Please see: https://www.zigbee2mqtt.io/how_tos/how_to_support_new_devices.html

This means your device is paired and you can open the configuration.yaml and name it. It will be listed as the last device on the list:

'0x00124b001c889570':
     friendly_name: ' 0x00124b001c889570'
     retain: false

change to:

 '0x00124b001c889570':
     friendly_name: 'spotlight'
     retain: false 

Save the file and restart your Zigbee2MQTT service or reboot the Raspberry Pi. At this point, you are ready to add the new device to the list.

Buy USB Zigbee Stick CC2531

Buy it using these links to support NotEnoughTech.

At this point, do yourself a favour and keep the device close to the cc2531. I got frustrated and I wanted to continue my work downstairs and I took the device outside of the Zigbee network without realising.

To control the new device I had to modify the node_modules/zigbee-herdsman-converters/devices.js file. Without this, I would not be able to send any commands. Open:

sudo nano /opt/zigbee2mqtt/node_modules/zigbee-herdsman-converters/devices.js

Then add the new device according to the template:

{
    zigbeeModel: ['lumi.sens'], // The model ID from: Device with modelID 'lumi.sens' is not supported.
    model: 'WSDCGQ01LM', // Vendor model number, look on the device for a model number
    vendor: 'Xiaomi', // Vendor of the device (only used for documentation and startup logging)
    description: 'MiJia temperature & humidity sensor ', // Description of the device, copy from vendor site. (only used for documentation and startup logging)
    supports: 'temperature and humidity', // Actions this device supports (only used for documentation)
    fromZigbee: [], // We will add this later
    toZigbee: [], // Should be empty, unless device can be controlled (e.g. lights, switches).
},

Pay closer attention to the: fromZigbee: [] & toZigbee: [] as these can be replaced with:

extend: generic.light_onoff_brightness_colortemp,

If you look at the top of the template file (at the top), you will see a couple of control templates stored under generic.xxxxx hue.xxxx and gledopto.xxxx. Check what control/and report capabilities your device comes with and add a single extend line instead.

 extend: generic.light_onoff_brightness_colortemp, 

is equal to:

fromZigbee: generic.light_onoff_brightness_colortemp.fromZigbee,
toZigbee: [tz.gledopto_light_onoff_brightness, tz.gledopto_light_colortemp, tz.ignore_transition, tz.light_alert,],

Since I know that my device supports toggle, dimming, and colour controls I have added the following config

{
    zigbeeModel: ['NUET56-DL27LX1.1'], 
    model: 'LXZB-12A', 
    vendor: 'Zemismart', 
    description: 'RGB LED Downlight', 
    supports: 'RGB, Dimming',
    extend: gledopto.light_onoff_brightness_colortemp_colorxy
},

I didn’t have to recalculate any values, but your case might be different. Zigbee2MQTT page mentioned that you might need to do this if your Zigbee protocol isn’t compatible. Since I had no device to test it on, I won’t be able to help you there.

Zigbee2MQTT control basics

Once your device is configured, we can add the MQTT nodes to control it. To read the status of your device add MQTT in node and debug with:

zigbee2mqtt/devicename

swap the appropriate values if you edited the Zigbee2MQTT topic and enter your device name. If you issue the following JSON:

{
     "state": ""
 }

To the zigbee2mqtt/devicename/getMQTT out node – you will receive status update looking like this:

{"topic":"zigbee2mqtt/spotlight1","payload":"{\"state\":\"ON\",\"linkquality\":78,\"brightness\":254,\"color\":{\"x\":0.6173,\"y\":0.3694},\"color_temp\":155}","qos":0,"retain":false,"_msgid":"9de88d8c.894a5"}

If you want to control the Zigbee device, just send the JSON message:

{
     "state": "ON",
     "brightness": 255,
     "color_temp": 155,
     "color": {
         "hex": "#ea770b"
     }
 }

To zigbee2mqtt/devicename/set with the changes you want to make. You don’t have to pass all the data, only the JSON values you want to set.

Possible issues?

Interference from Raspberry Pi is also a known factor. If your device is working fine in terminal but you are not able to pair new devices, try connecting the coordinator via USB extension cable and move it away from Raspberry Pi.

If you already have some devices in the network – especially end devices, you could be at the limit of the coordinator and you need a more powerful one – take a look at CC2652R from Electrolama and the flash guide to increase the count to 50 direct children and 200 devices.

Conclusion

The process isn’t as beginner-friendly as adding Xiaomi or IKEA devices, but with time, the list of supported devices will get bigger. Now you should know how to add and use new devices in Zigbee2MQTT. Soon I will show you cool control scenarios using various remote controllers. If you have any questions, feel free to ask it in this Reddit thread.

PayPal

Nothing says "Thank you" better than keeping my coffee jar topped up!

Patreon

Support me on Patreon and get an early access to tutorial files and videos.

image/svg+xml

Bitcoin (BTC)

Use this QR to keep me caffeinated with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU

Smart Ideas with

Automate your space in with these ecosystems and integrate it with other automation services

client-image
client-image
client-image
client-image
client-image
client-image
client-image
client-image
client-image

Learn NodeRED

NodeRED for beginners: 1. Why do you need a NodeRED server?

0
To server or not to server? That's a very silly question!

Best Automation Projects

Nora – Google Assistant in NodeRED

0
Integrate Google Assistant with NodeRED thanks to Nora - NodeRED home automation

NEST your old thermostat under $5

0
Nest-ing up your older thermostat under $5

Tuya SDK for beginners: Intro to Tuya Cloud API

0
Working with Tuya Cloud API. A guide to Cloud automation for beginners, get started with REST!

Sonoff R3 DIY mode & why it sucks

0
Long awaited Sonoff R3 DIY mode is even worse than I expected.

Things they don’t tell you about IKEA Trådfri

0
There are things you should know about IKEA Tradfri before you make your purchase

Smart Home

Is Sonoff NSPanel the future we all wanted?

0
First look at Sonoff NSPanel - a touch screen display for your light switch! Is this the future of automation?

Getting started with Sonoff ZIGBEE 3.0 USB DONGLE PLUS

0
Testing Sonoff ZIGBEE 3.0 USB DONGLE PLUS against CC2531 and zzh (electrolama) - is it the best upgrade to your Zigbee network?

Can touch this: M5Stack Core2

0
M5Stack Core2 brings touch interface to the table, new UIFlow options which make programming super easy

Aqara Roller Shade Driver E1 & Zigbee2MQTT

0
Taking Aqara E1 apart, adding it to Zigbee2MQTT and NodeRED. This time with sunset/sunrise and temp controls

Testing Imou Ranger 2C 2MP & 4MP

0
Imou Ranger 2C comes in 2 flavours 1080P and 2K so let's compare them side by side and see which one is for you