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

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!

NEST your old thermostat under $5

0
Nest-ing up your older thermostat under $5

Nora – Google Assistant in NodeRED

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

DIY Smart Washing Machine – for about 15 bucks!

0
Learn how to add washing machine notifications to your Google Home on the cheap

Sonoff Zigbee Bridge – review

0
Sonoff line up will soon include Sonoff Zigbee Bridge and more Zigbee sensors - here is the first look

Smart Home

Remotes aren’t done with us yet: SwitchBot Remote

0
If you hate having 20 remotes hidden in your sofa, or your parents despise talking to Alexa to turn the lights on - SwitchBot Universal Remote is here to deal with all this!

We’ve seen this before: SwitchBot K10+ PRO

0
This is an odd one. Building on the success of SwitchBot K10+ they released SwitchBot K10+ PRO - but is the experience actually better?

Is this the smart panel we have waited for?

0
ITEAD has released a new smart panel: Sonoff NSPanel Pro 120 - have they learned the lesson from the terrible launch of the original Pro? Let's see what's new.

Aqara FP1E detects motionless humans

0
This isn't exactly a new device, it's an interaction of the original Aqara presence sensor. Aqara FP1E brings Matter, ZigBee and new triggers to your smart home

SwitchBot S10: cleaning re-imagined!

0
SwitchBot S10 promises unattended vacuuming and mopping so you can focus on things you love and care for. Does it deliver?