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.

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

Sonoff R3 DIY mode & why it sucks

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

IKEA TRADFRI Wireless dimmer in NodeRED

0
Thanks to NodeRED you can use IKEA TRADFRI Wireless Dimmer to interact with everything

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

Flashing Tasmota on Sonoff ZigBee Bridge

0
How to flash Tasmota on Sonoff ZigBee Bridge to enable it for NodeRED and Home Assistant

Nora – Google Assistant in NodeRED

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

Smart Home

How to use Aqara T1 with ZigBee2MQTT

0
Learn how to add Aqara T1 and other in wall relays to NodeRED and build an awesome dashboard that comes with power consumption data that works for all relays.

One switch for all your needs? Shelly 1L

0
Shelly 1L can be installed in no--neutral and live and neutral configurations. Check out what else it brings to the table

Is Aqara T1 ZigBee switch all I asked for?

0
Aqara introduces 2 new switches Aqara T1 ZigBee switch in no-neutral and L & N configurations

No more hubs: Aqara G2H

0
Aqara G2H brings the power of ZigBee sensors to an IP camera.

Two cool features of Avatar Smart Bulbs

0
Avatar Smart Bulbs come with 2 cool features I wish more smart bulb manufacturers would include in their products.